David Lattimore | 60e282a | 2021-05-26 11:27:48 +1000 | [diff] [blame^] | 1 | #!/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 | |
| 10 | set -e |
| 11 | |
| 12 | PROJECT_ROOT=$(git rev-parse --show-toplevel) |
| 13 | ROM="${PROJECT_ROOT}/build/hps_platform/soc_rom.bin" |
| 14 | |
| 15 | cd "${PROJECT_ROOT}/mcu_rom/riscv" |
| 16 | # Build first, since if there are errors, `cargo objcopy` won't report them in a |
| 17 | # useful way. |
| 18 | cargo build -p fpga_rom --release |
| 19 | cargo 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 | "$@" |