#!/usr/bin/env bash # Builds rtt_demo.elf (committed beside this directory) from src/main.rs. # Needs the thumbv6m-none-eabi target: rustup target add thumbv6m-none-eabi set -euo pipefail HERE=$(cd "$(dirname "$0")" && pwd) cd "$HERE" # The ELF is committed, and its debug info names the paths it was built from: no machine's # paths go in it. export CARGO_ENCODED_RUSTFLAGS="$(printf -- '--remap-path-prefix=%s=/build/toolroot\037--remap-path-prefix=%s=/build/flowrs\037-Clink-arg=-Tlink.x\037-Clink-arg=-Tdefmt.x' "$HOME" "$HERE")" cargo build --release $( [ -f Cargo.lock ] && echo --locked ) OUT=${CARGO_TARGET_DIR:-target}/thumbv6m-none-eabi/release/rtt-demo cp "$OUT" ../rtt_demo.elf ls -l ../rtt_demo.elf