Commit 46cab056 authored by Yestin Sun's avatar Yestin Sun Committed by Ioannis Glaropoulos
Browse files

boards: stm32l562e_dk: Enable TF-M IPC application



This commit enables the TF-M IPC sample application on stm32l562e_dk
board.
It provides device tree flash partition as an overlay in order to
configure and flash the bl2, secure/non secure firmwares.

Signed-off-by: default avatarYestin Sun <sunyi0804@gmail.com>
parent fd4e5175
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@ config TFM_BOARD
	default "nxp/lpcxpresso55s69" if BOARD_LPCXPRESSO55S69_CPU0
	default "mps2/an521" if BOARD_MPS2_AN521
	default "stm/nucleo_l552ze_q" if BOARD_NUCLEO_L552ZE_Q
	default "stm/stm32l562e_dk" if BOARD_STM32L562E_DK
	default "musca_b1" if BOARD_MUSCA_B1
	default "musca_s1" if BOARD_MUSCA_S1
	help
+13 −8
Original line number Diff line number Diff line
@@ -103,33 +103,38 @@ Or, post build:

      $ ninja run

On ST Nucleo L552ZE Q:
======================
On ST Nucleo L552ZE Q or STM32L562E-DK Discovery:
=================================================

This sample was tested on Ubuntu 18.04 with Zephyr SDK 0.11.3.

Build Zephyr with a non-secure configuration:

   Example, for building non-secure configuration for Nucleo L552ZE Q

   .. code-block:: bash

      $ west build -b nucleo_l552ze_q_ns samples/tfm_integration/tfm_ipc/

Two scripts are avalaible in the ``build/tfm`` folder:
   Example, for building non-secure configuration for STM32L562E-DK Discovery

   .. code-block:: bash

      $ west build -b stm32l562e_dk_ns samples/tfm_integration/tfm_ipc/

The script to initialize the device is avalaible in the ``build/tfm`` folder:

  - ``regression.sh``: Sets platform option bytes config and erase platform.
  - ``TFM_UPDATE.sh``: Writes bl2, secure, and non secure image in target.

Run them in the following order to flash the board:

   .. code-block:: bash

      $ ./build/tfm/regression.sh
      $ ./build/tfm/TFM_UPDATE.sh

Reset the board.
      $ west flash --hex-file build/tfm_merged.hex

 .. 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`` and ``TFM_UPDATE.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` documentation.
      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.

On LPCxpresso55S69:
===================
+55 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2021 Yestin Sun
 *
 * SPDX-License-Identifier: Apache-2.0
 */

 /* This partition table should be used along with TFM configuration:
  * - TFM_PSA_API=ON (IPC)
  * - ISOLATION_LEVEL 2
  * - TEST_S=ON (REGRESSION)
  * - TEST_NS=OFF (By default)
  *
  * In this configuration, TFM binary includes tests. As a consequence,
  * its size is bloated and it is not possible to set secondary partitions
  * for secured or non secured images.
  */

/ {
	chosen {
		zephyr,code-partition = &slot1_partition;
	};
};

&flash0 {

	partitions {
		compatible = "fixed-partitions";
		#address-cells = <1>;
		#size-cells = <1>;

		boot_partition: partition@0 {
			label = "mcuboot";
			reg = <0x00000000 0x00013000>;
			read-only;
		};
		/* Secure image primary slot */
		slot0_partition: partition@00013000 {
			label = "image-0";
			reg = <0x00013000 0x00038000>;
		};
		/* Non-secure image primary slot */
		slot1_partition: partition@0004B000 {
			label = "image-1";
			reg = <0x0004B000 0x0002A000>;
		};
		/*
		 * The flash starting at 0x7F000 and ending at
		 * 0x80000 is reserved for the application.
		 */
		storage_partition: partition@7F000 {
			label = "storage";
			reg = <0x0007F000 0x00001000>;
		};
	};
};
+1 −1
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@ tests:
        tags: introduction tfm
        platform_allow: mps2_an521_nonsecure lpcxpresso55s69_ns
          nrf5340dk_nrf5340_cpuappns nrf9160dk_nrf9160ns nucleo_l552ze_q_ns
          v2m_musca_s1_nonsecure
          stm32l562e_dk_ns v2m_musca_s1_nonsecure
        harness: console
        harness_config:
          type: multi_line