From 410194808218093ddf9790198a80fcc6d8a81ccb Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Wed, 31 Jan 2024 11:15:08 +0100 Subject: [PATCH] samples: code relocation in external memory of stm32 disco kit Define the configuration to run the code_relocation application on the external memory octo flash of the stm32u585 or stm32h7b3i disco kit in XIP Signed-off-by: Francois Ramu --- .../code_relocation_nocopy/README.rst | 12 ++++++++++++ .../boards/b_u585i_iot02a.conf | 2 ++ .../code_relocation_nocopy/boards/stm32h7b3i_dk.conf | 2 ++ .../code_relocation_nocopy/linker_arm_nocopy.ld | 7 +++++++ .../code_relocation_nocopy/sample.yaml | 2 ++ 5 files changed, 25 insertions(+) create mode 100644 samples/application_development/code_relocation_nocopy/boards/b_u585i_iot02a.conf create mode 100644 samples/application_development/code_relocation_nocopy/boards/stm32h7b3i_dk.conf diff --git a/samples/application_development/code_relocation_nocopy/README.rst b/samples/application_development/code_relocation_nocopy/README.rst index 2e0f49f520f..9b7ca572a0f 100644 --- a/samples/application_development/code_relocation_nocopy/README.rst +++ b/samples/application_development/code_relocation_nocopy/README.rst @@ -39,6 +39,18 @@ to 0x90000000. :goals: build flash :compact: +STM32 b_u585i_iot02a Discovery kit instructions +*********************************************** + +The b_u585i_iot02a has 64MB of external flash attached via OSPI. It is mapped +to 0x70000000. + +.. zephyr-app-commands:: + :zephyr-app: samples/application_development/code_relocation_nocopy + :board: b_u585i_iot02a + :goals: build flash + :compact: + Execution output **************** diff --git a/samples/application_development/code_relocation_nocopy/boards/b_u585i_iot02a.conf b/samples/application_development/code_relocation_nocopy/boards/b_u585i_iot02a.conf new file mode 100644 index 00000000000..eac2504a785 --- /dev/null +++ b/samples/application_development/code_relocation_nocopy/boards/b_u585i_iot02a.conf @@ -0,0 +1,2 @@ +CONFIG_FLASH=y +CONFIG_STM32_MEMMAP=y diff --git a/samples/application_development/code_relocation_nocopy/boards/stm32h7b3i_dk.conf b/samples/application_development/code_relocation_nocopy/boards/stm32h7b3i_dk.conf new file mode 100644 index 00000000000..eac2504a785 --- /dev/null +++ b/samples/application_development/code_relocation_nocopy/boards/stm32h7b3i_dk.conf @@ -0,0 +1,2 @@ +CONFIG_FLASH=y +CONFIG_STM32_MEMMAP=y diff --git a/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld b/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld index 4bf540a7211..7d4e3a964fc 100644 --- a/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld +++ b/samples/application_development/code_relocation_nocopy/linker_arm_nocopy.ld @@ -26,6 +26,13 @@ #define EXTFLASH_SIZE DT_PROP_OR(EXTFLASH_NODE, size_in_bytes, \ DT_PROP(EXTFLASH_NODE, size) / 8) +#elif defined(CONFIG_STM32_MEMMAP) && DT_NODE_EXISTS(DT_INST(0, st_stm32_ospi_nor)) +/* On stm32 OSPI, external flash is mapped in XIP region at address given by the reg property. */ + +#define EXTFLASH_NODE DT_INST(0, st_stm32_ospi_nor) +#define EXTFLASH_ADDR DT_REG_ADDR(DT_INST(0, st_stm32_ospi_nor)) +#define EXTFLASH_SIZE DT_REG_ADDR_BY_IDX(DT_INST(0, st_stm32_ospi_nor), 1) + #elif defined(CONFIG_STM32_MEMMAP) && DT_NODE_EXISTS(DT_INST(0, st_stm32_qspi_nor)) /* On stm32 QSPI, external flash is mapped in XIP region at address given by the reg property. */ diff --git a/samples/application_development/code_relocation_nocopy/sample.yaml b/samples/application_development/code_relocation_nocopy/sample.yaml index a583ea3b44f..b653213fa4d 100644 --- a/samples/application_development/code_relocation_nocopy/sample.yaml +++ b/samples/application_development/code_relocation_nocopy/sample.yaml @@ -7,6 +7,8 @@ tests: - qemu_cortex_m3 - nrf5340dk/nrf5340/cpuapp - stm32f769i_disco + - stm32h7b3i_dk + - b_u585i_iot02a integration_platforms: - qemu_cortex_m3 tags: linker