fpga_rom: Integrate TFLM
This is behind a compile-time feature flag "tflm_inference". When
enabled, we link in tensorflow-microlite and use it for classification.
BUG=b:206337455
TEST=./scripts/fpga-rom-run
Change-Id: I1734764bf77436840429cb63fd19dbcc031bacdd
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/hps-firmware/+/3295627
Commit-Queue: David Lattimore <dml@chromium.org>
Tested-by: David Lattimore <dml@chromium.org>
Reviewed-by: Dan Callaghan <dcallagh@chromium.org>
diff --git a/scripts/fpga-rom-run b/scripts/fpga-rom-run
index 412cf84..ad2a9d1 100755
--- a/scripts/fpga-rom-run
+++ b/scripts/fpga-rom-run
@@ -12,8 +12,17 @@
PROJECT_ROOT=$(git rev-parse --show-toplevel)
ROM="${PROJECT_ROOT}/build/hps_platform/soc_rom.bin"
+FEATURES=image-transfer
+if [ "$TFLM" != "0" ]; then
+ FEATURES+=,tflm_inference
+fi
+
cd "${PROJECT_ROOT}/rust/riscv"
-BUILD_FLAGS=(-p fpga_rom --release --features image-transfer)
+BUILD_FLAGS=(
+ -p fpga_rom
+ --release
+ --no-default-features
+ --features "${FEATURES}")
# Build first, since if there are errors, `cargo objcopy` won't report them in a
# useful way.
cargo build "${BUILD_FLAGS[@]}"