Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions boards/st/b_u585i_iot02a/b_u585i_iot02a-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ stm32_lp_tick_source: &lptim1 {
data-rate = <OSPI_DTR_TRANSFER>;
four-byte-opcodes;
status = "okay";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

st,stm32-ospi-nor binding shall include soc-nv-flash binding, then ext Flash node should define write-block-size and erase-block-size properties, this way MCUboot MAX_IMG_SECTORS will be calculated automatically. See 1st commit of #97037.

/* The partition of the external NOR is defined in each board variant. */
};
};

Expand Down
110 changes: 110 additions & 0 deletions boards/st/b_u585i_iot02a/b_u585i_iot02a_stm32u585xx_ext_flash_app.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Copyright (c) 2025 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;
#include "b_u585i_iot02a-common.dtsi"
#include <zephyr/dt-bindings/memory-attr/memory-attr.h>
#include <zephyr/dt-bindings/memory-attr/memory-attr-arm.h>

/ {
model = "STMicroelectronics B-U585I-IOT02A discovery kit";
compatible = "st,b-u585i-iot02a";

chosen {
zephyr,console = &usart1;
zephyr,shell-uart = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the purpose of zephyr,flash here?

Copy link
Contributor Author

@FRASTM FRASTM Oct 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it indicates where to download the application
With this, mcuboot is downloaded in the (internal) flash (like any other samples/basic application).

Copy link
Contributor

@JarmouniA JarmouniA Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be in MCUboot overlay, please see #97037 and mcu-tools/mcuboot#2479

Copy link
Contributor Author

@FRASTM FRASTM Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing

chosen {
		zephyr,flash = &flash0;
}

and the samples/hello_world/ cannot build anymore

section `rom_start' will not fit in region `FLASH'
 region `FLASH' overflowed by 17616 bytes

It should, though, without any mcuboot

Copy link
Contributor

@JarmouniA JarmouniA Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ext_flash_app variant is only meant to be used with MCUboot, and its zephyr,flash should point to external Flash, this way no overlay with be needed at the user app level.

zephyr,code-partition = &slot0_partition;
zephyr,bt-hci = &bt_hci_uart;
};

aliases {
led0 = &green_led_1;
led1 = &red_led_1;
sw0 = &user_button;
die-temp0 = &die_temp;
};

octo_nor: memory@70000000 {
compatible = "zephyr,memory-region";
reg = <0x70000000 DT_SIZE_M(64)>;
zephyr,memory-region = "EXTMEM";
/* The ATTR_MPU_EXTMEM attribut causing a MPU FAULT */
zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_IO)>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
zephyr,memory-attr = <DT_MEM_ARM(ATTR_MPU_IO)>;
zephyr,memory-attr = <DT_MEM_ARM_MPU_FLASH>;

IO is for memory-mapped devices.

};
};

&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

/*
* Following flash partition is dedicated to the use of b_u585i_iot02a
* with TZEN=0 (so w/o TFM).
* Set the partitions with first MB to make use of the whole Bank1
*/
boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 DT_SIZE_K(64)>;
};

storage_partition: partition@f0000 {
label = "storage";
reg = <0x000f0000 DT_SIZE_K(64)>;
};
};
};

&gpdma1 {
status = "okay";
};

&uart4 {
pinctrl-0 = <&uart4_tx_pc10 &uart4_rx_pc11>;
pinctrl-names = "default";
current-speed = <100000>;
status = "okay";

bt_hci_uart: bt_hci_uart {
compatible = "zephyr,bt-hci-uart";
status = "okay";
};
};

&die_temp {
status = "okay";
};

&adc1 {
st,adc-prescaler = <4>;
status = "okay";
};

&mx25lm51245 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

slot0_partition: partition@0 {
label = "image-0";
reg = <0x00000000 DT_SIZE_K(416)>;
};

slot1_partition: partition@68000 {
label = "image-1";
reg = <0x00068000 DT_SIZE_K(416)>;
};

scratch_partition: partition@d0000 {
label = "image-scratch";
reg = <0x000d0000 DT_SIZE_K(192)>;
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
identifier: b_u585i_iot02a/stm32u585xx/ext_flash_app
name: ST B_U585I_IOT02A Discovery kit ext_flash_app target
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
ram: 786
flash: 416
vendor: st
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vendor: st
vendor: st
sysbuild: true

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SPDX-License-Identifier: Apache-2.0

# enable uart driver
CONFIG_SERIAL=y

# enable GPIO
CONFIG_GPIO=y

# console
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
8 changes: 3 additions & 5 deletions boards/st/b_u585i_iot02a/board.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,17 @@ if(CONFIG_BUILD_WITH_TFM)
# Flash merged TF-M + Zephyr binary
set_property(TARGET runners_yaml_props_target PROPERTY hex_file tfm_merged.hex)

if (CONFIG_HAS_FLASH_LOAD_OFFSET)
if(CONFIG_HAS_FLASH_LOAD_OFFSET)
MATH(EXPR TFM_HEX_BASE_ADDRESS_NS "${TFM_FLASH_BASE_ADDRESS}+${CONFIG_FLASH_LOAD_OFFSET}")
else()
set(TFM_HEX_BASE_ADDRESS_NS ${TFM_TFM_FLASH_BASE_ADDRESS})
endif()
endif()

# keep first
if(CONFIG_STM32_MEMMAP)
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
board_runner_args(stm32cubeprogrammer "--extload=MX25LM51245G_STM32U585I-IOT02A.stldr")
else()
board_runner_args(stm32cubeprogrammer "--erase" "--port=swd" "--reset-mode=hw")
if(CONFIG_STM32_MEMMAP OR (CONFIG_XIP AND CONFIG_BOOTLOADER_MCUBOOT))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if(CONFIG_STM32_MEMMAP OR (CONFIG_XIP AND CONFIG_BOOTLOADER_MCUBOOT))
if(CONFIG_STM32_MEMMAP OR CONFIG_BOOTLOADER_MCUBOOT)

RAM Load MCUboot mode can be used as well.

board_runner_args(stm32cubeprogrammer "--extload=MX25LM51245G_STM32U585I-IOT02A.stldr")
endif()

board_runner_args(openocd "--tcl-port=6666")
Expand Down
1 change: 1 addition & 0 deletions boards/st/b_u585i_iot02a/board.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ board:
- name: stm32u585xx
variants:
- name: ns
- name: ext_flash_app
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_FLASH=y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not needed, should be in ext_flash_app variant DTS.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (c) 2025 STMicroelectronics
*
* SPDX-License-Identifier: Apache-2.0
*/

/*
* Define the device, controller and partition to be the external memory
* for running the application in external NOR from MCUboot
*/

/ {
chosen {
zephyr,flash = &mx25lm51245;
zephyr,flash-controller = &mx25lm51245;
};
};
1 change: 1 addition & 0 deletions samples/sysbuild/with_mcuboot/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tests:
- esp32c6_devkitc/esp32c6/hpcore
- nucleo_h7s3l8
- nucleo_u385rg_q
- b_u585i_iot02a/stm32u585xx/ext_flash_app
- stm32h7s78_dk
- stm32h573i_dk
integration_platforms:
Expand Down