@@ -244,8 +244,8 @@ by executing the following commands:
244244 $ pyocd pack --update
245245 $ pyocd pack --install stm32h5
246246
247- Flashing an application to STM32H573I-DK Discovery
248- --------------------------------------------------
247+ Application in SoC Flash
248+ ========================
249249
250250Connect the STM32H573I-DK Discovery to your host computer using the USB port.
251251Then build and flash an application. Here is an example for the
@@ -271,7 +271,7 @@ You should see the following message on the console:
271271 Hello World! stm32h573i_dk
272272
273273 Debugging
274- =========
274+ ---------
275275
276276Waiting for OpenOCD support, debugging could be performed with pyOCD which
277277requires to enable "pack" support with the following pyOCD command:
@@ -290,6 +290,97 @@ example for the :zephyr:code-sample:`hello_world` application.
290290 :maybe-skip-config:
291291 :goals: debug
292292
293+ Application in External Flash
294+ =============================
295+
296+ Since an external NOR is available on the board, you may want to use it to store
297+ a large user application, and run it from there. In that case, the MCUboot bootloader
298+ is needed to chainload the application. A dedicated board variant, ``ext_flash_app ``, was created
299+ for this usecase.
300+
301+ :ref: `sysbuild ` makes it possible to build and flash all necessary images needed to run a user application
302+ from external Flash.
303+
304+ The following example shows how to build :zephyr:code-sample: `hello_world ` with Sysbuild enabled:
305+
306+ .. zephyr-app-commands ::
307+ :tool: west
308+ :zephyr-app: samples/hello_world
309+ :board: stm32h573i_dk/stm32h573xx/ext_flash_app
310+ :goals: build
311+ :west-args: --sysbuild
312+
313+ By default, Sysbuild creates MCUboot and user application images.
314+
315+ For more information, refer to the :ref: `sysbuild ` documentation.
316+
317+ Flashing
318+ --------
319+
320+ Both MCUboot and user application images can be flashed by running:
321+
322+ .. code-block :: console
323+
324+ west flash
325+
326+ You should see the following message in the serial host program:
327+
328+ .. code-block :: console
329+
330+ *** Booting MCUboot v2.2.0-192-g96576b341ee1 ***
331+ *** Using Zephyr OS build v4.3.0-rc2-37-g6cc7bdb58a92 ***
332+ I: Starting bootloader
333+ I: Image index: 0, Swap type: none
334+ I: Image index: 0, Swap type: none
335+ I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
336+ I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3
337+ I: Boot source: 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: Image index: 0, Swap type: none
342+ I: Bootloader chainload address offset: 0x0
343+ I: Image version: v0.0.0
344+ I: Jumping to the first image slot
345+ *** Booting Zephyr OS build v4.3.0-rc2-37-g6cc7bdb58a92 ***
346+ Hello World! stm32h573i_dk/stm32h573xx/ext_flash_app
347+
348+ To only flash the user application in the subsequent builds, Use:
349+
350+ .. code-block :: console
351+
352+ west flash --domain hello_world
353+
354+ With the default configuration, the board uses MCUboot's Swap-using-offset mode.
355+ To get more information about the different MCUboot operating modes and how to
356+ perform application upgrade, refer to `MCUboot design `_.
357+ To learn more about how to secure the application images stored in external Flash,
358+ refer to `MCUboot Encryption `_.
359+
360+ Debugging
361+ ---------
362+
363+ You can debug the application in external flash using ``west `` and ``GDB ``.
364+
365+ After flashing MCUboot and the app, execute the following command:
366+
367+ .. code-block :: console
368+
369+ west debugserver
370+
371+ Then, open another terminal (don't forget to activate Zephyr's environment) and execute:
372+
373+ .. code-block :: console
374+
375+ west attach
376+
377+ By default, user application symbols are loaded. To debug MCUboot application,
378+ launch:
379+
380+ .. code-block :: console
381+
382+ west attach --domain mcuboot
383+
293384 .. _STM32H573I-DK Discovery website :
294385 https://www.st.com/en/evaluation-tools/stm32h573i-dk.html
295386
@@ -310,3 +401,9 @@ example for the :zephyr:code-sample:`hello_world` application.
310401
311402.. _STMicroelectronics OpenOCD Github :
312403 https://github.com/STMicroelectronics/OpenOCD/tree/openocd-cubeide-r6
404+
405+ .. _MCUboot design :
406+ https://docs.mcuboot.com/design.html
407+
408+ .. _MCUboot Encryption :
409+ https://docs.mcuboot.com/encrypted_images.html
0 commit comments