blob: 965d3e9eadaa64dcf76437d1f5a45b20cfbbaa6e [file] [log] [blame]
Summer Qinab1dd992021-05-25 13:58:55 +08001##################################
2Run TF-M examples on Arm platforms
3##################################
4Instructions for how to run TF-M and example test application on Arm platforms.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +02005
6Follow :doc:`build instruction <tfm_build_instruction>` to build the binaries.
Summer Qinabf66982021-04-06 17:22:15 +08007Follow :doc:`secure boot </docs/technical_references/tfm_secure_boot>` to build the
8binaries with or without BL2 bootloader.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +02009
10****************************************************************
11Execute TF-M example and regression tests on MPS2 boards and FVP
12****************************************************************
Minos Galanakis3b740a12020-10-15 11:10:26 +010013The BL2 bootloader and TF-M example application and tests have been verified
14using the reference model for MPS2 (AN521), in `Keil MDK`_ ,
15`Fixed Virtual Platforms`_ and `Arm Development Studio`_ .
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020016
17.. Note::
Minos Galanakis3b740a12020-10-15 11:10:26 +010018 The name of the reference model's executable can vary depending on toolchain.
19
20 - SMM-SSE-200 for `Keil MDK`_
21
22 - FVP_MPS2_AEMv8M for `Fixed Virtual Platforms`_ and `Arm Development Studio`_
23
24 For more information please refer to the appropriate toolchain's
25 documentation: `Keil MDK Documentation`_ ,
26 `Fixed Virtual Platforms Documentation`_ ,
27 `Arm Development Studio Documentation`_
28
29To run the example code on an SSE-200 Fast-Model
30================================================
31Using FVP_MPS2_AEMv8M provided by `Arm Development Studio`_ 2019.1.
32
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020033Example application and regression tests without BL2 bootloader
34---------------------------------------------------------------
35Add ``tfm_s.axf`` and ``tfm_ns.axf`` to symbol files in Debug Configuration
36menu.
37
38.. code-block:: bash
39
Minos Galanakis3b740a12020-10-15 11:10:26 +010040 <DS_PATH>/sw/models/bin/FVP_MPS2_AEMv8M \
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020041 --parameter fvp_mps2.platform_type=2 \
42 --parameter cpu0.baseline=0 \
43 --parameter cpu0.INITVTOR_S=0x10000000 \
44 --parameter cpu0.semihosting-enable=0 \
45 --parameter fvp_mps2.DISABLE_GATING=0 \
46 --parameter fvp_mps2.telnetterminal0.start_telnet=1 \
47 --parameter fvp_mps2.telnetterminal1.start_telnet=0 \
48 --parameter fvp_mps2.telnetterminal2.start_telnet=0 \
49 --parameter fvp_mps2.telnetterminal0.quiet=0 \
50 --parameter fvp_mps2.telnetterminal1.quiet=1 \
51 --parameter fvp_mps2.telnetterminal2.quiet=1 \
Raef Coles1ecb8132020-10-02 15:11:24 +010052 --application cpu0=<build_dir>/bin/tfm_s.axf \
53 --data cpu0=<build_dir>/bin/tfm_ns.bin@0x00100000
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020054
55Example application and regression tests with BL2 bootloader
56------------------------------------------------------------
57To test TF-M with bootloader, one must apply the following changes:
58
Summer Qin57096f92020-09-25 14:33:36 +080059- Add ``bl2.axf`` to symbol files in DS-5 in Debug Configuration
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020060 menu.
61- Replace the last two lines of the previous command with this:
62
63.. code-block:: bash
64
Raef Coles1ecb8132020-10-02 15:11:24 +010065 --application cpu0=<build_dir>/bin/bl2.axf \
66 --data cpu0=<build_dir>/bin/tfm_s_ns_signed.bin@0x10080000
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020067
68Test software upgrade with BL2 bootloader
69^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
70BL2 bootloader is mandatory to test software update. Furthermore two TF-M blob
71must be built. Outputs of example application and regression test can be used to
David Vincze8bdfc2d2019-03-18 15:49:23 +010072test it. Load output of example application to the primary slot (0x10080000) and
73output of regression test to the secondary slot (0x10180000). Add the following
74line to the end of the previous chapter:
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020075
76.. code-block:: bash
77
Raef Coles1ecb8132020-10-02 15:11:24 +010078 --data cpu0=<build_dir>/bin/tfm_s_ns_signed.bin@0x10180000
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020079
80To run the example code on SSE 200 FPGA on MPS2 board
81=====================================================
82FPGA image is available to download
83`here <https://developer.arm.com/products/system-design/development-boards/cortex-m-prototyping-systems/mps2>`__
84
85To run BL2 bootloader and TF-M example application and tests in the MPS2 board,
86it is required to have SMM-SSE-200 for MPS2 (AN521) image in the MPS2 board SD
87card. The image should be located in
88``<MPS2 device name>/MB/HBI0263<board revision letter>/AN521``
89
90The MPS2 board tested is HBI0263C referred also as MPS2+.
91
92.. Warning::
93
94 If you change the exe names, MPS2 expects file names in 8.3 format.
95
96Example application
97-------------------
Raef Coles1ecb8132020-10-02 15:11:24 +010098#. Copy ``bl2.bin`` and ``tfm_s_ns_signed.bin`` files from
99 ``<build_dir>/bin`` to
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200100 ``<MPS2 device name>/SOFTWARE/``
101#. Open ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt``
102#. Update the ``AN521/images.txt`` file as follows::
103
104 TITLE: Versatile Express Images Configuration File
105 [IMAGES]
106 TOTALIMAGES: 2 ;Number of Images (Max: 32)
107 IMAGE0ADDRESS: 0x10000000
Raef Coles1ecb8132020-10-02 15:11:24 +0100108 IMAGE0FILE: \Software\bl2.bin ; BL2 bootloader
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200109 IMAGE1ADDRESS: 0x10080000
Raef Coles1ecb8132020-10-02 15:11:24 +0100110 IMAGE1FILE: \Software\tfm_s_ns_signed.bin ; TF-M example application binary blob
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200111
112#. Close ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt``
113#. Unmount/eject the ``<MPS2 device name>`` unit
114#. Reset the board to execute the TF-M example application
115#. After completing the procedure you should be able to visualize on the serial
116 port (baud 115200 8n1) the following messages::
117
118 [INF] Starting bootloader
119 [INF] Image 0: magic=good, copy_done=0xff, image_ok=0xff
120 [INF] Scratch: magic=bad, copy_done=0x5, image_ok=0xcf
David Vincze8bdfc2d2019-03-18 15:49:23 +0100121 [INF] Boot source: primary slot
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200122 [INF] Swap type: none
123 [INF] Bootloader chainload address offset: 0x80000
124 [INF] Jumping to the first image slot
125 [Sec Thread] Secure image initializing!
126
127Regression tests
128----------------
129After completing the procedure you should be able to visualize on the serial
130port (baud 115200 8n1) the following messages::
131
132 [INF] Starting bootloader
133 [INF] Image 0: magic=good, copy_done=0xff, image_ok=0xff
134 [INF] Scratch: magic=bad, copy_done=0x5, image_ok=0xcf
David Vincze8bdfc2d2019-03-18 15:49:23 +0100135 [INF] Boot source: primary slot
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200136 [INF] Swap type: none
137 [INF] Bootloader chainload address offset: 0x80000
138 [INF] Jumping to the first image slot
139 [Sec Thread] Secure image initializing!
Jamie Foxb8a92702019-06-05 17:19:31 +0100140
Kevin Pengc6d74502020-03-04 16:55:37 +0800141 #### Execute test suites for the protected storage service ####
142 Running Test Suite PS secure interface tests (TFM_PS_TEST_2XXX)...
Jamie Foxb8a92702019-06-05 17:19:31 +0100143
Kevin Pengc6d74502020-03-04 16:55:37 +0800144 > Executing 'TFM_PS_TEST_2001'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200145 Description: 'Create interface'
146 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800147 > Executing 'TFM_PS_TEST_2002'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200148 Description: 'Get handle interface (DEPRECATED)'
149 This test is DEPRECATED and the test execution was SKIPPED
150 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800151 > Executing 'TFM_PS_TEST_2003'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200152 Description: 'Get handle with null handle pointer (DEPRECATED)'
153 This test is DEPRECATED and the test execution was SKIPPED
154 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800155 > Executing 'TFM_PS_TEST_2004'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200156 Description: 'Write interface'
157 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800158 > Executing 'TFM_PS_TEST_2005'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200159 Description: 'Read interface'
160 ....
161
162.. Note::
163
Kevin Pengc6d74502020-03-04 16:55:37 +0800164 PS reliability tests take a few minutes to run on the MPS2.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200165
166Example application without BL2 bootloader
167------------------------------------------
168#. Copy ``tfm_s.bin`` and ``tfm_ns.bin`` files from
Raef Coles1ecb8132020-10-02 15:11:24 +0100169 ``<build_dir>/bin`` to
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200170 ``<MPS2 device name>/SOFTWARE/``
171#. Open ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt``
172#. Update the ``AN521/images.txt`` file as follows::
173
174 TITLE: Versatile Express Images Configuration File
175 [IMAGES]
176 TOTALIMAGES: 2 ;Number of Images (Max: 32)
177 IMAGE0ADDRESS: 0x10000000
178 IMAGE0FILE: \Software\tfm_s.bin ; Secure code
179 IMAGE1ADDRESS: 0x00100000
180 IMAGE1FILE: \Software\tfm_ns.bin ; Non-secure code
181
182#. Close ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt``
183#. Unmount/eject the ``<MPS2 device name>`` unit
184#. Reset the board to execute the TF-M example application
185#. After completing the procedure you should be able to visualize on the serial
186 port (baud 115200 8n1) the following messages::
187
188 [Sec Thread] Secure image initializing!
189
190Regression tests without BL2 bootloader
191---------------------------------------
192After completing the procedure you should be able to visualize on the serial
193port (baud 115200 8n1) the following messages::
194
195 [Sec Thread] Secure image initializing!
Jamie Foxb8a92702019-06-05 17:19:31 +0100196
Kevin Pengc6d74502020-03-04 16:55:37 +0800197 #### Execute test suites for the protected storage service ####
198 Running Test Suite PS secure interface tests (TFM_PS_TEST_2XXX)...
Jamie Foxb8a92702019-06-05 17:19:31 +0100199
Kevin Pengc6d74502020-03-04 16:55:37 +0800200 > Executing 'TFM_PS_TEST_2001'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200201 Description: 'Create interface'
202 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800203 > Executing 'TFM_PS_TEST_2002'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200204 Description: 'Get handle interface (DEPRECATED)'
205 This test is DEPRECATED and the test execution was SKIPPED
206 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800207 > Executing 'TFM_PS_TEST_2003'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200208 Description: 'Get handle with null handle pointer (DEPRECATED)'
209 This test is DEPRECATED and the test execution was SKIPPED
210 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800211 > Executing 'TFM_PS_TEST_2004'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200212 Description: 'Write interface'
213 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800214 > Executing 'TFM_PS_TEST_2005'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200215 Description: 'Read interface'
216 ....
217
218*******************************************************************
219Execute TF-M example and regression tests on Musca test chip boards
220*******************************************************************
221.. Note::
222
223 Before executing any images on Musca-B1 board, please check the
Summer Qin2de23d02021-05-14 13:44:14 +0800224 :doc:`target platform readme </platform/ext/target/arm/musca_b1/sse_200/readme>`
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200225 to have the correct setup.
226
227Example application with BL2 bootloader
228=======================================
229
Raef Coles1ecb8132020-10-02 15:11:24 +0100230#. Create a unified hex file comprising of both ``bl2.bin`` and
231 ``tfm_s_ns_signed.bin``.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200232
Jamie Foxb5215c32019-06-05 17:39:39 +0100233 - For Musca-B1
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200234
Jamie Foxb5215c32019-06-05 17:39:39 +0100235 - Windows::
Jamie Foxb8a92702019-06-05 17:19:31 +0100236
Raef Coles1ecb8132020-10-02 15:11:24 +0100237 srec_cat.exe bin\bl2.bin -Binary -offset 0xA000000 bin\tfm_s_ns_signed.bin -Binary -offset 0xA020000 -o tfm.hex -Intel
Jamie Foxb8a92702019-06-05 17:19:31 +0100238
Jamie Foxb5215c32019-06-05 17:39:39 +0100239 - Linux::
Jamie Foxb8a92702019-06-05 17:19:31 +0100240
Raef Coles1ecb8132020-10-02 15:11:24 +0100241 srec_cat bin/bl2.bin -Binary -offset 0xA000000 bin/tfm_s_ns_signed.bin -Binary -offset 0xA020000 -o tfm.hex -Intel
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200242
Marton Berke8aae06f2019-11-25 16:46:12 +0100243 - For Musca-S1
244
245 - Windows::
246
Raef Coles1ecb8132020-10-02 15:11:24 +0100247 srec_cat.exe bin\bl2.bin -Binary -offset 0xA000000 bin\tfm_s_ns_signed.bin -Binary -offset 0xA020000 -o tfm.hex -Intel
Marton Berke8aae06f2019-11-25 16:46:12 +0100248
249 - Linux::
250
Raef Coles1ecb8132020-10-02 15:11:24 +0100251 srec_cat bin/bl2.bin -Binary -offset 0xA000000 bin/tfm_s_ns_signed.bin -Binary -offset 0xA020000 -o tfm.hex -Intel
Marton Berke8aae06f2019-11-25 16:46:12 +0100252
Jamie Foxb5215c32019-06-05 17:39:39 +0100253#. Power up the Musca board by connecting it to a computer with a USB lead.
254 Press the ``PBON`` button if the green ``ON`` LED does not immediately turn
255 on. The board should appear as a USB drive.
256#. Copy ``tfm.hex`` to the USB drive. The orange ``PWR`` LED should start
257 blinking.
258#. Once the ``PWR`` LED stops blinking, power cycle or reset the board to boot
259 from the new image.
260#. After completing the procedure you should see the following messages on the
261 DAPLink UART (baud 115200 8n1)::
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200262
263 [INF] Starting bootloader
264 [INF] Image 0: magic=good, copy_done=0xff, image_ok=0xff
265 [INF] Scratch: magic=bad, copy_done=0x5, image_ok=0xd9
David Vincze8bdfc2d2019-03-18 15:49:23 +0100266 [INF] Boot source: primary slot
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200267 [INF] Swap type: none
268 [INF] Bootloader chainload address offset: 0x20000
269 [INF] Jumping to the first image slot
270 [Sec Thread] Secure image initializing!
271
272Regression tests with BL2 bootloader
273====================================
Jamie Fox14d75292020-07-03 12:52:29 +0100274.. note::
275
276 As the Internal Trusted Storage and Protected Storage tests use persistent
277 storage, it is recommended to erase the storage area before running the
278 tests. Existing data may prevent the tests from running to completion if,
279 for example, there is not enough free space for the test data or the UIDs
280 used by the tests have already been created with the write-once flag set.
281 Repeated test runs can be done without erasing between runs.
282
283 To erase the storage when flashing an image, ``-fill 0xFF <start_addr>
284 <end_addr>`` can be added to the ``srec_cat`` command used to create the
285 combined hex file. The ``<start_addr>`` and ``<end_addr>`` are the start and
286 end addresses of the storage area, found in the board's ``flash_layout.h``
287 file. The board's flash can also be erased via a debugger; see your IDE's
288 documentation for instructions.
289
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200290After completing the procedure you should see the following messages on the
Jamie Foxb5215c32019-06-05 17:39:39 +0100291DAPLink UART (baud 115200 8n1)::
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200292
293 [INF] Starting bootloader
294 [INF] Image 0: magic=good, copy_done=0xff, image_ok=0xff
295 [INF] Scratch: magic=bad, copy_done=0x5, image_ok=0x9
David Vincze8bdfc2d2019-03-18 15:49:23 +0100296 [INF] Boot source: primary slot
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200297 [INF] Swap type: none
298 [INF] Bootloader chainload address offset: 0x20000
299 [INF] Jumping to the first image slot
300 [Sec Thread] Secure image initializing!
Jamie Foxb8a92702019-06-05 17:19:31 +0100301
Kevin Pengc6d74502020-03-04 16:55:37 +0800302 #### Execute test suites for the protected storage service ####
303 Running Test Suite PS secure interface tests (TFM_PS_TEST_2XXX)...
304 > Executing 'TFM_PS_TEST_2001'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200305 Description: 'Create interface'
306 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800307 > Executing 'TFM_PS_TEST_2002'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200308 Description: 'Get handle interface (DEPRECATED)'
309 This test is DEPRECATED and the test execution was SKIPPED
310 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800311 > Executing 'TFM_PS_TEST_2003'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200312 Description: 'Get handle with null handle pointer (DEPRECATED)'
313 This test is DEPRECATED and the test execution was SKIPPED
314 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800315 > Executing 'TFM_PS_TEST_2004'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200316 Description: 'Get attributes interface'
317 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800318 > Executing 'TFM_PS_TEST_2005'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200319 Description: 'Get attributes with null attributes struct pointer'
320 ....
321
Jamie Fox19c91c22019-02-10 18:04:58 +0000322PSA API tests
323=============
324Follow the build instructions for the PSA API tests and then follow the above
325procedures for flashing the image to the board. The PSA API tests are linked
326into the TF-M binaries and will automatically run. A log similar to the
327following should be visible on the UART; it is normal for some tests to be
328skipped but there should be no failed tests::
329
330 [Sec Thread] Secure image initializing!
331 Booting TFM v1.1
332 Non-Secure system starting...
333
334 ***** PSA Architecture Test Suite - Version 1.0 *****
335
336 Running.. Storage Suite
337 ******************************************
338
339 TEST: 401 | DESCRIPTION: UID not found check
340 [Info] Executing tests from non-secure
341
342 [Info] Executing ITS tests
343 [Check 1] Call get API for UID 6 which is not set
344 [Check 2] Call get_info API for UID 6 which is not set
345 [Check 3] Call remove API for UID 6 which is not set
346 [Check 4] Call get API for UID 6 which is removed
347 [Check 5] Call get_info API for UID 6 which is removed
348 [Check 6] Call remove API for UID 6 which is removed
349 [Check 7] Call get API for different UID 5
350 [Check 8] Call get_info API for different UID 5
351 [Check 9] Call remove API for different UID 5
352
353 [Info] Executing PS tests
354 [Check 1] Call get API for UID 6 which is not set
355 [Check 2] Call get_info API for UID 6 which is not set
356 [Check 3] Call remove API for UID 6 which is not set
357 [Check 4] Call get API for UID 6 which is removed
358 [Check 5] Call get_info API for UID 6 which is removed
359 [Check 6] Call remove API for UID 6 which is removed
360 [Check 7] Call get API for different UID 5
361 [Check 8] Call get_info API for different UID 5
362 [Check 9] Call remove API for different UID 5
363
364 TEST RESULT: PASSED
365
366 ******************************************
367
368 <further tests removed from log for brevity>
369
370 ************ Storage Suite Report **********
371 TOTAL TESTS : 17
372 TOTAL PASSED : 11
373 TOTAL SIM ERROR : 0
374 TOTAL FAILED : 0
375 TOTAL SKIPPED : 6
376 ******************************************
377
378.. note::
379 The Internal Trusted Storage and Protected Storage flash areas must be wiped
380 before running the Storage test suites.
381
382 Many IDEs for embedded development (such as Keil µVision) offer a function
383 to erase a device's flash. Refer to your IDE's documentation for
384 instructions.
385
386 Another way this can be achieved is by using ``srec_cat`` with the ``-fill``
387 parameter to fill the corresponding area in the binary with the erase value
Minos Galanakisb00faed2021-03-11 10:11:34 +0000388 of the flash (``0xFF``).
Jamie Fox19c91c22019-02-10 18:04:58 +0000389
390 Refer to the platform flash layout for appropriate addresses to erase on
391 other platforms.
392
393 This step is not required on targets that emulate flash storage in RAM, as
394 it will be erased each time the device is reset. Note, however, that a warm
395 reset may not clear SRAM contents, so it may be necessary to power the
396 device off and on again between test runs.
397
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200398Example application or regression tests on Musca-B1 without BL2 bootloader
399==========================================================================
400
401Follow the above procedures, but create a unified hex file out of ``tfm_s.bin``
402and ``tfm_ns.bin``:
403
404- Windows::
405
Raef Coles1ecb8132020-10-02 15:11:24 +0100406 srec_cat.exe bin\tfm_s.bin -Binary -offset 0xA000000 bin\tfm_ns.bin -Binary -offset 0xA080000 -o tfm.hex -Intel
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200407
408- Linux::
409
Raef Coles1ecb8132020-10-02 15:11:24 +0100410 srec_cat bin/tfm_s.bin -Binary -offset 0xA000000 bin/tfm_ns.bin -Binary -offset 0xA080000 -o tfm.hex -Intel
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200411
Mark Horvath8dcc3832020-08-07 15:10:52 +0200412Example application or regression tests on Musca-B1 using the Secure Enclave
413============================================================================
414
415Follow the above procedures, but to create a unified hex please check the
Summer Qin2de23d02021-05-14 13:44:14 +0800416:doc:`Musca-B1 Secure Enclave readme </platform/ext/target/arm/musca_b1/secure_enclave/readme>`.
Mark Horvath8dcc3832020-08-07 15:10:52 +0200417
Kevin Peng0a142112018-09-21 10:42:22 +0800418********************************************************
419Execute TF-M example and regression tests on MPS3 boards
420********************************************************
421
422To run the example code on CoreLink SSE-200 Subsystem for MPS3 (AN524)
423======================================================================
424FPGA image is available to download `here <https://www.arm.com/products/development-tools/development-boards/mps3>`__
425
426To run BL2 bootloader and TF-M example application and tests in the MPS3 board,
427it is required to have SMM-SSE-200 for MPS3 (AN524) image in the MPS3 board
428SD card. The image should be located in
429``<MPS3 device name>/MB/HBI<BoardNumberBoardrevision>/AN524``
430
431And the current boot memory for AN524 is QSPI flash, so you need to set the
432correct REMAP option in
433``<MPS3 device name>/MB/HBI<BoardNumberBoardrevision>/AN524/an524_v1.txt``
434
435::
436
437 REMAP: QSPI ;REMAP boot device BRAM/QSPI. Must match REMAPVAL below.
438 REMAPVAL: 1 ;REMAP register value e.g. 0-BRAM. 1-QSPI
439
440The MPS3 board tested is HBI0309B.
441
442.. Note::
443 If you change the exe names, MPS3 expects file names in 8.3 format.
444
445Example application
446-------------------
Raef Coles1ecb8132020-10-02 15:11:24 +0100447#. Copy ``bl2.bin`` and ``tfm_s_ns_signed.bin`` files from
Kevin Peng0a142112018-09-21 10:42:22 +0800448 build dir to ``<MPS3 device name>/SOFTWARE/``
449#. Open ``<MPS3 device name>/MB/HBI0309B/AN524/images.txt``
450#. Update the ``images.txt`` file as follows::
451
452 TITLE: Arm MPS3 FPGA prototyping board Images Configuration File
453
454 [IMAGES]
455 TOTALIMAGES: 2 ;Number of Images (Max: 32)
456
457 IMAGE0UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE
458 IMAGE0ADDRESS: 0x00000000 ;Please select the required executable program
Raef Coles1ecb8132020-10-02 15:11:24 +0100459 IMAGE0FILE: \SOFTWARE\bl2.bin
Kevin Peng0a142112018-09-21 10:42:22 +0800460 IMAGE1UPDATE: AUTO
461 IMAGE1ADDRESS: 0x00040000
Raef Coles1ecb8132020-10-02 15:11:24 +0100462 IMAGE1FILE: \SOFTWARE\tfm_s_ns_signed.bin
Kevin Peng0a142112018-09-21 10:42:22 +0800463
464#. Close ``<MPS3 device name>/MB/HBI0309B/AN524/images.txt``
465#. Unmount/eject the ``<MPS3 device name>`` unit
466#. Reset the board to execute the TF-M example application
467#. After completing the procedure you should be able to visualize on the serial
468 port (baud 115200 8n1) the following messages::
469
470 [INF] Starting bootloader
471 [INF] Image 0: magic= good, copy_done=0xff, image_ok=0xff
472 [INF] Scratch: magic=unset, copy_done=0x43, image_ok=0xff
473 [INF] Boot source: slot 0
474 [INF] Swap type: none
475 [INF] Bootloader chainload address offset: 0x40000
476 [INF] Jumping to the first image slot
477 [Sec Thread] Secure image initializing!
478
479Regression tests
480----------------
481After completing the procedure you should be able to visualize on the serial
482port (baud 115200 8n1) the following messages::
483
484 [INF] Starting bootloader
485 [INF] Image 0: magic= good, copy_done=0xff, image_ok=0xff
486 [INF] Scratch: magic=unset, copy_done=0x9, image_ok=0xff
487 [INF] Boot source: slot 0
488 [INF] Swap type: none
489 [INF] Bootloader chainload address offset: 0x40000
490 [INF] Jumping to the first image slot
491 [Sec Thread] Secure image initializing!
492
493 #### Execute test suites for the Secure area ####
Kevin Pengc6d74502020-03-04 16:55:37 +0800494 Running Test Suite PSA protected storage S interface tests (TFM_PS_TEST_2XXX)...
495 > Executing 'TFM_PS_TEST_2001'
Kevin Peng0a142112018-09-21 10:42:22 +0800496 Description: 'Set interface'
497 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800498 > Executing 'TFM_PS_TEST_2002'
Kevin Peng0a142112018-09-21 10:42:22 +0800499 Description: 'Set interface with create flags'
500 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800501 > Executing 'TFM_PS_TEST_2003'
Kevin Peng0a142112018-09-21 10:42:22 +0800502 Description: 'Set interface with NULL data pointer'
503 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800504 > Executing 'TFM_PS_TEST_2004'
Kevin Peng0a142112018-09-21 10:42:22 +0800505 Description: 'Set interface with invalid data length'
506 TEST PASSED!
507 ....
508
509.. Note::
510 Some of the attestation tests take a few minutes to run on the MPS3.
511
512Example application without BL2 bootloader
513------------------------------------------
514#. Copy ``tfm_s.bin`` and ``tfm_ns.bin`` files from
515 build dir to ``<MPS3 device name>/SOFTWARE/``
516#. Open ``<MPS3 device name>/MB/HBI0309B/AN524/images.txt``
517#. Update the ``images.txt`` file as follows::
518
519 TITLE: Arm MPS3 FPGA prototyping board Images Configuration File
520
521 [IMAGES]
522 TOTALIMAGES: 2 ;Number of Images (Max: 32)
523
524 IMAGE0UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE
525 IMAGE0ADDRESS: 0x00000000 ;Please select the required executable program
526 IMAGE0FILE: \SOFTWARE\tfm_s.bin
527 IMAGE1UPDATE: AUTO
Mingyang Sund3db85d2020-03-20 16:23:53 +0800528 IMAGE1ADDRESS: 0x000C0000
Kevin Peng0a142112018-09-21 10:42:22 +0800529 IMAGE1FILE: \SOFTWARE\tfm_ns.bin
530
531#. Close ``<MPS3 device name>/MB/HBI0309B/AN521/images.txt``
532#. Unmount/eject the ``<MPS3 device name>`` unit
533#. Reset the board to execute the TF-M example application
534#. After completing the procedure you should be able to visualize on the serial
535 port (baud 115200 8n1) the following messages::
536
537 [Sec Thread] Secure image initializing!
538
539Regression tests without BL2 bootloader
540---------------------------------------
541After completing the procedure you should be able to visualize on the serial
542port (baud 115200 8n1) the following messages::
543
544 [Sec Thread] Secure image initializing!
545
546 #### Execute test suites for the Secure area ####
Kevin Pengc6d74502020-03-04 16:55:37 +0800547 Running Test Suite PSA protected storage S interface tests (TFM_PS_TEST_2XXX)...
548 > Executing 'TFM_PS_TEST_2001'
Kevin Peng0a142112018-09-21 10:42:22 +0800549 Description: 'Set interface'
550 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800551 > Executing 'TFM_PS_TEST_2002'
Kevin Peng0a142112018-09-21 10:42:22 +0800552 Description: 'Set interface with create flags'
553 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800554 > Executing 'TFM_PS_TEST_2003'
Kevin Peng0a142112018-09-21 10:42:22 +0800555 Description: 'Set interface with NULL data pointer'
556 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800557 > Executing 'TFM_PS_TEST_2004'
Kevin Peng0a142112018-09-21 10:42:22 +0800558 Description: 'Set interface with invalid data length'
559 TEST PASSED!
560 ....
561
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200562Firmware upgrade and image validation with BL2 bootloader
563=========================================================
564High level operation of BL2 bootloader and instructions for testing firmware
Summer Qinabf66982021-04-06 17:22:15 +0800565upgrade is described in :doc:`secure boot </docs/technical_references/tfm_secure_boot>`.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200566
567--------------
568
Minos Galanakis3b740a12020-10-15 11:10:26 +0100569.. _Arm Development Studio: https://developer.arm.com/tools-and-software/embedded/arm-development-studio
570.. _Arm Development Studio Documentation: https://developer.arm.com/tools-and-software/embedded/arm-development-studio/learn/docs
571.. _Fixed Virtual Platforms: https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms
572.. _Fixed Virtual Platforms Documentation: https://developer.arm.com/documentation/100966/latest
573.. _Keil MDK: http://www2.keil.com/mdk5
574.. _Keil MDK Documentation: https://www2.keil.com/mdk5/docs
575
Summer Qinabf66982021-04-06 17:22:15 +0800576*Copyright (c) 2017-2021, Arm Limited. All rights reserved.*