#!/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 ..." stm32flash -w "$output_dir/$output_name.bin" -v /dev/ttyUSB0 # st-flash write "$output_dir/$output_name.bin" 0x8000000 fi