-
Notifications
You must be signed in to change notification settings - Fork 8k
STM32 OSPI NOR: run application from external flash memory #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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the purpose of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it indicates where to download the application There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removing
and the samples/hello_world/ cannot build anymore
It should, though, without any mcuboot There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||||||
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)>; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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 | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
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 |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -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") | ||||||
FRASTM marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
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)) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
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") | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not needed, should be in |
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; | ||
}; | ||
}; |
There was a problem hiding this comment.
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 includesoc-nv-flash
binding, then ext Flash node should definewrite-block-size
anderase-block-size
properties, this way MCUboot MAX_IMG_SECTORS will be calculated automatically. See 1st commit of #97037.