Skip to content

Commit bdfca22

Browse files
committed
boards: st: nucleo_h7s3l8: Add ext_flash_app variant
Add ext_flash_app variant to nucleo_h7s3l8 to allow building applications running on ext flash. Based on Erwan Gouriou's work on stm32h7s78_dk in PR #97992 (which is based on A.Jarmouni's work on stm32h750_dk in PR 97037). Signed-off-by: Thomas Decker <[email protected]>
1 parent eb71640 commit bdfca22

9 files changed

+470
-246
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Copyright (c) 2024-2025 STMicroelectronics
2+
# Copyright (c) 2025 JB-Lighting Lichtanlagentechnik
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
if BOARD_NUCLEO_H7S3L8_STM32H7S3XX_EXT_FLASH_APP
6+
7+
choice BOOTLOADER
8+
default BOOTLOADER_MCUBOOT
9+
endchoice
10+
11+
choice BOOT_SIGNATURE_TYPE
12+
default BOOT_SIGNATURE_TYPE_NONE
13+
endchoice
14+
15+
choice MCUBOOT_MODE
16+
default MCUBOOT_MODE_SWAP_USING_OFFSET
17+
endchoice
18+
19+
endif # BOARD_NUCLEO_H7S3L8_STM32H7S3XX_EXT_FLASH_APP

boards/st/nucleo_h7s3l8/board.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# keep first
44
board_runner_args(stm32cubeprogrammer "--port=swd" "--reset-mode=hw")
5-
if(CONFIG_XIP AND (CONFIG_STM32_MEMMAP OR CONFIG_BOOTLOADER_MCUBOOT))
5+
if(CONFIG_STM32_MEMMAP OR CONFIG_BOOTLOADER_MCUBOOT)
66
board_runner_args(stm32cubeprogrammer "--extload=MX25UW25645G_NUCLEO-H7S3L8.stldr")
77
endif()
88
board_runner_args(openocd --target-handle=_CHIPNAME.cpu0)

boards/st/nucleo_h7s3l8/board.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ board:
44
vendor: st
55
socs:
66
- name: stm32h7s3xx
7+
variants:
8+
- name: ext_flash_app

boards/st/nucleo_h7s3l8/doc/index.rst

Lines changed: 114 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ the ``--runner`` (or ``-r``) option:
213213
.. code-block:: console
214214
215215
$ west flash --runner openocd
216+
$ west flash --runner jlink
216217
217218
Flashing an application to Nucleo H7S3L8
218219
----------------------------------------
@@ -255,7 +256,7 @@ Blinky example can also be used:
255256
:goals: build flash
256257

257258
Debugging
258-
=========
259+
---------
259260

260261
You can debug an application in the usual way. Here is an example for the
261262
:zephyr:code-sample:`hello_world` application.
@@ -266,6 +267,112 @@ You can debug an application in the usual way. Here is an example for the
266267
:maybe-skip-config:
267268
:goals: debug
268269

270+
Application in External Flash
271+
=============================
272+
273+
Because of the limited amount of SoC Flash (64KB), you may want to store the application
274+
in external OSPI Flash instead, and run it from there. In that case, the MCUboot bootloader
275+
is needed to chainload the application. A dedicate board variant, ``ext_flash_app``, was created
276+
for this usecase.
277+
278+
:ref:`sysbuild` makes it possible to build and flash all necessary images needed to run a user application
279+
from external Flash.
280+
281+
The following example shows how to build :zephyr:code-sample:`hello_world` with Sysbuild enabled:
282+
283+
.. zephyr-app-commands::
284+
:tool: west
285+
:zephyr-app: samples/hello_world
286+
:board: nucleo_h7s3l8/stm32h7s3xx/ext_flash_app
287+
:goals: build
288+
:west-args: --sysbuild
289+
290+
By default, Sysbuild creates MCUboot and user application images.
291+
292+
Build directory structure created by Sysbuild is different from traditional
293+
Zephyr build. Output is structured by the domain subdirectories:
294+
295+
.. code-block::
296+
297+
build/
298+
├── hello_world
299+
| └── zephyr
300+
│ ├── zephyr.elf
301+
│ ├── zephyr.hex
302+
│ ├── zephyr.bin
303+
│ ├── zephyr.signed.bin
304+
│ └── zephyr.signed.hex
305+
├── mcuboot
306+
│ └── zephyr
307+
│ ├── zephyr.elf
308+
│ ├── zephyr.hex
309+
│ └── zephyr.bin
310+
└── domains.yaml
311+
312+
.. note::
313+
314+
With ``--sysbuild`` option, MCUboot will be re-built every time the pristine build is used,
315+
but only needs to be flashed once if none of the MCUboot configs are changed.
316+
317+
For more information about the system build please read the :ref:`sysbuild` documentation.
318+
319+
Both MCUboot and user application images can be flashed by running:
320+
321+
.. code-block:: console
322+
323+
$ west flash
324+
325+
You should see the following message in the serial host program:
326+
327+
.. code-block:: console
328+
329+
*** Booting MCUboot v2.2.0-224-g0a52195c8181 ***
330+
*** Using Zephyr OS build v4.3.0-937-ge0490cf53e03 ***
331+
I: Starting bootloader
332+
I: Image index: 0, Swap type: none
333+
I: Image index: 0, Swap type: none
334+
I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
335+
I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
336+
I: Boot source: none
337+
I: Image index: 0, Swap type: none
338+
I: Image index: 0, Swap type: none
339+
I: Image index: 0, Swap type: none
340+
I: Image index: 0, Swap type: none
341+
I: Bootloader chainload address offset: 0x0
342+
I: Image version: v0.0.0
343+
I: Jumping to the first image slot
344+
*** Booting Zephyr OS build v4.3.0-937-ge0490cf53e03 ***
345+
Hello World! nucleo_h7s3l8/stm32h7s3xx/ext_flash_app
346+
347+
To only flash the user application in the subsequent builds, Use:
348+
349+
.. code-block:: console
350+
351+
$ west flash --domain hello_world
352+
353+
With the default configuration, the board uses MCUboot's Swap-using-offset mode.
354+
To get more information about the different MCUboot operating modes and how to
355+
perform application upgrade, refer to `MCUboot design`_.
356+
To learn more about how to secure the application images stored in external Flash,
357+
refer to `MCUboot Encryption`_.
358+
359+
Debugging
360+
---------
361+
362+
You can debug the application in external flash using ``west`` and ``GDB``.
363+
364+
After flashing MCUboot and the app, execute the following command:
365+
366+
.. code-block:: console
367+
368+
$ west debugserver
369+
370+
Then, open another terminal (don't forget to activate Zephyr's environment) and execute:
371+
372+
.. code-block:: console
373+
374+
$ west attach
375+
269376
.. _Nucleo H7S3L8 website:
270377
https://www.st.com/en/evaluation-tools/nucleo-h7s3l8.html
271378

@@ -289,3 +396,9 @@ You can debug an application in the usual way. Here is an example for the
289396

290397
.. _STM32CubeProgrammer:
291398
https://www.st.com/en/development-tools/stm32cubeprog.html
399+
400+
.. _MCUboot design:
401+
https://docs.mcuboot.com/design.html
402+
403+
.. _MCUboot Encryption:
404+
https://docs.mcuboot.com/encrypted_images.html

0 commit comments

Comments
 (0)