blob: 304fce9f0e2950053f081acbef927bd8cbfd14ef [file] [log] [blame]
David Lattimore42b2bb12022-01-06 08:58:29 +11001#!/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 the Rust FPGA ROM.
8
9set -e
10
11PROJECT_ROOT=$(git rev-parse --show-toplevel)
12ROM="${PROJECT_ROOT}/build/hps_platform/fpga_rom.bin"
13
14FEATURES="${FEATURES-tflm}"
15
Dan Callaghan30a4ee22022-01-10 19:16:25 +110016source "${PROJECT_ROOT}/environment"
17
David Lattimore42b2bb12022-01-06 08:58:29 +110018cd "${PROJECT_ROOT}/rust/riscv"
19BUILD_FLAGS=(
20 -p fpga_rom
21 --release
22 --no-default-features
23 --features "${FEATURES}")
24
25cargo build "${BUILD_FLAGS[@]}"
26
Dan Callaghan30a4ee22022-01-10 19:16:25 +110027"${OBJCOPY-llvm-objcopy}" \
David Lattimore42b2bb12022-01-06 08:58:29 +110028 "target/riscv32i-unknown-none-elf/release/fpga_rom" \
29 -O binary \
30 "${ROM}"