From 5627222f4aa6bb1233721d246756bb5c3efb962b Mon Sep 17 00:00:00 2001 From: Jeremy Janella Date: Sat, 15 Aug 2026 18:25:35 -0400 Subject: [PATCH] docs: updated readme --- README.md | 102 +++++++++++++++++++----------------------------------- 1 file changed, 35 insertions(+), 67 deletions(-) diff --git a/README.md b/README.md index a9b736f..6bf3f64 100644 --- a/README.md +++ b/README.md @@ -112,28 +112,17 @@ int main() { } ``` +Also, create an overlay for the firmware being executed in place. This is so the code jumps to addresses in the right block. Create `zephyr/samples/basic/blinkyslow/boards/nucleo_g431rb.overlay` - -## Build the blinkys - -The west build `-DSB_CONFIG_BOOTLOADER_MCUBOOT=y` flag enables MCUboot on the blinkys. - -```sh -west build -p always -b nucleo_g431rb zephyr/samples/basic/blinky -d build/blinky --sysbuild -- -DSB_CONFIG_BOOTLOADER_MCUBOOT=y #-CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD=y - -west build -p always -b nucleo_g431rb zephyr/samples/basic/blinkyslow -d build/blinkyslow --sysbuild -- -DSB_CONFIG_BOOTLOADER_MCUBOOT=y +``` +/ { + chosen { + zephyr,code-partition = &slot1_partition; + }; +}; ``` -## Flash the blinkys -```sh -pyocd flash -t stm32g431rbtx build -/blinky/mcuboot/zephyr/zephyr.bin - -pyocd flash -t stm32g431rbtx --base-address 0x0000C000 build/blinky/blinky/zephyr/zephyr.bin -``` - -(blinkyslow is a clone of blinky with a different frequency) ## Set up crypto @@ -143,28 +132,6 @@ python bootloader/mcuboot/scripts/imgtool.py keygen -k private.pem -t rsa-2048 openssl rsa -in private.pem -pubout > public.pem ``` -## Sign the blinkys -```sh -python bootloader/mcuboot/scripts/imgtool.py sign \ - --key private.pem \ - --header-size 0x200 \ - --pad-header \ - --align 8 \ - --version 1.2 \ - --slot-size 0x8000 \ - build/blinky/zephyr/zephyr.bin \ - blinky-signed.bin - -python bootloader/mcuboot/scripts/imgtool.py sign \ - --key private.pem \ - --header-size 0x200 \ - --pad-header \ - --align 8 \ - --version 1.2 \ - --slot-size 0x8000 \ - build/blinkyslow/zephyr/zephyr.bin \ - blinkyslow-signed.bin -``` @@ -178,6 +145,32 @@ west build -p always -b nucleo_g431rb -d build_fast zephyr/samples/basic/blinky west build -p always -b nucleo_g431rb -d build_slow zephyr/samples/basic/blinkyslow ``` + +## Sign the firmware +```sh +python bootloader/mcuboot/scripts/imgtool.py sign \ + --key private.pem \ + --header-size 0x200 \ + --pad-header \ + --align 8 \ + --pad \ + --version 1.2 \ + --slot-size 0xA000 \ + build_fast/zephyr/zephyr.bin \ + blinky-signed.bin + +python bootloader/mcuboot/scripts/imgtool.py sign \ + --key private.pem \ + --header-size 0x200 \ + --pad-header \ + --align 8 \ + --pad \ + --version 1.2 \ + --slot-size 0xA000 \ + build_slow/zephyr/zephyr.bin \ + blinkyslow-signed.bin +``` + ## Flash the firmware `su root` allows flashing to usb devices, run `nix develop` again if using it. @@ -185,34 +178,9 @@ west build -p always -b nucleo_g431rb -d build_slow zephyr/samples/basic/blinkys `flash0@0x08000000` in `zephyr/dts/arm/st/g4/stm32g4.dtsi` ```sh pyocd flash -t stm32g431rbtx build_mcuboot/zephyr/zephyr.hex - -pyocd flash -t stm32g431rbtx --base-address 0x0800C000 build_fast/zephyr/zephyr.bin - -pyocd flash -t stm32g431rbtx --base-address 0x08014000 build_slow/zephyr/zephyr.bin +pyocd flash -t stm32g431rbtx --base-address 0x0800C000 blinky-signed.bin +pyocd flash -t stm32g431rbtx --base-address 0x08016000 blinkyslow-signed.bin ``` - - - - - - - -