tack on crc

This commit is contained in:
Matthew Kennedy 2020-12-14 14:57:49 -08:00
parent e3ebe524e4
commit 60b44d5287
1 changed files with 11 additions and 2 deletions

View File

@ -12,9 +12,18 @@ rm ../for_rusefi/wideband_image.h
make -j12
# Copy the bin without the bootloader (the image consumed by rusEfi has no bootloader on it)
dd if=build/wideband.bin of=build/wideband_noboot.bin skip=6144 bs=1
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
# compute the crc and write that to a file
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
# Convert to a header file, and tack "static const " on the front of it
xxd -i build/wideband_noboot.bin \
xxd -i build/wideband_image.bin \
| cat <(echo -n "static const ") - \
> ../for_rusefi/wideband_image.h