summaryrefslogtreecommitdiff
path: root/fw/nucleo.sh
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2025-03-21 22:48:02 +0100
committerxengineering <me@xengineering.eu>2025-03-21 22:48:02 +0100
commita398f3b7420525b11c31dadf07b0cd696f1f6d3c (patch)
tree1715700740f9285b120bee8d3e8df7a53bc24efc /fw/nucleo.sh
parent61238e93e2c5b3c672d3a55f6273bfd3615f05d7 (diff)
downloadiot-contact-a398f3b7420525b11c31dadf07b0cd696f1f6d3c.tar
iot-contact-a398f3b7420525b11c31dadf07b0cd696f1f6d3c.tar.zst
iot-contact-a398f3b7420525b11c31dadf07b0cd696f1f6d3c.zip
fw: Use MCUboot bootloader for nucleo_f767zi
Using it for the native_sim board is not trivial. Thus it is first only added for the Nucleo board.
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"