boards: arm: stm32u585 disco with external memory region for XiP

Declare a sub-region of the whole ext_memory with attributes
ATTR_MPU_IO so that XiP becomes possible on this external
octo- NOR flash. Use the STM32CubeProgrammer runner
with the external loader for flashing.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
Francois Ramu 2024-05-13 11:01:13 +02:00 committed by David Leach
commit 78fb2313c7
2 changed files with 16 additions and 1 deletions

View file

@ -6,6 +6,8 @@
/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";
@ -25,6 +27,14 @@
led1 = &red_led_1;
sw0 = &user_button;
};
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 {

View file

@ -12,8 +12,13 @@ if(CONFIG_BUILD_WITH_TFM)
endif()
endif()
board_runner_args(stm32cubeprogrammer "--erase" "--port=swd" "--reset-mode=hw")
if(CONFIG_STM32_MEMMAP)
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
board_runner_args(stm32cubeprogrammer "--hex-file=${ZEPHYR_BASE}/build/zephyr/zephyr.hex")
board_runner_args(stm32cubeprogrammer "--extload=MX25LM51245G_STM32U585I-IOT02A.stldr")
else()
board_runner_args(stm32cubeprogrammer "--erase" "--port=swd" "--reset-mode=hw")
endif()
board_runner_args(openocd "--tcl-port=6666")
board_runner_args(openocd --cmd-pre-init "gdb_report_data_abort enable")