boards: stm32l5: Update TFM related flashing instructions

Following the work done to add TFM support on b_u585i_iot02a,
update other STM32 TFM enabled boards to benefit from the
progress made on TFM flashing instructions.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
This commit is contained in:
Erwan Gouriou 2022-01-13 14:58:20 +01:00 committed by Anas Nashif
commit 322175e4fc
7 changed files with 93 additions and 1 deletions

View file

@ -1,5 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Define the toolchain to be used (by eg CI)
if(${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "zephyr")
set(COMPILER_FULL_PATH ${ZEPHYR_SDK_INSTALL_DIR}/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc)
elseif(${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "gnuarmemb")

View file

@ -1,6 +1,10 @@
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_BUILD_WITH_TFM)
set(FLASH_BASE_ADDRESS_S 0x0C000000)
# Flash merged TF-M + Zephyr binary
set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CMAKE_BINARY_DIR}/tfm_merged.hex")
if (CONFIG_HAS_FLASH_LOAD_OFFSET)
MATH(EXPR TFM_HEX_BASE_ADDRESS_NS "${FLASH_BASE_ADDRESS_S}+${CONFIG_FLASH_LOAD_OFFSET}")
else()

View file

@ -180,6 +180,44 @@ The default configuration can be found in the defconfig and dts files:
- :zephyr_file:`boards/arm/nucleo_l552ze_q/nucleo_l552ze_q_ns_defconfig`
- :zephyr_file:`boards/arm/nucleo_l552ze_q/nucleo_l552ze_q_ns.dts`
Zephyr board options
====================
The STM32L552e 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 |
+======================+===============================================+
| nucleo_l552ze_q | For building Secure (or Secure-only) firmware |
+----------------------+-----------------------------------------------+
| nucleo_l552ze_q_ns | For building Non-Secure firmware |
+----------------------+-----------------------------------------------+
Here are the instructions to build Zephyr with a non-secure configuration,
using `tfm_ipc_` sample:
.. code-block:: bash
$ west build -b nucleo_l552ze_q_ns samples/tfm_integration/tfm_ipc/
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 bit TZEN will be set).
.. code-block:: bash
$ ./build/tfm/regression.sh
$ west flash
Please note that, after having run a TFM sample on the board, you will need to
run `./build/tfm/regression.sh` once more to clean up the board from secure
options and get back the platform back to a "normal" state and be able to run
usual, non-TFM, binaries.
Also note that, even then, TZEN will remain set, and you will need to use
STM32CubeProgrammer_ to disable it fully, if required.
Connections and IOs
===================
@ -346,3 +384,6 @@ You can debug an application in the usual way. Here is an example for the
.. _STM32L552 reference manual:
http://www.st.com/resource/en/reference_manual/DM00346336.pdf
.. _STM32CubeProgrammer:
https://www.st.com/en/development-tools/stm32cubeprog.html

View file

@ -1,5 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Define the toolchain to be used (by eg CI)
if(${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "zephyr")
set(COMPILER_FULL_PATH ${ZEPHYR_SDK_INSTALL_DIR}/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc)
elseif(${ZEPHYR_TOOLCHAIN_VARIANT} STREQUAL "gnuarmemb")

View file

@ -1,6 +1,10 @@
# SPDX-License-Identifier: Apache-2.0
if(CONFIG_BUILD_WITH_TFM)
set(TFM_FLASH_BASE_ADDRESS 0x0C000000)
# Flash merged TF-M + Zephyr binary
set_property(TARGET runners_yaml_props_target PROPERTY hex_file "${CMAKE_BINARY_DIR}/tfm_merged.hex")
if (CONFIG_HAS_FLASH_LOAD_OFFSET)
MATH(EXPR TFM_HEX_BASE_ADDRESS_NS "${TFM_FLASH_BASE_ADDRESS}+${CONFIG_FLASH_LOAD_OFFSET}")
else()

View file

@ -206,6 +206,44 @@ The default configuration can be found in the defconfig and dts files:
- :zephyr_file:`boards/arm/stm32l562e_dk/stm32l562e_dk_ns_defconfig`
- :zephyr_file:`boards/arm/stm32l562e_dk/stm32l562e_dk_ns.dts`
Zephyr board options
====================
The STM32L562e 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 |
+======================+===============================================+
| stm32l562e_dk | For building Secure (or Secure-only) firmware |
+----------------------+-----------------------------------------------+
| stm32l562e_dk_ns | For building Non-Secure firmware |
+----------------------+-----------------------------------------------+
Here are the instructions to build Zephyr with a non-secure configuration,
using `tfm_ipc_` sample:
.. code-block:: bash
$ west build -b stm32l562e_dk_ns samples/tfm_integration/tfm_ipc/
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 bit TZEN will be set).
.. code-block:: bash
$ ./build/tfm/regression.sh
$ west flash
Please note that, after having run a TFM sample on the board, you will need to
run `./build/tfm/regression.sh` once more to clean up the board from secure
options and get back the platform back to a "normal" state and be able to run
usual, non-TFM, binaries.
Also note that, even then, TZEN will remain set, and you will need to use
STM32CubeProgrammer_ to disable it fully, if required.
Connections and IOs
===================
@ -344,3 +382,6 @@ You can debug an application in the usual way. Here is an example for the
.. _STM32L562 reference manual:
http://www.st.com/resource/en/reference_manual/DM00346336.pdf
.. _STM32CubeProgrammer:
https://www.st.com/en/development-tools/stm32cubeprog.html

View file

@ -135,7 +135,7 @@ Run them in the following order to flash the board:
.. code-block:: bash
$ ./build/tfm/regression.sh
$ west flash --hex-file build/tfm_merged.hex
$ west flash
.. note::
Note that ``arm-none-eabi-gcc`` should be available in the PATH variable and that ``STM32_Programmer_CLI`` is required to run ``regression.sh`` (see https://www.st.com/en/development-tools/stm32cubeprog.html). If you are still having trouble running these scripts, check the Programming and Debugging section of the :ref:`nucleo_l552ze_q_board` or :ref:`stm32l562e_dk_board` documentation.