diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..4c16006 --- /dev/null +++ b/build.sh @@ -0,0 +1,21 @@ +#!/bin/busybox ash +set -e + +cargo +stable build --release + +output_dir="target/thumbv7m-none-eabi/release" +output_name="spidump" + +llvm-size -d "$output_dir/$output_name" | ( + read line + echo $line + read line + echo $line | sed -r ':L;s=\b([0-9]+)([0-9]{3})\b=\1K=g;t L' +) | column -t -s' ' + +llvm-objcopy -O binary "$output_dir/$output_name" "$output_dir/$output_name.bin" + +if [ "$(basename "$0")" == "flash.sh" ]; then + echo "Writing file $output_dir/$output_name.bin to device ..." + st-flash write "$output_dir/$output_name.bin" 0x8000000 +fi diff --git a/flash.sh b/flash.sh new file mode 120000 index 0000000..c07a74d --- /dev/null +++ b/flash.sh @@ -0,0 +1 @@ +build.sh \ No newline at end of file