From 78fb2313c7e1688aadf5189db3b5a8576e722db0 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Mon, 13 May 2024 11:01:13 +0200 Subject: [PATCH] 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 --- boards/st/b_u585i_iot02a/b_u585i_iot02a.dts | 10 ++++++++++ boards/st/b_u585i_iot02a/board.cmake | 7 ++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/boards/st/b_u585i_iot02a/b_u585i_iot02a.dts b/boards/st/b_u585i_iot02a/b_u585i_iot02a.dts index 33093d701b7..c2df9e5aa5a 100644 --- a/boards/st/b_u585i_iot02a/b_u585i_iot02a.dts +++ b/boards/st/b_u585i_iot02a/b_u585i_iot02a.dts @@ -6,6 +6,8 @@ /dts-v1/; #include "b_u585i_iot02a-common.dtsi" +#include +#include / { 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 { diff --git a/boards/st/b_u585i_iot02a/board.cmake b/boards/st/b_u585i_iot02a/board.cmake index 73320d749c6..8b9544b745b 100644 --- a/boards/st/b_u585i_iot02a/board.cmake +++ b/boards/st/b_u585i_iot02a/board.cmake @@ -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")