blob: 134f84ec9ef6d39eebb9de5dd297f069310d6574 [file] [log] [blame]
David Lattimore60e282a2021-05-26 11:27:48 +10001#!/bin/bash
2
3# Copyright 2021 The Chromium OS Authors. All rights reserved.
4# Use of this source code is governed by a BSD-style license that can be
5# found in the LICENSE file.
6
7# Builds and runs the Rust SOC ROM. ./scripts/proto2-run should already be
8# running in a separate shell.
9
10set -e
11
12PROJECT_ROOT=$(git rev-parse --show-toplevel)
13ROM="${PROJECT_ROOT}/build/hps_platform/soc_rom.bin"
14
15cd "${PROJECT_ROOT}/mcu_rom/riscv"
16# Build first, since if there are errors, `cargo objcopy` won't report them in a
17# useful way.
18cargo build -p fpga_rom --release
19cargo objcopy -p fpga_rom --release -- -O binary "${ROM}"
20"${PROJECT_ROOT}/scripts/hps-mon" \
21 --openocd-port 4444 \
22 --gateware "${PROJECT_ROOT}/build/hps_platform/gateware/hps_platform.bit" \
23 --soc-rom "${ROM}" \
24 --cmd 'reset_mcu; write_soc_rom; reset_fpga' \
25 "$@"