Skip to content

Commit

Permalink
wip: stm32f4 example
Browse files Browse the repository at this point in the history
  • Loading branch information
JPHutchins committed Sep 2, 2024
1 parent 01456f3 commit 7e9b7d0
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 0 deletions.
13 changes: 13 additions & 0 deletions dutfirmware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,16 @@ And then you only have to flash once:
```
west flash --runner=linkserver -d build/mimxrt1060_evkb --hex-file a_smp_dut_8192_1_8192.merged.hex
```

### ST

#### stm32f4_disco

> Note: documented on Zephyr `v3.7.0-1987-g1540bd7d`
Create bootloader:

```
west build -b stm32f4_disco -d build/stm32f4_disco_mcuboot bootloader/mcuboot/boot/zephyr -- -DCONFIG_BUILD_OUTPUT_HEX=y -DEXTRA_DTC_OVERLAY_FILE="${ENVR_ROOT}/stm32f4_disco_flash_overlay.dts;${ENVR_ROOT}/stm32f4_disco_serial_overlay.dts;${ENVR_ROOT}/stm32f4_disco_serial_recovery_button_overlay.dts" -DEXTRA_CONF_FILE="${ENVR_ROOT}/mcuboot_serial.conf"
```

1 change: 1 addition & 0 deletions dutfirmware/envr-default
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@ PYTHON_VENV=.venv
# override here or in envr-local
JLINK=C:/Program Files/SEGGER/JLink
LINK_SERVER=C:/NXP/LinkServer_1.6.133
OPENOCD=$HOME/.local/xpack-openocd-0.12.0-4/bin

[ALIASES]
23 changes: 23 additions & 0 deletions dutfirmware/mcuboot_serial.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
CONFIG_MAIN_STACK_SIZE=32768

# Enable SMP serial DFU
CONFIG_CONSOLE=n
CONFIG_LOG=n
CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=y
CONFIG_UART_LINE_CTRL=y
CONFIG_MCUBOOT_SERIAL=y
CONFIG_BOOT_MGMT_ECHO=y
CONFIG_BOOT_SERIAL_IMG_GRP_HASH=y
CONFIG_BOOT_SERIAL_IMG_GRP_IMAGE_STATE=y

# Allow upload to the primary slot
CONFIG_MCUBOOT_SERIAL_DIRECT_IMAGE_UPLOAD=y

# Serial Recovery
CONFIG_BOOT_SERIAL_NO_APPLICATION=y

# # Measured ~7.1 kB/s on 115200 baud (STM32F407 Discovery)
CONFIG_BOOT_MAX_LINE_INPUT_LEN=4096
CONFIG_BOOT_LINE_BUFS=2
CONFIG_BOOT_SERIAL_MAX_RECEIVE_SIZE=4096
24 changes: 24 additions & 0 deletions dutfirmware/stm32f4_disco_flash_overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x10000>;
};
slot0_partition: partition@10000 {
label = "image-0";
reg = <0x00010000 0x40000>;
};
slot1_partition: partition@50000 {
label = "image-1";
reg = <0x00050000 0x40000>;
};
storage_partition: partition@7e000 {
label = "storage";
reg = <0x0007e000 DT_SIZE_K(8)>;
};
};
};
5 changes: 5 additions & 0 deletions dutfirmware/stm32f4_disco_serial_overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/ {
chosen {
zephyr,uart-mcumgr = &usart2;
};
};
5 changes: 5 additions & 0 deletions dutfirmware/stm32f4_disco_serial_recovery_button_overlay.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/ {
aliases {
mcuboot-button0 = &user_button;
};
};

0 comments on commit 7e9b7d0

Please sign in to comment.