summaryrefslogtreecommitdiff
path: root/fw/nucleo.sh
diff options
context:
space:
mode:
Diffstat (limited to 'fw/nucleo.sh')
-rwxr-xr-xfw/nucleo.sh29
1 files changed, 23 insertions, 6 deletions
diff --git a/fw/nucleo.sh b/fw/nucleo.sh
index 24966b1..be694b8 100755
--- a/fw/nucleo.sh
+++ b/fw/nucleo.sh
@@ -23,24 +23,41 @@ SCRIPT="$(realpath "$0")"
FW="$(dirname "$SCRIPT")"
ROOT="$(dirname "$FW")"
BUILD="${ROOT}/nucleo"
-FIRMWARE="${BUILD}/fw/zephyr/zephyr.bin"
-FLASH_ADDRESS='0x8000000'
+BOOTLOADER_FIRMWARE="${BUILD}/fw/bootloader/zephyr/zephyr.bin"
+APPLICATION_FIRMWARE="${BUILD}/fw/zephyr/zephyr.bin"
+APPLICATION_FIRMWARE_SIGNED="${BUILD}/fw/zephyr/zephyr.signed.bin"
+BOOTLOADER_FLASH_ADDRESS='0x8000000'
+APPLICATION_FLASH_ADDRESS='0x8040000'
+MCUBOOT="${ROOT}/fw/zephyrproject/bootloader/mcuboot"
+IMGTOOL="${MCUBOOT}/scripts/imgtool.py"
+KEY="${HOME}/mcuboot/key.pem"
BOARD='nucleo_f767zi'
+EXTRA_CONFIGS="${ROOT}/fw/nucleo.conf"
BAUDRATE='115200'
SERIAL_PORT='/dev/ttyACM0'
CONFIG_OVERLAY="${FW}/my.conf"
-overlay_config=''
if test -f "$CONFIG_OVERLAY"
then
- overlay_config="-DEXTRA_CONF_FILE="${CONFIG_OVERLAY}""
+ EXTRA_CONFIGS="${EXTRA_CONFIGS} ${CONFIG_OVERLAY}"
fi
set -x
rm -rf "$BUILD"
-cmake "-B${BUILD}" -GNinja -DBOARD="$BOARD" "$overlay_config"
+cmake "-B${BUILD}" -GNinja -DBOARD="$BOARD" \
+ -DEXTRA_CONF_FILE="${EXTRA_CONFIGS}" -DKEY="$KEY"
ninja -C "$BUILD"
-st-flash --connect-under-reset write "$FIRMWARE" "$FLASH_ADDRESS"
+python "$IMGTOOL" sign \
+ --version 0.0.0 \
+ --header-size 0x200 \
+ --slot-size 0xc0000 \
+ --key "$KEY" \
+ "$APPLICATION_FIRMWARE" \
+ "$APPLICATION_FIRMWARE_SIGNED"
+st-flash --connect-under-reset write "$BOOTLOADER_FIRMWARE" \
+ "$BOOTLOADER_FLASH_ADDRESS"
+st-flash --connect-under-reset write "$APPLICATION_FIRMWARE_SIGNED" \
+ "$APPLICATION_FLASH_ADDRESS"
picocom -b "$BAUDRATE" "$SERIAL_PORT"