aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorMartinaHanusovaNXP <martina.hanusova@nxp.com>2021-04-22 10:16:47 +0200
committerAnton Komlev <Anton.Komlev@arm.com>2021-04-22 15:47:59 +0200
commit11644b6cc83ab34e1c59aaebb18cd818814f502b (patch)
treecc082b03316981284da94f0ce1df71c4b704cd71 /platform
parent783a59bc7b1a2e7806b96f892a0cdc8b2a45db16 (diff)
downloadtrusted-firmware-m-11644b6cc83ab34e1c59aaebb18cd818814f502b.tar.gz
Platform: Updated README and scripts for LPCxpresso55s69
Updated README file for LPCxpresso55s69 platform and added new Python scripts for building and flashing. Signed-off-by: MartinaHanusovaNXP <martina.hanusova@nxp.com> Change-Id: Iecc5ed948f2099b821504dfbff748f213862e9ff
Diffstat (limited to 'platform')
-rw-r--r--platform/ext/target/nxp/lpcxpresso55s69/README.rst226
-rw-r--r--platform/ext/target/nxp/lpcxpresso55s69/scripts/build.sh19
-rw-r--r--platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_demo.py24
-rw-r--r--platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_demo_bl2.py24
-rw-r--r--platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_regression.py24
-rw-r--r--platform/ext/target/nxp/lpcxpresso55s69/scripts/flash.py34
-rw-r--r--platform/ext/target/nxp/lpcxpresso55s69/scripts/flash.sh21
-rw-r--r--platform/ext/target/nxp/lpcxpresso55s69/scripts/flash_bl2.py33
8 files changed, 265 insertions, 140 deletions
diff --git a/platform/ext/target/nxp/lpcxpresso55s69/README.rst b/platform/ext/target/nxp/lpcxpresso55s69/README.rst
index b501997cc..108209457 100644
--- a/platform/ext/target/nxp/lpcxpresso55s69/README.rst
+++ b/platform/ext/target/nxp/lpcxpresso55s69/README.rst
@@ -1,105 +1,142 @@
+###############
LPCXpresso55S69
-===============
+###############
-Building TF-M
--------------
+****************
+1. Building TF-M
+****************
-To build a S and NS application along with a BL2 (bootloader) image for the
-LPCXpresso55S69 run the following commands:
+There are two options for TF-M build - with or without secondary bootloader (BL2).
+
+1.1 Building TF-M demo without BL2
+==================================
+To build a S and NS application image for the LPCXpresso55S69 run the ``build_tfm_demo.py`` script in ``platform/ext/target/nxp/lpcxpresso55s69/scripts``
+
+Or do it manually using following commands:
.. code:: bash
- $ mkdir build && cd build
- $ cmake -DTFM_PLATFORM=nxp/lpcxpresso55s69 \
- -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake \
- -DCMAKE_BUILD_TYPE=Relwithdebinfo ../
- $ make install
+ $ cmake -S . -B build -DTFM_PLATFORM=nxp/lpcxpresso55s69 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DCMAKE_BUILD_TYPE=Relwithdebinfo -DBL2=OFF -DTFM_PSA_API=ON -DTFM_ISOLATION_LEVEL=2 -G"Unix Makefiles"
+ $ cd build && make install
-.. Note::
+1.2 Building TF-M demo with BL2
+===============================
- Currently ``Debug`` cannot be selected as build type and regression tests
- cannot be run on the board without modifying the flash layout due to the
- amount of available on-chip flash memory.
- To run the S and NS regression tests (``TEST_S=ON`` and ``TEST_NS=ON``) the
- secondary image areas must be set to 0 (firmware updates are not possible)
- and in parallel the size of the primary regions must be increased in the
- ``platform\ext\target\nxp\lpcxpresso55s69\partition\flash_layout.h`` file
- in order for the S and NS images to fit in the flash.
+To build a S and NS application along with a BL2 (bootloader) image for the
+LPCXpresso55S69 run the ``build_tfm_demo_bl2.py`` script in ``platform/ext/target/nxp/lpcxpresso55s69/scripts``
+
+Or do it manually using following commands:
+
+.. code:: bash
+
+ $ cmake -S . -B build -DTFM_PLATFORM=nxp/lpcxpresso55s69 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DCMAKE_BUILD_TYPE=Relwithdebinfo -DTFM_PSA_API=ON -DTFM_ISOLATION_LEVEL=2 -G"Unix Makefiles"
+ $ cd build && make install
-Building TF-M without BL2
--------------------------
+1.3 Building TF-M regression tests
+==================================
-To build a S and NS application image for the LPCXpresso55S69 run the
-following commands:
+To run the S and NS regression tests (``TEST_S=ON`` and ``TEST_NS=ON``) the
+secondary image areas must be set to 0 (firmware updates are not possible).
+Use the ``build_tfm_regression.py`` script in ``platform/ext/target/nxp/lpcxpresso55s69/scripts``
+or do it manually using following commands:
.. code:: bash
+
+ $ cmake -S . -B build -DTFM_PLATFORM=nxp/lpcxpresso55s69 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DCMAKE_BUILD_TYPE=Relwithdebinfo -DBL2=OFF -DTEST_S=ON -DTEST_NS=ON -DTFM_PSA_API=ON -DTFM_ISOLATION_LEVEL=2 -G"Unix Makefiles"
+ $ cd build && make install
+
+.. Note::
- $ mkdir build && cd build
- $ cmake -DTFM_PLATFORM=nxp/lpcxpresso55s69 \
- -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake \
- -DBL2=OFF \
- ../
- $ make install
+ Currently ``Debug`` cannot be selected as build type and regression tests
+ cannot be run on the board without modifying the flash layout due to the
+ amount of available on-chip flash memory.
-Flashing and debugging with Segger J-Link
------------------------------------------
+******************************
+2. Flashing with Segger J-Link
+******************************
-The LPCXpresso55S69 ships, by default, with DAPLink firmware, which may
-not work reliably on Rev A2 hardware outside of the MCUXpresso or other
-IDEs.
+The LPCXpresso55S69 ships, by default, uses DAPLink firmware.
+For command line flashing it is recommended to use external Segger J-Link flasher or to
+update the LPC-Link 2 debugger on the development board with the firmware provided by Segger,
+which makes the device behave as if there is an on-board J-Link debugger.
-It is highly recommended to update the LPC-Link 2 debugger on the
-development board with the firmware provided by Segger, which makes the
-device behave as if there is an on-board J-Link debugger.
+For onboard J-Link debugger option please follow this step:
-Update the LPC-Link 2 to Segger J-Link
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+2.1 Update the LPC-Link 2 to Segger J-Link
+==========================================
- Install a recent version of the `J-Link Software and Documentation
Pack <https://www.segger.com/downloads/jlink#J-LinkSoftwareAndDocumentationPack>`__.
- Version **6.56d** was used with this guide.
-
- **Warning**: The **6.60x** J-Link software package seems to have
- problems connecting to the J-Link device, and hangs with
- ``Connecting to J-Link via USB...``. **6.56d** is recommended
- until this issue is resolved.
+ Version **6.98b** was used with this guide.
- Update the on-board LPC-Link 2 to use the latest J-Link firmware,
following the instructions from Segger: `Getting Started with
- LPC-Link
- 2 <https://www.segger.com/products/debug-probes/j-link/models/other-j-links/lpc-link-2/>`__.
+ LPC-Link2 <https://www.segger.com/products/debug-probes/j-link/models/other-j-links/lpc-link-2/>`__.
+- Link the DFU jumper (J4) and make power cycle
+- Flash the **NXP LPCXpresso On-Board** firmware image with ``lpcscrypt`` from the ``lpcscrypt_2.1.2_57/scripts`` folder as follows:
-You can flash the **NXP LPCXpresso On-Board** firmware image with
-``lpcscrypt`` from the ``lpcscrypt_2.1.0_842/scripts`` folder as
-follows:
+**Windows:**
+::
-.. code:: bash
+ $ program_JLINK ../probe_firmware/LPCXpressoV2/Firmware_JLink_LPCXpressoV2_20190404.bin
+
+**Linux:**
+::
$ ./program_JLINK ../probe_firmware/LPCXpressoV2/Firmware_JLink_LPCXpressoV2_20190404.bin
-Flash images with ``JLinkExe``
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+Then remove link on the DFU jumper and power cycle.
+
+2.2 Flash images with ``JLinkCommander``
+========================================
+
+To flash TF-M images you can use the flash scripts provided in ``platform/ext/target/nxp/lpcxpresso55s69/scripts`` folder:
+ - ``flash.py`` - for uploading image without BL2
+ - ``flash_bl2.py`` - for uploading image with BL 2
+
+Or you can do it manually according the following steps:
-Connect to the board using ``JLinkExe``:
+2.2.1 Connect to the board using ``JLinkCommander``
+---------------------------------------------------
+**Windows:**
::
- $ JLinkExe -device lpc55s69 -if swd -speed 2000 -autoconnect 1
+ $ JLink -device lpc55s69 -if swd -speed 2000 -autoconnect 1
+
+ SEGGER J-Link Commander V6.98b (Compiled Mar 12 2021 15:03:29)
+ DLL version V6.98b, compiled Mar 12 2021 15:02:22
+
+ Connecting to J-Link via USB...O.K.
+ Firmware: J-Link LPCXpresso V2 compiled Apr 4 2019 16:54:03
+ Hardware version: V1.00
+ S/N: 729458359
+ VTref=3.300V
+ Device "LPC55S69_M33_0" selected.
+ ...
+ Cortex-M33 identified.
+
+**Linux:**
+::
+
+ $ JLinkExe -device lpc55s69 -if swd -speed 2000 -autoconnect 1
- SEGGER J-Link Commander V6.56d (Compiled Dec 12 2019 13:03:13)
- DLL version V6.56d, compiled Dec 12 2019 13:03:00
+ SEGGER J-Link Commander V6.98b (Compiled Mar 12 2021 15:03:29)
+ DLL version V6.98b, compiled Mar 12 2021 15:02:22
- Connecting to J-Link via USB...O.K.
- Firmware: J-Link LPCXpresso V2 compiled Apr 4 2019 16:54:03
- Hardware version: V1.00
- S/N: 723153991
- VTref=3.300V
- Device "LPC55S69" selected.
- ...
- Cortex-M33 identified.
+ Connecting to J-Link via USB...O.K.
+ Firmware: J-Link LPCXpresso V2 compiled Apr 4 2019 16:54:03
+ Hardware version: V1.00
+ S/N: 729458359
+ VTref=3.300V
+ Device "LPC55S69_M33_0" selected.
+ ...
+ Cortex-M33 identified.
-Flash the BL2, secure and non-secure images:
+2.2.2 Flash the builded images
+------------------------------
+If you builded TF-M with the BL2 secondary bootloader use following commands:
::
J-Link> loadfile bin/bl2.hex
@@ -108,40 +145,28 @@ Flash the BL2, secure and non-secure images:
When BL2 is disabled, generate Intel hex files from the output axf (elf)
files and then flash the secure and non-secure images:
-
::
- $ arm-none-eabi-objcopy -S --gap-fill 0xff -O ihex bin/tfm_s.axf tfm_s.hex
- $ arm-none-eabi-objcopy -S --gap-fill 0xff -O ihex bin/tfm_ns.axf tfm_ns.hex
- $ JLinkExe -device lpc55s69 -if swd -speed 2000 -autoconnect 1
- ....
- J-Link> loadfile tfm_s.hex
- J-Link> loadfile tfm_ns.hex
-
- **Note**: At present, the ``r`` (reset) command doesn't seem to
- respond, so you can reset the device to start firmware execution via
- the physical reset button.
-
-Complete ``JLinkExe`` Build/Flash Bash Scripts
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ $ arm-none-eabi-objcopy -S -O ihex bin/tfm_s.axf tfm_s.hex
+ $ arm-none-eabi-objcopy -S -O ihex bin/tfm_ns.axf tfm_ns.hex
+::
-The bash scripts in the ``platform/ext/target/nxp/lpcxpresso55s69/scripts``
-folder can be saved in the ``build`` folder to rebuild and flash the BL2,
-the TF-M S and NS binaries in one step.
+ J-Link> loadfile tfm_s.hex
+ J-Link> loadfile tfm_ns.hex
-The scripts assumes they are being run inside the ``build`` folder, which
-you have previously created at ``trusted-firmware-m/build``. The build
-script must be run in an empty ``build`` folder for the first time.
+************
+3. Debugging
+************
-Debugging with Segger Ozone
----------------------------
+3.1 Debugging with Segger Ozone
+===============================
If you have a commercially licensed Segger J-Link, or if you meet the
license terms for it's use, `Segger's cross-platform Ozone
tool <https://www.segger.com/products/development-tools/ozone-j-link-debugger/>`__
can be used to debug TF-M firmware images.
-To debug, flash the BL2, S and NS firmware images using the ``flash.sh``
+To debug, flash the BL2, S and NS firmware images using the ``flash.py``
script or command-line options described earlier in this guide, and
configure a new project on Ozone as follows:
@@ -161,8 +186,8 @@ in ``startup_LPC55S69_cm33_core0.s`` at the start of the
``Reset_Handler``, or near a line like ``bl SystemInit``, or at
another appropriate location, and reset the device to debug.
-Debugging with GDB
-------------------
+3.2 Debugging with GDB
+======================
**NOTE**: If you are debugging, make sure to set the
``-DCMAKE_BUILD_TYPE`` value to ``-DCMAKE_BUILD_TYPE=Debug`` when
@@ -172,14 +197,14 @@ Debugging with GDB
additional ``-DMBEDCRYPTO_BUILD_TYPE=DEBUG`` compile-time switch.
-Start the GDB server, pointing to the secure application image:
-
+3.2.1 Start the GDB server, pointing to the secure application image:
+---------------------------------------------------------------------
.. code:: bash
JLinkGDBServer -device lpc55s69 -if swd -speed 2000
-Connecting to the GDB server in ``tui`` mode
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+3.2.2 Connecting to the GDB server
+----------------------------------
In a separate terminal, start the GDB client in ``tui`` (text UI) mode:
@@ -197,8 +222,8 @@ With ``JLinkGDBServer`` (default port 2331):
(gdb) target remote:2331
Remote debugging using :2331
-Reset and stop at ``main``
-~~~~~~~~~~~~~~~~~~~~~~~~~~
+3.2.3 Reset and stop at ``main``
+--------------------------------
Set a breakpoint at ``main()`` (found in ``tfm_core.c``), reset the
device (``monitor reset``), and continue (``c``) execution.
@@ -216,8 +241,8 @@ device (``monitor reset``), and continue (``c``) execution.
at [path]/secure_fw/core/tfm_core.c:189
189 tfm_arch_init_secure_msp((uint32_t)&REGION_NAME(Image$$, ARM_LIB_STACK_MSP,
-Commonly used GDB commands
-~~~~~~~~~~~~~~~~~~~~~~~~~~
+3.2.4 Commonly used GDB commands
+--------------------------------
You can start, step through, and analyse the code using some of the
following GDB commands:
@@ -247,4 +272,5 @@ common problems.
*Copyright (c) 2020, Linaro. All rights reserved.*
*Copyright (c) 2020, Arm Limited. All rights reserved.*
-*SPDX-License-Identifier: BSD-3-Clause*
+*Copyright (c) 2021, NXP Semiconductors. All rights reserved.*
+*SPDX-License-Identifier: BSD-3-Clause* \ No newline at end of file
diff --git a/platform/ext/target/nxp/lpcxpresso55s69/scripts/build.sh b/platform/ext/target/nxp/lpcxpresso55s69/scripts/build.sh
deleted file mode 100644
index 93a02caea..000000000
--- a/platform/ext/target/nxp/lpcxpresso55s69/scripts/build.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2020, Linaro. All rights reserved.
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-# SPDX-License-Identifier: BSD-3-Clause
-
-# Exit on error
-set -e
-
-# Cleanup previous build artifacts
-find . \! -path './lib*' \! -name '*.sh' -delete
-
-# Generate the S and NS makefiles
-cmake -DTFM_PLATFORM=nxp/lpcxpresso55s69 \
- -DTFM_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake \
- -DCMAKE_BUILD_TYPE=Relwithdebinfo \
- -DTFM_PSA_API=ON -DTFM_ISOLATION_LEVEL=1 ../
-
-# Build the binaries
-make install
diff --git a/platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_demo.py b/platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_demo.py
new file mode 100644
index 000000000..267a04cf5
--- /dev/null
+++ b/platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_demo.py
@@ -0,0 +1,24 @@
+# Copyright (c) 2020, Linaro. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2021, NXP Semiconductors. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+
+import os
+import platform
+
+# Move to the TF-M root directory
+os.chdir('../../../../../../')
+
+# Remove previous build folder
+if os.path.isdir("build"):
+ if platform.system() == 'Windows':
+ os.system('rd /s /q build')
+ else:
+ os.system('rm -rf build')
+
+# Generate the S and NS makefiles
+os.system('cmake -S . -B build -DTFM_PLATFORM=nxp/lpcxpresso55s69 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DCMAKE_BUILD_TYPE=Relwithdebinfo -DBL2=OFF -DTFM_PSA_API=ON -DTFM_ISOLATION_LEVEL=2 -G"Unix Makefiles"')
+
+# Build the binaries
+os.chdir('build')
+os.system('make install') \ No newline at end of file
diff --git a/platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_demo_bl2.py b/platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_demo_bl2.py
new file mode 100644
index 000000000..0c5f96ad7
--- /dev/null
+++ b/platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_demo_bl2.py
@@ -0,0 +1,24 @@
+# Copyright (c) 2020, Linaro. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2021, NXP Semiconductors. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+
+import os
+import platform
+
+# Move to the TF-M root directory
+os.chdir('../../../../../../')
+
+# Remove previous build folder
+if os.path.isdir("build"):
+ if platform.system() == 'Windows':
+ os.system('rd /s /q build')
+ else:
+ os.system('rm -rf build')
+
+# Generate the S and NS makefiles
+os.system('cmake -S . -B build -DTFM_PLATFORM=nxp/lpcxpresso55s69 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DCMAKE_BUILD_TYPE=Relwithdebinfo -DTFM_PSA_API=ON -DTFM_ISOLATION_LEVEL=2 -G"Unix Makefiles"')
+
+# Build the binaries
+os.chdir('build')
+os.system('make install') \ No newline at end of file
diff --git a/platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_regression.py b/platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_regression.py
new file mode 100644
index 000000000..07b968fbe
--- /dev/null
+++ b/platform/ext/target/nxp/lpcxpresso55s69/scripts/build_tfm_regression.py
@@ -0,0 +1,24 @@
+# Copyright (c) 2020, Linaro. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2021, NXP Semiconductors. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+
+import os
+import platform
+
+# Move to the TF-M root directory
+os.chdir('../../../../../../')
+
+# Remove previous build folder
+if os.path.isdir("build"):
+ if platform.system() == 'Windows':
+ os.system('rd /s /q build')
+ else:
+ os.system('rm -rf build')
+
+# Generate the S and NS makefiles
+os.system('cmake -S . -B build -DTFM_PLATFORM=nxp/lpcxpresso55s69 -DTFM_TOOLCHAIN_FILE=toolchain_GNUARM.cmake -DCMAKE_BUILD_TYPE=Relwithdebinfo -DBL2=OFF -DTEST_S=ON -DTEST_NS=ON -DTFM_PSA_API=ON -DTFM_ISOLATION_LEVEL=2 -G"Unix Makefiles"')
+
+# Build the binaries
+os.chdir('build')
+os.system('make install') \ No newline at end of file
diff --git a/platform/ext/target/nxp/lpcxpresso55s69/scripts/flash.py b/platform/ext/target/nxp/lpcxpresso55s69/scripts/flash.py
new file mode 100644
index 000000000..711eaebca
--- /dev/null
+++ b/platform/ext/target/nxp/lpcxpresso55s69/scripts/flash.py
@@ -0,0 +1,34 @@
+# Copyright (c) 2020, Linaro. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2021, NXP Semiconductors. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+
+import os
+import platform
+
+os.chdir('../../../../../../build')
+os.system('arm-none-eabi-objcopy -S -O ihex bin/tfm_s.axf tfm_s.hex')
+os.system('arm-none-eabi-objcopy -S -O ihex bin/tfm_ns.axf tfm_ns.hex')
+
+# Flash with JLinkExe
+
+FILE = "flash.jlink"
+if os.path.isfile(FILE):
+ if platform.system() == 'Windows':
+ os.system('del /f FILE')
+ else:
+ os.system('rm -rf FILE')
+
+os.system('echo r >> ' + FILE)
+os.system('echo erase >> ' + FILE)
+os.system('echo loadfile tfm_s.hex >> ' + FILE)
+os.system('echo loadfile tfm_ns.hex >> ' + FILE)
+os.system('echo r >> ' + FILE)
+os.system('echo go >> ' + FILE)
+os.system('echo exit >> ' + FILE)
+
+if platform.system() == 'Windows':
+ os.system('JLink -device lpc55s69 -if swd -speed 2000 -autoconnect 1 -commanderscript ' + FILE)
+
+else:
+ os.system('JLinkExe -device lpc55s69 -if swd -speed 2000 -autoconnect 1 -commanderscript ' +FILE)
diff --git a/platform/ext/target/nxp/lpcxpresso55s69/scripts/flash.sh b/platform/ext/target/nxp/lpcxpresso55s69/scripts/flash.sh
deleted file mode 100644
index 701795fea..000000000
--- a/platform/ext/target/nxp/lpcxpresso55s69/scripts/flash.sh
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2020, Linaro. All rights reserved.
-# SPDX-License-Identifier: BSD-3-Clause
-
-# Exit on error
-set -e
-
-# Flash with JLinkExe
-FILE=flash.jlink
-if test -f "$FILE"; then
- rm $FILE
-fi
-echo "r
-erase
-loadfile bin/bl2.hex
-loadfile bin/tfm_s_signed.bin 0x8000
-loadfile bin/tfm_ns_signed.bin 0x30000
-r
-go
-exit" >> $FILE
-JLinkExe -device lpc55s69 -if swd -speed 2000 -autoconnect 1 -commanderscript $FILE
diff --git a/platform/ext/target/nxp/lpcxpresso55s69/scripts/flash_bl2.py b/platform/ext/target/nxp/lpcxpresso55s69/scripts/flash_bl2.py
new file mode 100644
index 000000000..f7f96fbf0
--- /dev/null
+++ b/platform/ext/target/nxp/lpcxpresso55s69/scripts/flash_bl2.py
@@ -0,0 +1,33 @@
+# Copyright (c) 2020, Linaro. All rights reserved.
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+# Copyright (c) 2021, NXP Semiconductors. All rights reserved.
+# SPDX-License-Identifier: BSD-3-Clause
+
+import os
+import platform
+
+os.chdir('../../../../../../build')
+
+# Flash with JLinkExe
+
+FILE = "flash.jlink"
+if os.path.isfile(FILE):
+ if platform.system() == 'Windows':
+ os.system('del /f FILE')
+ else:
+ os.system('rm -rf FILE')
+
+os.system('echo r >> ' + FILE)
+os.system('echo erase >> ' + FILE)
+os.system('echo loadfile bin/bl2.hex >> ' + FILE)
+os.system('echo loadfile bin/tfm_s_signed.bin 0x8000 >> ' + FILE)
+os.system('echo loadfile bin/tfm_ns_signed.bin 0x30000 >> ' + FILE)
+os.system('echo r >> ' + FILE)
+os.system('echo go >> ' + FILE)
+os.system('echo exit >> ' + FILE)
+
+if platform.system() == 'Windows':
+ os.system('JLink -device lpc55s69 -if swd -speed 2000 -autoconnect 1 -commanderscript ' + FILE)
+
+else:
+ os.system('JLinkExe -device lpc55s69 -if swd -speed 2000 -autoconnect 1 -commanderscript ' +FILE)