Skip to content

stm32h7rs run application in external flash memory XIP #88052

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 5 additions & 0 deletions boards/st/nucleo_h7s3l8/board.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# SPDX-License-Identifier: Apache-2.0

# keep first
if(CONFIG_STM32_MEMMAP OR (CONFIG_XIP AND CONFIG_BOOTLOADER_MCUBOOT))
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
board_runner_args(stm32cubeprogrammer "--extload=MX25UW25645G_NUCLEO-H7S3L8.stldr")
else()
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw" )
endif()

board_runner_args(openocd --target-handle=_CHIPNAME.cpu0)

Expand Down
10 changes: 10 additions & 0 deletions boards/st/nucleo_h7s3l8/nucleo_h7s3l8.dts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@
led2 = &red_led;
sw0 = &user_button;
watchdog0 = &iwdg;
spi-flash0 = &mx25uw25645;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot seem to find where this alias is used in-tree.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the https://github.com/mcu-tools/mcuboot/blob/main/boot/zephyr/flash_map_extended.c, the FLASH_DEVICE_ID is defined as SPI_FLASH_0_ID

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, then it should probably be documented @nordicjm

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not, it is like that for specific platforms that the owners have added

};

ext_memory: 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) )>;
};
};

Expand Down Expand Up @@ -189,6 +198,7 @@
ospi-max-frequency = <DT_FREQ_M(50)>;
spi-bus-width = <XSPI_OCTO_MODE>;
data-rate = <XSPI_DTR_TRANSFER>;
four-byte-opcodes;
status = "okay";

partitions {
Expand Down
6 changes: 6 additions & 0 deletions boards/st/stm32h7s78_dk/board.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# SPDX-License-Identifier: Apache-2.0

# keep first
if(CONFIG_STM32_MEMMAP OR (CONFIG_XIP AND CONFIG_BOOTLOADER_MCUBOOT))
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
board_runner_args(stm32cubeprogrammer "--extload=MX66UW1G45G_STM32H7S78-DK.stldr")
else()
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw" )
endif()

board_runner_args(openocd --target-handle=_CHIPNAME.cpu0)

# keep first
Expand Down
10 changes: 10 additions & 0 deletions boards/st/stm32h7s78_dk/stm32h7s78_dk.dts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@
die-temp0 = &die_temp;
volt-sensor0 = &vref;
volt-sensor1 = &vbat;
spi-flash0 = &mx66uw1g45;
};

ext_memory: 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) )>;
};
};

Expand Down Expand Up @@ -244,6 +253,7 @@
ospi-max-frequency = <DT_FREQ_M(50)>;
spi-bus-width = <XSPI_OCTO_MODE>;
data-rate = <XSPI_DTR_TRANSFER>;
four-byte-opcodes;
status = "okay";

partitions {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_FLASH=y
CONFIG_STM32_MEMMAP=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CONFIG_FLASH=y
CONFIG_STM32_MEMMAP=y
17 changes: 17 additions & 0 deletions samples/sysbuild/with_mcuboot/boards/nucleo_h7s3l8.overlay
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 = &mx25uw25645;
zephyr,flash-controller = &mx25uw25645;
zephyr,code-partition = &slot0_partition;
};
};
17 changes: 17 additions & 0 deletions samples/sysbuild/with_mcuboot/boards/stm32h7s78_dk.overlay
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 = &mx66uw1g45;
zephyr,flash-controller = &mx66uw1g45;
zephyr,code-partition = &slot0_partition;
};
};
2 changes: 2 additions & 0 deletions samples/sysbuild/with_mcuboot/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ tests:
- esp32s3_devkitm/esp32s3/procpu
- esp32c3_devkitm
- esp32c6_devkitc/esp32c6/hpcore
- nucleo_h7s3l8
- stm32h7s78_dk
integration_platforms:
- nrf52840dk/nrf52840
- esp32_devkitc/esp32/procpu
Expand Down
Loading