@@ -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
257258Debugging
258- =========
259+ ---------
259260
260261You 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