wideband/firmware/boards/f0_module/build_wideband.sh

38 lines
1.4 KiB
Bash
Raw Normal View History

2020-12-10 23:37:28 -08:00
#!/bin/bash
2021-12-27 20:51:09 -08:00
set -e
2020-12-10 23:37:28 -08:00
# first build the bootloader
cd bootloader
./build_bootloader.sh
# back out to the root
cd ../../..
2020-12-10 23:37:28 -08:00
# delete the elf to force a re-link (it might not pick up the bootloader otherwise)
2021-12-27 20:54:25 -08:00
rm -rf build/
rm -f ../for_rusefi/wideband_image.h
2020-12-10 23:37:28 -08:00
2020-12-14 15:46:54 -08:00
# build app firmware!
2021-12-27 20:23:26 -08:00
make -j12 BOARD=f0_module
2020-12-10 23:37:28 -08:00
# Copy the bin without the bootloader (the image consumed by rusEfi has no bootloader on it)
2020-12-14 14:57:49 -08:00
dd if=build/wideband.bin of=build/wideband_noboot_no_pad.bin skip=6144 bs=1
# extend the image out to full size (32k (flash) - 6k (bootloader) - 1k (config) - 4 (crc) = 25k - 4 = 0x63FC)
arm-none-eabi-objcopy -I binary -O binary --gap-fill 0xFF --pad-to 0x63FC build/wideband_noboot_no_pad.bin build/wideband_fullsize_nocrc.bin
2020-12-14 15:46:54 -08:00
# compute the crc and write that to a file (in binary)
2020-12-14 14:57:49 -08:00
crc32 build/wideband_fullsize_nocrc.bin | xxd -r -p - > build/wideband_crc.bin
# Now glue the image and CRC together
cat build/wideband_fullsize_nocrc.bin build/wideband_crc.bin > build/wideband_image.bin
2020-12-10 23:37:28 -08:00
2020-12-14 15:46:54 -08:00
# For good measure build a complete bin that includes the bootloader
cat boards/f0_module/bootloader/build/wideband_bootloader.padded.bin build/wideband_image.bin > ../for_rusefi/wideband_image_with_bl.bin
2020-12-14 15:46:54 -08:00
2020-12-10 23:37:28 -08:00
# Convert to a header file, and tack "static const " on the front of it
2020-12-14 14:57:49 -08:00
xxd -i build/wideband_image.bin \
2020-12-10 23:37:28 -08:00
| cat <(echo -n "static const ") - \
> ../for_rusefi/wideband_image.h