You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
671 B
30 lines
671 B
#!/bin/sh |
|
# make an intel hex file including bootloader, for loading with DFU |
|
|
|
if [ $# -lt 4 ]; then |
|
echo "Usage: make_intel_hex.sh BINFILE BOOTLOADER RESERVE_KB HEXFILEOUT" |
|
exit 1 |
|
fi |
|
|
|
SCRIPTS=$(dirname $0) |
|
|
|
BINFILE="$1" |
|
BOOTLOADERFILE="$2" |
|
RESERVE_KB="$3" |
|
HEXFILE="$4" |
|
|
|
[ -f "$BINFILE" ] || { |
|
echo "Can't find bin file $BINFILE" |
|
exit 1 |
|
} |
|
|
|
[ -f "$BOOTLOADERFILE" ] || { |
|
echo "Can't find bootloader file $BOOTLOADERFILE" |
|
exit 1 |
|
} |
|
|
|
cat "$BOOTLOADERFILE" > "$HEXFILE".tmp |
|
dd bs=1024 seek=$RESERVE_KB if="$BINFILE" of="$HEXFILE".tmp 2>&1 |
|
"$SCRIPTS"/bin2hex.py --offset 0x08000000 "$HEXFILE".tmp "$HEXFILE" |
|
rm -f "$HEXFILE".tmp |
|
echo "Created $HEXFILE"
|
|
|