tool: Add script to load pre-loaded app into flash

This commit is contained in:
Mikael Ågren 2025-03-13 15:34:14 +01:00
parent 6e793bea26
commit 8e7108f7ee
No known key found for this signature in database
GPG Key ID: E02DA3D397792C46

View File

@ -0,0 +1,34 @@
#!/bin/bash -e
if [ $# != 2 ]
then
echo "Usage: $0 slot_num app_file"
echo ""
echo "Where slot_num is 0 or 1."
exit
fi
SLOT_NUM="$1"
APP="$2"
if [ "$SLOT_NUM" = "0" ]; then
START_ADDRESS=0x30000
elif [ "$SLOT_NUM" = "1" ]; then
START_ADDRESS=0x50000
else
echo "Invalid slot_num"
exit 1
fi
echo "WARNING: Will install default partition table."
read -p "Press CTRL-C to abort. Press key to continue." -n1 -s
# Write both copies of the partition table
tillitis-iceprog -o 128k default_partition.bin
tillitis-iceprog -o 0xf0000 default_partition.bin
# Erase existing pre loaded app
tillitis-iceprog -o "$START_ADDRESS" -e 128k
# Write pre loaded app
tillitis-iceprog -o "$START_ADDRESS" "$APP"