Skip to content

stm32u5 run application in external flash memory XIP #93032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
15 changes: 13 additions & 2 deletions boards/st/b_u585i_iot02a/b_u585i_iot02a-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,19 @@ stm32_lp_tick_source: &lptim1 {
#address-cells = <1>;
#size-cells = <1>;

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

slot1_partition: partition@40000 {
label = "image-1";
reg = <0x00040000 DT_SIZE_K(256)>;
};

scratch_partition: partition@e0000 {
label = "image-scratch";
reg = <0x000e0000 DT_SIZE_K(64)>;
};
};
};
Expand Down
15 changes: 0 additions & 15 deletions boards/st/b_u585i_iot02a/b_u585i_iot02a.dts
Original file line number Diff line number Diff line change
Expand Up @@ -54,21 +54,6 @@
reg = <0x00000000 DT_SIZE_K(64)>;
};

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

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

scratch_partition: partition@e0000 {
label = "image-scratch";
reg = <0x000e0000 DT_SIZE_K(64)>;
};

storage_partition: partition@f0000 {
label = "storage";
reg = <0x000f0000 DT_SIZE_K(64)>;
Expand Down
1 change: 0 additions & 1 deletion boards/st/b_u585i_iot02a/b_u585i_iot02a.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ supported:
- arduino_spi
- hts221
- dma
- usb_device
- spi
- dac
- adc
Expand Down
6 changes: 2 additions & 4 deletions boards/st/b_u585i_iot02a/board.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ if(CONFIG_BUILD_WITH_TFM)
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))
board_runner_args(stm32cubeprogrammer "--extload=MX25LM51245G_STM32U585I-IOT02A.stldr")
endif()

board_runner_args(openocd "--tcl-port=6666")
Expand Down
17 changes: 17 additions & 0 deletions samples/sysbuild/with_mcuboot/boards/b_u585i_iot02a.overlay
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 @@ -17,6 +17,7 @@ tests:
- nucleo_h7s3l8
- nucleo_u385rg_q
- stm32h7s78_dk
- b_u585i_iot02a
integration_platforms:
- nrf52840dk/nrf52840
- esp32_devkitc/esp32/procpu
Expand Down
4 changes: 3 additions & 1 deletion soc/st/stm32/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@ DT_STM32_LPTIM_PATH := $(dt_nodelabel_path,stm32_lp_tick_source)

DT_CHOSEN_Z_FLASH := zephyr,flash
DT_COMPAT_XSPI := st,stm32-xspi
DT_COMPAT_OSPI := st,stm32-ospi

DT_CHOSEN_FLASH_NODE := $(dt_chosen_path,$(DT_CHOSEN_Z_FLASH))
DT_CHOSEN_FLASH_PARENT := $(dt_node_parent,$(DT_CHOSEN_FLASH_NODE))
DT_FLASH_PARENT_IS_XSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_XSPI))
DT_FLASH_PARENT_IS_OSPI := $(dt_node_has_compat,$(DT_CHOSEN_FLASH_PARENT),$(DT_COMPAT_OSPI))

config SYS_CLOCK_HW_CYCLES_PER_SEC
default "$(DT_STM32_RCC_CLOCK_FREQ)" if "$(dt_nodelabel_enabled,rcc)"
Expand Down Expand Up @@ -82,7 +84,7 @@ config BUILD_WITH_TFM

config FLASH_BASE_ADDRESS
default $(dt_node_reg_addr_hex,$(DT_CHOSEN_FLASH_PARENT),1) \
if $(DT_FLASH_PARENT_IS_XSPI)
if $(DT_FLASH_PARENT_IS_XSPI) || $(DT_FLASH_PARENT_IS_OSPI)
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))

# The XSPI PSRAM driver creates a SMH region with attribute SMH_REG_ATTR_EXTERNAL (2)
Expand Down
Loading