boards/st/stm32h573i_dk/doc/index.rst
.. zephyr:board:: stm32h573i_dk
Overview
The STM32H573I-DK Discovery kit is designed as a complete demonstration and development platform for STMicroelectronics Arm® Cortex®-M33 core-based STM32H573IIK3Q microcontroller with TrustZone®. Here are some highlights of the STM32H573I-DK Discovery board:
STM32H573IIK3Q microcontroller featuring 2 Mbytes of Flash memory and 640 Kbytes of SRAM in 176-pin BGA package
1.54-inch 240x240 pixels TFT-LCD with LED backlight and touch panel
USB Type-C® Host and device with USB power-delivery controller
SAI Audio DAC stereo with one audio jacks for input/output,
ST MEMS digital microphone with PDM interface
Octo-SPI interface connected to 512Mbit Octo-SPI NORFlash memory device (MX25LM51245GXDI00 from MACRONIX)
10/100-Mbit Ethernet,
microSD™
A Wi‑Fi® add-on board
Board connectors
Flexible power-supply options
On-board STLINK-V3E debugger/programmer with USB re-enumeration capability:
4 user LEDs
User and reset push-buttons
More information about the board can be found at the STM32H573I-DK Discovery website_.
Hardware
The STM32H573xx devices are an high-performance microcontrollers family (STM32H5 Series) based on the high-performance Arm® Cortex®-M33 32-bit RISC core. They operate at a frequency of up to 250 MHz.
Core: ARM® 32-bit Cortex®-M33 CPU with TrustZone® and FPU.
Performance benchmark:
Security
Clock management:
Power management
RTC with HW calendar, alarms and calibration
Up to 139 fast I/Os, most 5 V-tolerant, up to 10 I/Os with independent supply down to 1.08 V
Up to 16 timers and 2 watchdogs
Memories
Rich analog peripherals (independent supply)
34x communication interfaces
CORDIC for trigonometric functions acceleration
FMAC (filter mathematical accelerator)
CRC calculation unit
Development support: serial wire debug (SWD), JTAG, Embedded Trace Macrocell™
More information about STM32H573 can be found here:
STM32H573 on www.st.com_STM32H573 reference manual_.. zephyr:board-supported-hw::
The STM32H573 is an SoC with Cortex-M33 architecture. Zephyr provides support for building for both Secure and Non-Secure firmware.
The BOARD options are summarized below:
+-----------------------------------------+------------------------------------------------------------------+ | BOARD | Description | +=========================================+==================================================================+ | stm32h573i_dk | For building firmware with TrustZone disabled for internal flash | +-----------------------------------------+------------------------------------------------------------------+ | stm32h573i_dk/stm32h573xx/ext_flash_app | For building firmware with TrustZone disabled for external flash | +-----------------------------------------+------------------------------------------------------------------+ | stm32h573i_dk/stm32h573xx/ns | For building Non-Secure firmware for internal flash | +-----------------------------------------+------------------------------------------------------------------+
Here are the instructions to build Zephyr with a non-secure configuration,
using :zephyr:code-sample:tfm_ipc sample:
.. zephyr-app-commands:: :zephyr-app: samples/tfm_integration/tfm_ipc :board: stm32h573i_dk/stm32h573xx/ns :goals: build
Once done, before flashing, you need to first run a generated script that will set platform Option Bytes config and erase platform (among others, Option Byte TZEN will be set).
.. code-block:: bash
$ ./build/tfm/api_ns/regression.sh
$ west flash
Please note that, after having run a TF-M sample on the board, you will need to
use STM32CubeProgrammer_ to return the board to a state with TrustZone disabled
and be able to run usual binaries without TrustZone and TF-M. For example,
when using a device in Open Product State, one can run again the generated
regression.sh script to disable write protections then disable TZEN
with STM32_Programmer_CLI tool:
.. code-block:: bash
$ ./build/tfm/api_ns/regression.sh
$ STM32_Programmer_CLI -c port=swd -ob TZEN=0xC3
STM32H573I-DK Discovery Board has 9 GPIO controllers. These controllers are responsible for pin muxing, input/output, pull-up, etc.
For more details please refer to STM32H573I-DK Discovery board User Manual_.
STM32H573I-DK System Clock could be driven by internal or external oscillator, as well as main PLL clock. By default System clock is driven by PLL clock at 240MHz, driven by 25MHz external oscillator (HSE).
STM32H573I-DK Discovery board has 3 U(S)ARTs. The Zephyr console output is assigned to USART1. Default settings are 115200 8N1.
The TFT LCD screen and touch panel are supported for the STM32H573I-DK Discovery board.
They can be tested using :zephyr:code-sample:lvgl sample:
.. zephyr-app-commands:: :zephyr-app: samples/subsys/display/lvgl :board: stm32h573i_dk :goals: build
Programming and Debugging
.. zephyr:board-supported-runners::
STM32H573I-DK Discovery board includes an ST-LINK/V3E embedded debug tool interface.
Applications for the stm32h573i_dk board configuration can be built and
flashed in the usual way (see :ref:build_an_application and
:ref:application_run for more details).
For now, OpenOCD support for STM32H5 is not available on upstream OpenOCD.
You can check OpenOCD official Github mirror.
In order to use it though, you should clone from the customized
STMicroelectronics OpenOCD Github and compile it following usual README guidelines.
Once it is done, you can set the OPENOCD and OPENOCD_DEFAULT_PATH variables in
:zephyr_file:boards/st/stm32h573i_dk/board.cmake to point the build
to the paths of the OpenOCD binary and its scripts, before
including the common openocd.board.cmake file:
.. code-block:: none
set(OPENOCD "<path_to_openocd_repo>/src/openocd" CACHE FILEPATH "" FORCE)
set(OPENOCD_DEFAULT_PATH <path_to_opneocd_repo>/tcl)
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
The board is configured to be flashed using west STM32CubeProgrammer_ runner,
so its :ref:installation <stm32cubeprog-flash-host-tools> is required.
Alternatively, OpenOCD or pyOCD can also be used to flash the board using
the --runner (or -r) option:
.. code-block:: console
$ west flash --runner openocd $ west flash --runner pyocd
For pyOCD, additional target information needs to be installed by executing the following commands:
.. code-block:: console
$ pyocd pack --update $ pyocd pack --install stm32h5
Connect the STM32H573I-DK Discovery to your host computer using the USB port.
Then build and flash an application. Here is an example for the
:zephyr:code-sample:hello_world application.
Run a serial host program to connect with your Nucleo board:
.. code-block:: console
$ minicom -D /dev/ttyACM0
Then build and flash the application.
.. zephyr-app-commands:: :zephyr-app: samples/hello_world :board: stm32h573i_dk :goals: build flash
You should see the following message on the console:
.. code-block:: console
Hello World! stm32h573i_dk
Waiting for OpenOCD support, debugging could be performed with pyOCD which requires to enable "pack" support with the following pyOCD command:
.. code-block:: console
$ pyocd pack --update $ pyocd pack --install stm32h5
Once installed, you can debug an application in the usual way. Here is an
example for the :zephyr:code-sample:hello_world application.
.. zephyr-app-commands:: :zephyr-app: samples/hello_world :board: stm32h573i_dk :maybe-skip-config: :goals: debug
Since an external NOR is available on the board, you may want to use it to store
a large user application, and run it from there. In that case, the MCUboot bootloader
is needed to chainload the application. A dedicated board variant, ext_flash_app, was created
for this usecase.
:ref:sysbuild makes it possible to build and flash all necessary images needed to run a user application
from external Flash.
The following example shows how to build :zephyr:code-sample:hello_world with Sysbuild enabled:
.. zephyr-app-commands:: :tool: west :zephyr-app: samples/hello_world :board: stm32h573i_dk/stm32h573xx/ext_flash_app :goals: build :west-args: --sysbuild
By default, Sysbuild creates MCUboot and user application images.
For more information, refer to the :ref:sysbuild documentation.
Both MCUboot and user application images can be flashed by running:
.. code-block:: console
west flash
You should see the following message in the serial host program:
.. code-block:: console
*** Booting MCUboot v2.2.0-192-g96576b341ee1 *** *** Using Zephyr OS build v4.3.0-rc2-37-g6cc7bdb58a92 *** I: Starting bootloader I: Image index: 0, Swap type: none I: Image index: 0, Swap type: none I: Primary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Secondary image: magic=unset, swap_type=0x1, copy_done=0x3, image_ok=0x3 I: Boot source: none I: Image index: 0, Swap type: none I: Image index: 0, Swap type: none I: Image index: 0, Swap type: none I: Image index: 0, Swap type: none I: Bootloader chainload address offset: 0x0 I: Image version: v0.0.0 I: Jumping to the first image slot *** Booting Zephyr OS build v4.3.0-rc2-37-g6cc7bdb58a92 *** Hello World! stm32h573i_dk/stm32h573xx/ext_flash_app
To only flash the user application in the subsequent builds, Use:
.. code-block:: console
west flash --domain hello_world
With the default configuration, the board uses MCUboot's Swap-using-offset mode.
To get more information about the different MCUboot operating modes and how to
perform application upgrade, refer to MCUboot design.
To learn more about how to secure the application images stored in external Flash,
refer to MCUboot Encryption.
You can debug the application in external flash using west and GDB.
After flashing MCUboot and the app, execute the following command:
.. code-block:: console
west debugserver
Then, open another terminal (don't forget to activate Zephyr's environment) and execute:
.. code-block:: console
west attach
By default, user application symbols are loaded. To debug MCUboot application, launch:
.. code-block:: console
west attach --domain mcuboot
.. _STM32H573I-DK Discovery website: https://www.st.com/en/evaluation-tools/stm32h573i-dk.html
.. _STM32H573I-DK Discovery board User Manual: https://www.st.com/resource/en/user_manual/um3143-discovery-kit-with-stm32h573ii-mcu-stmicroelectronics.pdf
.. _STM32H573 on www.st.com: https://www.st.com/en/microcontrollers/stm32h573ii.html
.. _STM32H573 reference manual: https://www.st.com/resource/en/reference_manual/rm0481-stm32h563h573-and-stm32h562-armbased-32bit-mcus-stmicroelectronics.pdf
.. _STM32CubeProgrammer: https://www.st.com/en/development-tools/stm32cubeprog.html
.. _OpenOCD official Github mirror: https://github.com/openocd-org/openocd/
.. _STMicroelectronics OpenOCD Github: https://github.com/STMicroelectronics/OpenOCD/tree/openocd-cubeide-r6
.. _MCUboot design: https://docs.mcuboot.com/design.html
.. _MCUboot Encryption: https://docs.mcuboot.com/encrypted_images.html