From b8b31f9a760235b96614ddfc1ec010fa0210b778 Mon Sep 17 00:00:00 2001 From: Andrei Gansari Date: Tue, 25 Aug 2020 19:37:42 +0300 Subject: [PATCH] samples: tfm_integration: lpc55s69 support Adds documentation on how to run TFM samples on LPCxpresso55S69 board. Signed-off-by: Andrei Gansari --- boards/arm/lpcxpresso55s69/doc/index.rst | 6 ++--- .../psa_level_1/CMakeLists.txt | 7 ------ .../tfm_integration/psa_level_1/README.rst | 25 +++++++++++++++++-- .../tfm_integration/psa_level_1/sample.yaml | 2 +- .../tfm_integration/tfm_ipc/CMakeLists.txt | 8 ------ samples/tfm_integration/tfm_ipc/README.rst | 21 ++++++++++++++++ samples/tfm_integration/tfm_ipc/sample.yaml | 2 +- 7 files changed, 49 insertions(+), 22 deletions(-) diff --git a/boards/arm/lpcxpresso55s69/doc/index.rst b/boards/arm/lpcxpresso55s69/doc/index.rst index bb7f7c52a30b94..b40c5231724591 100644 --- a/boards/arm/lpcxpresso55s69/doc/index.rst +++ b/boards/arm/lpcxpresso55s69/doc/index.rst @@ -196,10 +196,10 @@ see the following message in the terminal: Hello World! lpcxpresso55s69_cpu0 Building and flashing secure/non-secure with Arm |reg| TrustZone |reg| ---------------------------------------------------------------------- +---------------------------------------------------------------------- The TF-M integration samples can be run using the ``lpcxpresso55s69_ns`` target. -Next we need to manually flash the secure (`tfm_s.hex`) -and non-secure (`zephyr.hex`) images wth a J-Link as follows: +Next we need to manually flash the secure (``tfm_s.hex``) +and non-secure (``zephyr.hex``) images wth a J-Link as follows: .. code-block:: console diff --git a/samples/tfm_integration/psa_level_1/CMakeLists.txt b/samples/tfm_integration/psa_level_1/CMakeLists.txt index 9bd2b2e3faa408..9ea0d5403654b6 100644 --- a/samples/tfm_integration/psa_level_1/CMakeLists.txt +++ b/samples/tfm_integration/psa_level_1/CMakeLists.txt @@ -7,19 +7,12 @@ set(QEMU_KERNEL_OPTION "-device;loader,file=${CMAKE_BINARY_DIR}/tfm_qemu.hex") find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -set(BL2 $ENV{BL2}) -if(NOT DEFINED BL2) - #by default build with MCUboot - set(BL2 True) -endif() - # Add "tfm" as an external project via the TF-M module's cmake file trusted_firmware_build(BINARY_DIR ${CMAKE_BINARY_DIR}/tfm BOARD ${TFM_TARGET_PLATFORM} IPC CFGFILE "ConfigRegressionIPC" OUT_VENEERS_FILE VENEERS_FILE - BL2 ${BL2} ) project(tfm_psa_level_1) diff --git a/samples/tfm_integration/psa_level_1/README.rst b/samples/tfm_integration/psa_level_1/README.rst index 0778c713cdead3..ae7a3905857354 100644 --- a/samples/tfm_integration/psa_level_1/README.rst +++ b/samples/tfm_integration/psa_level_1/README.rst @@ -29,8 +29,7 @@ Building and Running ******************** This project outputs startup status and info to the console. It can be built and -executed on an MPS2+ configured for AN521 (dual-core ARM Cortex M33), or using -the ``mps2_an521_nonsecure`` target with QEMU. +executed on an ARM Cortex M33 target board or QEMU. This sample will only build on a Linux or macOS development system (not Windows), and has been tested on the following setups: @@ -126,6 +125,28 @@ and run it in qemu via the ``run`` command. cmake -DBOARD=mps2_an521_nonsecure .. make run +On LPCxpresso55S69: +====================== + +Build Zephyr with a non-secure configuration: + + .. code-block:: bash + + $ west build -p -b lpcxpresso55s69_ns samples/tfm_integration/psa_level_1/ -- + +Next we need to manually flash the secure (``tfm_s.hex``) +and non-secure (``zephyr.hex``) images wth a J-Link as follows: + + .. code-block:: console + + JLinkExe -device lpc55s69 -if swd -speed 2000 -autoconnect 1 + J-Link>loadfile build/tfm/install/outputs/LPC55S69/tfm_s.hex + J-Link>loadfile build/zephyr/zephyr.hex + +NOTE: At present, the LPC55S69 doesn't include support for the MCUBoot bootloader. + +We need to reset the board manually after flashing the image to run this code. + Sample Output ============= diff --git a/samples/tfm_integration/psa_level_1/sample.yaml b/samples/tfm_integration/psa_level_1/sample.yaml index 90904fee98d92a..58b48d7972d9ca 100644 --- a/samples/tfm_integration/psa_level_1/sample.yaml +++ b/samples/tfm_integration/psa_level_1/sample.yaml @@ -5,7 +5,7 @@ sample: tests: sample.tfm_ipc: tags: introduction - platform_allow: mps2_an521_nonsecure + platform_allow: mps2_an521_nonsecure lpcxpresso55s69_ns harness: console harness_config: type: multi_line diff --git a/samples/tfm_integration/tfm_ipc/CMakeLists.txt b/samples/tfm_integration/tfm_ipc/CMakeLists.txt index 9c2415fcc68002..fef5c90ebad819 100644 --- a/samples/tfm_integration/tfm_ipc/CMakeLists.txt +++ b/samples/tfm_integration/tfm_ipc/CMakeLists.txt @@ -7,12 +7,6 @@ set(QEMU_KERNEL_OPTION "-device;loader,file=${CMAKE_BINARY_DIR}/tfm_qemu.hex") find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -set(BL2 $ENV{BL2}) -if(NOT DEFINED BL2) - #by default build with MCUboot - set(BL2 True) -endif() - # Add "tfm" as an external project via the TF-M module's cmake file if(${TFM_TARGET_PLATFORM} STREQUAL "STM_NUCLEO_L552ZE_Q") trusted_firmware_build(BINARY_DIR ${CMAKE_BINARY_DIR}/tfm @@ -20,7 +14,6 @@ if(${TFM_TARGET_PLATFORM} STREQUAL "STM_NUCLEO_L552ZE_Q") IPC CFGFILE "ConfigRegressionIPCTfmLevel2" OUT_VENEERS_FILE VENEERS_FILE - BL2 ${BL2} ) else() trusted_firmware_build(BINARY_DIR ${CMAKE_BINARY_DIR}/tfm @@ -28,7 +21,6 @@ else() IPC CFGFILE "ConfigRegressionIPC" OUT_VENEERS_FILE VENEERS_FILE - BL2 ${BL2} ) endif() diff --git a/samples/tfm_integration/tfm_ipc/README.rst b/samples/tfm_integration/tfm_ipc/README.rst index 8fac56fb9d5ae7..910c390e05a484 100644 --- a/samples/tfm_integration/tfm_ipc/README.rst +++ b/samples/tfm_integration/tfm_ipc/README.rst @@ -131,6 +131,27 @@ Reset the board. .. 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. +On LPCxpresso55S69: +=================== + +Build Zephyr with a non-secure configuration: + + .. code-block:: bash + + $ west build -p -b lpcxpresso55s69_ns samples/tfm_integration/tfm_ipc/ -- + +Next we need to manually flash the secure (``tfm_s.hex``) +and non-secure (``zephyr.hex``) images wth a J-Link as follows: + + .. code-block:: console + + JLinkExe -device lpc55s69 -if swd -speed 2000 -autoconnect 1 + J-Link>loadfile build/tfm/install/outputs/LPC55S69/tfm_s.hex + J-Link>loadfile build/zephyr/zephyr.hex + +NOTE: At present, the LPC55S69 doesn't include support for the MCUBoot bootloader. + +We need to reset the board manually after flashing the image to run this code. Sample Output ============= diff --git a/samples/tfm_integration/tfm_ipc/sample.yaml b/samples/tfm_integration/tfm_ipc/sample.yaml index a072c88386875a..584dff2f4b66a4 100644 --- a/samples/tfm_integration/tfm_ipc/sample.yaml +++ b/samples/tfm_integration/tfm_ipc/sample.yaml @@ -5,7 +5,7 @@ sample: tests: sample.tfm_ipc: tags: introduction - platform_allow: mps2_an521_nonsecure + platform_allow: mps2_an521_nonsecure lpcxpresso55s69_ns harness: console harness_config: type: multi_line