Skip to content

stm32 ospi driver : 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
10 changes: 1 addition & 9 deletions boards/st/b_u585i_iot02a/b_u585i_iot02a-common.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,7 @@ stm32_lp_tick_source: &lptim1 {
four-byte-opcodes;
status = "okay";

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

partition@0 {
reg = <0x00000000 DT_SIZE_M(64)>;
};
};
/* Partition of the external NOR is defined in each variant. */
};
};

Expand Down
12 changes: 12 additions & 0 deletions boards/st/b_u585i_iot02a/b_u585i_iot02a.dts
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,15 @@
st,adc-prescaler = <4>;
status = "okay";
};

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

partition@0 {
reg = <0x00000000 DT_SIZE_M(64)>;
};
};
};
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;
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) )>;
};
};

&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/xip
name: ST B_U585I_IOT02A Discovery kit xip target
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
ram: 786
flash: 512
vendor: st
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
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
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
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
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ manifest:
groups:
- crypto
- name: mcuboot
revision: 461e060e8687c9a75074effcc61d7f68c5112cfd
revision: pull/2399/head
path: bootloader/mcuboot
groups:
- bootloader
Expand Down
Loading