blob: 8386eab1f0e994d378059354d5a28b2248f2bd42 [file] [log] [blame]
Galanakis, Minos41f85972019-09-30 15:56:40 +01001##########
2User guide
3##########
Gyorgy Szingdb9783c2019-04-17 21:08:48 +02004How to compile and run TF-M and example test application for CoreLink
5SSE-200 subsystem on the MPS2 board and on the Fast Model(FVP).
6
7Follow :doc:`build instruction <tfm_build_instruction>` to build the binaries.
8Follow :doc:`secure boot <tfm_secure_boot>` to build the binaries with or
9without BL2 bootloader.
10
11****************************************************************
12Execute TF-M example and regression tests on MPS2 boards and FVP
13****************************************************************
14The BL2 bootloader and TF-M example application and tests run correctly on
15SMM-SSE-200 for MPS2 (AN521) and on the Fixed Virtual Platform model
16FVP_MPS2_AEMv8M version 11.2.23.
17
18To run the example code on FVP_MPS2_AEMv8M
19==========================================
20Using FVP_MPS2_AEMv8M provided by DS-5 v5.27.1.
21
22.. Note::
23 FVP reference guide can be found
24 `here <https://developer.arm.com/docs/100966/latest>`__
25
26Example application and regression tests without BL2 bootloader
27---------------------------------------------------------------
28Add ``tfm_s.axf`` and ``tfm_ns.axf`` to symbol files in Debug Configuration
29menu.
30
31.. code-block:: bash
32
33 <DS5_PATH>/sw/models/bin/FVP_MPS2_AEMv8M \
34 --parameter fvp_mps2.platform_type=2 \
35 --parameter cpu0.baseline=0 \
36 --parameter cpu0.INITVTOR_S=0x10000000 \
37 --parameter cpu0.semihosting-enable=0 \
38 --parameter fvp_mps2.DISABLE_GATING=0 \
39 --parameter fvp_mps2.telnetterminal0.start_telnet=1 \
40 --parameter fvp_mps2.telnetterminal1.start_telnet=0 \
41 --parameter fvp_mps2.telnetterminal2.start_telnet=0 \
42 --parameter fvp_mps2.telnetterminal0.quiet=0 \
43 --parameter fvp_mps2.telnetterminal1.quiet=1 \
44 --parameter fvp_mps2.telnetterminal2.quiet=1 \
Raef Coles1ecb8132020-10-02 15:11:24 +010045 --application cpu0=<build_dir>/bin/tfm_s.axf \
46 --data cpu0=<build_dir>/bin/tfm_ns.bin@0x00100000
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020047
48Example application and regression tests with BL2 bootloader
49------------------------------------------------------------
50To test TF-M with bootloader, one must apply the following changes:
51
52- Add ``mcuboot.axf`` to symbol files in DS-5 in Debug Configuration
53 menu.
54- Replace the last two lines of the previous command with this:
55
56.. code-block:: bash
57
Raef Coles1ecb8132020-10-02 15:11:24 +010058 --application cpu0=<build_dir>/bin/bl2.axf \
59 --data cpu0=<build_dir>/bin/tfm_s_ns_signed.bin@0x10080000
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020060
61Test software upgrade with BL2 bootloader
62^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
63BL2 bootloader is mandatory to test software update. Furthermore two TF-M blob
64must be built. Outputs of example application and regression test can be used to
David Vincze8bdfc2d2019-03-18 15:49:23 +010065test it. Load output of example application to the primary slot (0x10080000) and
66output of regression test to the secondary slot (0x10180000). Add the following
67line to the end of the previous chapter:
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020068
69.. code-block:: bash
70
Raef Coles1ecb8132020-10-02 15:11:24 +010071 --data cpu0=<build_dir>/bin/tfm_s_ns_signed.bin@0x10180000
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020072
73To run the example code on SSE 200 FPGA on MPS2 board
74=====================================================
75FPGA image is available to download
76`here <https://developer.arm.com/products/system-design/development-boards/cortex-m-prototyping-systems/mps2>`__
77
78To run BL2 bootloader and TF-M example application and tests in the MPS2 board,
79it is required to have SMM-SSE-200 for MPS2 (AN521) image in the MPS2 board SD
80card. The image should be located in
81``<MPS2 device name>/MB/HBI0263<board revision letter>/AN521``
82
83The MPS2 board tested is HBI0263C referred also as MPS2+.
84
85.. Warning::
86
87 If you change the exe names, MPS2 expects file names in 8.3 format.
88
89Example application
90-------------------
Raef Coles1ecb8132020-10-02 15:11:24 +010091#. Copy ``bl2.bin`` and ``tfm_s_ns_signed.bin`` files from
92 ``<build_dir>/bin`` to
Gyorgy Szingdb9783c2019-04-17 21:08:48 +020093 ``<MPS2 device name>/SOFTWARE/``
94#. Open ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt``
95#. Update the ``AN521/images.txt`` file as follows::
96
97 TITLE: Versatile Express Images Configuration File
98 [IMAGES]
99 TOTALIMAGES: 2 ;Number of Images (Max: 32)
100 IMAGE0ADDRESS: 0x10000000
Raef Coles1ecb8132020-10-02 15:11:24 +0100101 IMAGE0FILE: \Software\bl2.bin ; BL2 bootloader
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200102 IMAGE1ADDRESS: 0x10080000
Raef Coles1ecb8132020-10-02 15:11:24 +0100103 IMAGE1FILE: \Software\tfm_s_ns_signed.bin ; TF-M example application binary blob
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200104
105#. Close ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt``
106#. Unmount/eject the ``<MPS2 device name>`` unit
107#. Reset the board to execute the TF-M example application
108#. After completing the procedure you should be able to visualize on the serial
109 port (baud 115200 8n1) the following messages::
110
111 [INF] Starting bootloader
112 [INF] Image 0: magic=good, copy_done=0xff, image_ok=0xff
113 [INF] Scratch: magic=bad, copy_done=0x5, image_ok=0xcf
David Vincze8bdfc2d2019-03-18 15:49:23 +0100114 [INF] Boot source: primary slot
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200115 [INF] Swap type: none
116 [INF] Bootloader chainload address offset: 0x80000
117 [INF] Jumping to the first image slot
118 [Sec Thread] Secure image initializing!
119
120Regression tests
121----------------
122After completing the procedure you should be able to visualize on the serial
123port (baud 115200 8n1) the following messages::
124
125 [INF] Starting bootloader
126 [INF] Image 0: magic=good, copy_done=0xff, image_ok=0xff
127 [INF] Scratch: magic=bad, copy_done=0x5, image_ok=0xcf
David Vincze8bdfc2d2019-03-18 15:49:23 +0100128 [INF] Boot source: primary slot
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200129 [INF] Swap type: none
130 [INF] Bootloader chainload address offset: 0x80000
131 [INF] Jumping to the first image slot
132 [Sec Thread] Secure image initializing!
Jamie Foxb8a92702019-06-05 17:19:31 +0100133
Kevin Pengc6d74502020-03-04 16:55:37 +0800134 #### Execute test suites for the protected storage service ####
135 Running Test Suite PS secure interface tests (TFM_PS_TEST_2XXX)...
Jamie Foxb8a92702019-06-05 17:19:31 +0100136
Kevin Pengc6d74502020-03-04 16:55:37 +0800137 > Executing 'TFM_PS_TEST_2001'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200138 Description: 'Create interface'
139 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800140 > Executing 'TFM_PS_TEST_2002'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200141 Description: 'Get handle interface (DEPRECATED)'
142 This test is DEPRECATED and the test execution was SKIPPED
143 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800144 > Executing 'TFM_PS_TEST_2003'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200145 Description: 'Get handle with null handle pointer (DEPRECATED)'
146 This test is DEPRECATED and the test execution was SKIPPED
147 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800148 > Executing 'TFM_PS_TEST_2004'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200149 Description: 'Write interface'
150 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800151 > Executing 'TFM_PS_TEST_2005'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200152 Description: 'Read interface'
153 ....
154
155.. Note::
156
Kevin Pengc6d74502020-03-04 16:55:37 +0800157 PS reliability tests take a few minutes to run on the MPS2.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200158
159Example application without BL2 bootloader
160------------------------------------------
161#. Copy ``tfm_s.bin`` and ``tfm_ns.bin`` files from
Raef Coles1ecb8132020-10-02 15:11:24 +0100162 ``<build_dir>/bin`` to
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200163 ``<MPS2 device name>/SOFTWARE/``
164#. Open ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt``
165#. Update the ``AN521/images.txt`` file as follows::
166
167 TITLE: Versatile Express Images Configuration File
168 [IMAGES]
169 TOTALIMAGES: 2 ;Number of Images (Max: 32)
170 IMAGE0ADDRESS: 0x10000000
171 IMAGE0FILE: \Software\tfm_s.bin ; Secure code
172 IMAGE1ADDRESS: 0x00100000
173 IMAGE1FILE: \Software\tfm_ns.bin ; Non-secure code
174
175#. Close ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt``
176#. Unmount/eject the ``<MPS2 device name>`` unit
177#. Reset the board to execute the TF-M example application
178#. After completing the procedure you should be able to visualize on the serial
179 port (baud 115200 8n1) the following messages::
180
181 [Sec Thread] Secure image initializing!
182
183Regression tests without BL2 bootloader
184---------------------------------------
185After completing the procedure you should be able to visualize on the serial
186port (baud 115200 8n1) the following messages::
187
188 [Sec Thread] Secure image initializing!
Jamie Foxb8a92702019-06-05 17:19:31 +0100189
Kevin Pengc6d74502020-03-04 16:55:37 +0800190 #### Execute test suites for the protected storage service ####
191 Running Test Suite PS secure interface tests (TFM_PS_TEST_2XXX)...
Jamie Foxb8a92702019-06-05 17:19:31 +0100192
Kevin Pengc6d74502020-03-04 16:55:37 +0800193 > Executing 'TFM_PS_TEST_2001'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200194 Description: 'Create interface'
195 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800196 > Executing 'TFM_PS_TEST_2002'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200197 Description: 'Get handle interface (DEPRECATED)'
198 This test is DEPRECATED and the test execution was SKIPPED
199 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800200 > Executing 'TFM_PS_TEST_2003'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200201 Description: 'Get handle with null handle pointer (DEPRECATED)'
202 This test is DEPRECATED and the test execution was SKIPPED
203 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800204 > Executing 'TFM_PS_TEST_2004'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200205 Description: 'Write interface'
206 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800207 > Executing 'TFM_PS_TEST_2005'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200208 Description: 'Read interface'
209 ....
210
211*******************************************************************
212Execute TF-M example and regression tests on Musca test chip boards
213*******************************************************************
214.. Note::
215
216 Before executing any images on Musca-B1 board, please check the
217 :doc:`target platform readme </platform/ext/target/musca_b1/readme>`
218 to have the correct setup.
219
220Example application with BL2 bootloader
221=======================================
222
Raef Coles1ecb8132020-10-02 15:11:24 +0100223#. Create a unified hex file comprising of both ``bl2.bin`` and
224 ``tfm_s_ns_signed.bin``.
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200225
Jamie Foxb5215c32019-06-05 17:39:39 +0100226 - For Musca-A
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200227
Jamie Foxb5215c32019-06-05 17:39:39 +0100228 - Windows::
Jamie Foxb8a92702019-06-05 17:19:31 +0100229
Raef Coles1ecb8132020-10-02 15:11:24 +0100230 srec_cat.exe bin\bl2.bin -Binary -offset 0x200000 bin\tfm_s_ns_signed.bin -Binary -offset 0x220000 -o tfm.hex -Intel
Jamie Foxb8a92702019-06-05 17:19:31 +0100231
Jamie Foxb5215c32019-06-05 17:39:39 +0100232 - Linux::
Jamie Foxb8a92702019-06-05 17:19:31 +0100233
Raef Coles1ecb8132020-10-02 15:11:24 +0100234 srec_cat bin/bl2.bin -Binary -offset 0x200000 bin/tfm_s_ns_signed.bin -Binary -offset 0x220000 -o tfm.hex -Intel
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200235
Jamie Foxb5215c32019-06-05 17:39:39 +0100236 - For Musca-B1
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200237
Jamie Foxb5215c32019-06-05 17:39:39 +0100238 - Windows::
Jamie Foxb8a92702019-06-05 17:19:31 +0100239
Raef Coles1ecb8132020-10-02 15:11:24 +0100240 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 +0100241
Jamie Foxb5215c32019-06-05 17:39:39 +0100242 - Linux::
Jamie Foxb8a92702019-06-05 17:19:31 +0100243
Raef Coles1ecb8132020-10-02 15:11:24 +0100244 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 +0200245
Marton Berke8aae06f2019-11-25 16:46:12 +0100246 - For Musca-S1
247
248 - Windows::
249
Raef Coles1ecb8132020-10-02 15:11:24 +0100250 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 +0100251
252 - Linux::
253
Raef Coles1ecb8132020-10-02 15:11:24 +0100254 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 +0100255
Jamie Foxb5215c32019-06-05 17:39:39 +0100256#. Power up the Musca board by connecting it to a computer with a USB lead.
257 Press the ``PBON`` button if the green ``ON`` LED does not immediately turn
258 on. The board should appear as a USB drive.
259#. Copy ``tfm.hex`` to the USB drive. The orange ``PWR`` LED should start
260 blinking.
261#. Once the ``PWR`` LED stops blinking, power cycle or reset the board to boot
262 from the new image.
263#. After completing the procedure you should see the following messages on the
264 DAPLink UART (baud 115200 8n1)::
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200265
266 [INF] Starting bootloader
267 [INF] Image 0: magic=good, copy_done=0xff, image_ok=0xff
268 [INF] Scratch: magic=bad, copy_done=0x5, image_ok=0xd9
David Vincze8bdfc2d2019-03-18 15:49:23 +0100269 [INF] Boot source: primary slot
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200270 [INF] Swap type: none
271 [INF] Bootloader chainload address offset: 0x20000
272 [INF] Jumping to the first image slot
273 [Sec Thread] Secure image initializing!
274
275Regression tests with BL2 bootloader
276====================================
Jamie Fox14d75292020-07-03 12:52:29 +0100277.. note::
278
279 As the Internal Trusted Storage and Protected Storage tests use persistent
280 storage, it is recommended to erase the storage area before running the
281 tests. Existing data may prevent the tests from running to completion if,
282 for example, there is not enough free space for the test data or the UIDs
283 used by the tests have already been created with the write-once flag set.
284 Repeated test runs can be done without erasing between runs.
285
286 To erase the storage when flashing an image, ``-fill 0xFF <start_addr>
287 <end_addr>`` can be added to the ``srec_cat`` command used to create the
288 combined hex file. The ``<start_addr>`` and ``<end_addr>`` are the start and
289 end addresses of the storage area, found in the board's ``flash_layout.h``
290 file. The board's flash can also be erased via a debugger; see your IDE's
291 documentation for instructions.
292
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200293After completing the procedure you should see the following messages on the
Jamie Foxb5215c32019-06-05 17:39:39 +0100294DAPLink UART (baud 115200 8n1)::
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200295
296 [INF] Starting bootloader
297 [INF] Image 0: magic=good, copy_done=0xff, image_ok=0xff
298 [INF] Scratch: magic=bad, copy_done=0x5, image_ok=0x9
David Vincze8bdfc2d2019-03-18 15:49:23 +0100299 [INF] Boot source: primary slot
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200300 [INF] Swap type: none
301 [INF] Bootloader chainload address offset: 0x20000
302 [INF] Jumping to the first image slot
303 [Sec Thread] Secure image initializing!
Jamie Foxb8a92702019-06-05 17:19:31 +0100304
Kevin Pengc6d74502020-03-04 16:55:37 +0800305 #### Execute test suites for the protected storage service ####
306 Running Test Suite PS secure interface tests (TFM_PS_TEST_2XXX)...
307 > Executing 'TFM_PS_TEST_2001'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200308 Description: 'Create interface'
309 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800310 > Executing 'TFM_PS_TEST_2002'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200311 Description: 'Get handle interface (DEPRECATED)'
312 This test is DEPRECATED and the test execution was SKIPPED
313 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800314 > Executing 'TFM_PS_TEST_2003'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200315 Description: 'Get handle with null handle pointer (DEPRECATED)'
316 This test is DEPRECATED and the test execution was SKIPPED
317 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800318 > Executing 'TFM_PS_TEST_2004'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200319 Description: 'Get attributes interface'
320 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800321 > Executing 'TFM_PS_TEST_2005'
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200322 Description: 'Get attributes with null attributes struct pointer'
323 ....
324
Jamie Fox19c91c22019-02-10 18:04:58 +0000325PSA API tests
326=============
327Follow the build instructions for the PSA API tests and then follow the above
328procedures for flashing the image to the board. The PSA API tests are linked
329into the TF-M binaries and will automatically run. A log similar to the
330following should be visible on the UART; it is normal for some tests to be
331skipped but there should be no failed tests::
332
333 [Sec Thread] Secure image initializing!
334 Booting TFM v1.1
335 Non-Secure system starting...
336
337 ***** PSA Architecture Test Suite - Version 1.0 *****
338
339 Running.. Storage Suite
340 ******************************************
341
342 TEST: 401 | DESCRIPTION: UID not found check
343 [Info] Executing tests from non-secure
344
345 [Info] Executing ITS tests
346 [Check 1] Call get API for UID 6 which is not set
347 [Check 2] Call get_info API for UID 6 which is not set
348 [Check 3] Call remove API for UID 6 which is not set
349 [Check 4] Call get API for UID 6 which is removed
350 [Check 5] Call get_info API for UID 6 which is removed
351 [Check 6] Call remove API for UID 6 which is removed
352 [Check 7] Call get API for different UID 5
353 [Check 8] Call get_info API for different UID 5
354 [Check 9] Call remove API for different UID 5
355
356 [Info] Executing PS tests
357 [Check 1] Call get API for UID 6 which is not set
358 [Check 2] Call get_info API for UID 6 which is not set
359 [Check 3] Call remove API for UID 6 which is not set
360 [Check 4] Call get API for UID 6 which is removed
361 [Check 5] Call get_info API for UID 6 which is removed
362 [Check 6] Call remove API for UID 6 which is removed
363 [Check 7] Call get API for different UID 5
364 [Check 8] Call get_info API for different UID 5
365 [Check 9] Call remove API for different UID 5
366
367 TEST RESULT: PASSED
368
369 ******************************************
370
371 <further tests removed from log for brevity>
372
373 ************ Storage Suite Report **********
374 TOTAL TESTS : 17
375 TOTAL PASSED : 11
376 TOTAL SIM ERROR : 0
377 TOTAL FAILED : 0
378 TOTAL SKIPPED : 6
379 ******************************************
380
381.. note::
382 The Internal Trusted Storage and Protected Storage flash areas must be wiped
383 before running the Storage test suites.
384
385 Many IDEs for embedded development (such as Keil µVision) offer a function
386 to erase a device's flash. Refer to your IDE's documentation for
387 instructions.
388
389 Another way this can be achieved is by using ``srec_cat`` with the ``-fill``
390 parameter to fill the corresponding area in the binary with the erase value
391 of the flash (``0xFF``). For example, for Musca-A the command for
392 concatenating the ``bl2`` and ``tfm_s_ns_signed`` binaries would become::
393
394 srec_cat bin/bl2.bin -Binary -offset 0x200000 \
395 bin/tfm_s_ns_signed.bin -Binary -offset 0x220000 \
396 -fill 0xFF 0x420000 0x425000 -o tfm.hex -Intel
397
398 Refer to the platform flash layout for appropriate addresses to erase on
399 other platforms.
400
401 This step is not required on targets that emulate flash storage in RAM, as
402 it will be erased each time the device is reset. Note, however, that a warm
403 reset may not clear SRAM contents, so it may be necessary to power the
404 device off and on again between test runs.
405
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200406Example application or regression tests on Musca-B1 without BL2 bootloader
407==========================================================================
408
409Follow the above procedures, but create a unified hex file out of ``tfm_s.bin``
410and ``tfm_ns.bin``:
411
412- Windows::
413
Raef Coles1ecb8132020-10-02 15:11:24 +0100414 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 +0200415
416- Linux::
417
Raef Coles1ecb8132020-10-02 15:11:24 +0100418 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 +0200419
Kevin Peng0a142112018-09-21 10:42:22 +0800420********************************************************
421Execute TF-M example and regression tests on MPS3 boards
422********************************************************
423
424To run the example code on CoreLink SSE-200 Subsystem for MPS3 (AN524)
425======================================================================
426FPGA image is available to download `here <https://www.arm.com/products/development-tools/development-boards/mps3>`__
427
428To run BL2 bootloader and TF-M example application and tests in the MPS3 board,
429it is required to have SMM-SSE-200 for MPS3 (AN524) image in the MPS3 board
430SD card. The image should be located in
431``<MPS3 device name>/MB/HBI<BoardNumberBoardrevision>/AN524``
432
433And the current boot memory for AN524 is QSPI flash, so you need to set the
434correct REMAP option in
435``<MPS3 device name>/MB/HBI<BoardNumberBoardrevision>/AN524/an524_v1.txt``
436
437::
438
439 REMAP: QSPI ;REMAP boot device BRAM/QSPI. Must match REMAPVAL below.
440 REMAPVAL: 1 ;REMAP register value e.g. 0-BRAM. 1-QSPI
441
442The MPS3 board tested is HBI0309B.
443
444.. Note::
445 If you change the exe names, MPS3 expects file names in 8.3 format.
446
447Example application
448-------------------
Raef Coles1ecb8132020-10-02 15:11:24 +0100449#. Copy ``bl2.bin`` and ``tfm_s_ns_signed.bin`` files from
Kevin Peng0a142112018-09-21 10:42:22 +0800450 build dir to ``<MPS3 device name>/SOFTWARE/``
451#. Open ``<MPS3 device name>/MB/HBI0309B/AN524/images.txt``
452#. Update the ``images.txt`` file as follows::
453
454 TITLE: Arm MPS3 FPGA prototyping board Images Configuration File
455
456 [IMAGES]
457 TOTALIMAGES: 2 ;Number of Images (Max: 32)
458
459 IMAGE0UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE
460 IMAGE0ADDRESS: 0x00000000 ;Please select the required executable program
Raef Coles1ecb8132020-10-02 15:11:24 +0100461 IMAGE0FILE: \SOFTWARE\bl2.bin
Kevin Peng0a142112018-09-21 10:42:22 +0800462 IMAGE1UPDATE: AUTO
463 IMAGE1ADDRESS: 0x00040000
Raef Coles1ecb8132020-10-02 15:11:24 +0100464 IMAGE1FILE: \SOFTWARE\tfm_s_ns_signed.bin
Kevin Peng0a142112018-09-21 10:42:22 +0800465
466#. Close ``<MPS3 device name>/MB/HBI0309B/AN524/images.txt``
467#. Unmount/eject the ``<MPS3 device name>`` unit
468#. Reset the board to execute the TF-M example application
469#. After completing the procedure you should be able to visualize on the serial
470 port (baud 115200 8n1) the following messages::
471
472 [INF] Starting bootloader
473 [INF] Image 0: magic= good, copy_done=0xff, image_ok=0xff
474 [INF] Scratch: magic=unset, copy_done=0x43, image_ok=0xff
475 [INF] Boot source: slot 0
476 [INF] Swap type: none
477 [INF] Bootloader chainload address offset: 0x40000
478 [INF] Jumping to the first image slot
479 [Sec Thread] Secure image initializing!
480
481Regression tests
482----------------
483After completing the procedure you should be able to visualize on the serial
484port (baud 115200 8n1) the following messages::
485
486 [INF] Starting bootloader
487 [INF] Image 0: magic= good, copy_done=0xff, image_ok=0xff
488 [INF] Scratch: magic=unset, copy_done=0x9, image_ok=0xff
489 [INF] Boot source: slot 0
490 [INF] Swap type: none
491 [INF] Bootloader chainload address offset: 0x40000
492 [INF] Jumping to the first image slot
493 [Sec Thread] Secure image initializing!
494
495 #### Execute test suites for the Secure area ####
Kevin Pengc6d74502020-03-04 16:55:37 +0800496 Running Test Suite PSA protected storage S interface tests (TFM_PS_TEST_2XXX)...
497 > Executing 'TFM_PS_TEST_2001'
Kevin Peng0a142112018-09-21 10:42:22 +0800498 Description: 'Set interface'
499 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800500 > Executing 'TFM_PS_TEST_2002'
Kevin Peng0a142112018-09-21 10:42:22 +0800501 Description: 'Set interface with create flags'
502 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800503 > Executing 'TFM_PS_TEST_2003'
Kevin Peng0a142112018-09-21 10:42:22 +0800504 Description: 'Set interface with NULL data pointer'
505 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800506 > Executing 'TFM_PS_TEST_2004'
Kevin Peng0a142112018-09-21 10:42:22 +0800507 Description: 'Set interface with invalid data length'
508 TEST PASSED!
509 ....
510
511.. Note::
512 Some of the attestation tests take a few minutes to run on the MPS3.
513
514Example application without BL2 bootloader
515------------------------------------------
516#. Copy ``tfm_s.bin`` and ``tfm_ns.bin`` files from
517 build dir to ``<MPS3 device name>/SOFTWARE/``
518#. Open ``<MPS3 device name>/MB/HBI0309B/AN524/images.txt``
519#. Update the ``images.txt`` file as follows::
520
521 TITLE: Arm MPS3 FPGA prototyping board Images Configuration File
522
523 [IMAGES]
524 TOTALIMAGES: 2 ;Number of Images (Max: 32)
525
526 IMAGE0UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE
527 IMAGE0ADDRESS: 0x00000000 ;Please select the required executable program
528 IMAGE0FILE: \SOFTWARE\tfm_s.bin
529 IMAGE1UPDATE: AUTO
Mingyang Sund3db85d2020-03-20 16:23:53 +0800530 IMAGE1ADDRESS: 0x000C0000
Kevin Peng0a142112018-09-21 10:42:22 +0800531 IMAGE1FILE: \SOFTWARE\tfm_ns.bin
532
533#. Close ``<MPS3 device name>/MB/HBI0309B/AN521/images.txt``
534#. Unmount/eject the ``<MPS3 device name>`` unit
535#. Reset the board to execute the TF-M example application
536#. After completing the procedure you should be able to visualize on the serial
537 port (baud 115200 8n1) the following messages::
538
539 [Sec Thread] Secure image initializing!
540
541Regression tests without BL2 bootloader
542---------------------------------------
543After completing the procedure you should be able to visualize on the serial
544port (baud 115200 8n1) the following messages::
545
546 [Sec Thread] Secure image initializing!
547
548 #### Execute test suites for the Secure area ####
Kevin Pengc6d74502020-03-04 16:55:37 +0800549 Running Test Suite PSA protected storage S interface tests (TFM_PS_TEST_2XXX)...
550 > Executing 'TFM_PS_TEST_2001'
Kevin Peng0a142112018-09-21 10:42:22 +0800551 Description: 'Set interface'
552 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800553 > Executing 'TFM_PS_TEST_2002'
Kevin Peng0a142112018-09-21 10:42:22 +0800554 Description: 'Set interface with create flags'
555 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800556 > Executing 'TFM_PS_TEST_2003'
Kevin Peng0a142112018-09-21 10:42:22 +0800557 Description: 'Set interface with NULL data pointer'
558 TEST PASSED!
Kevin Pengc6d74502020-03-04 16:55:37 +0800559 > Executing 'TFM_PS_TEST_2004'
Kevin Peng0a142112018-09-21 10:42:22 +0800560 Description: 'Set interface with invalid data length'
561 TEST PASSED!
562 ....
563
Gyorgy Szingdb9783c2019-04-17 21:08:48 +0200564Firmware upgrade and image validation with BL2 bootloader
565=========================================================
566High level operation of BL2 bootloader and instructions for testing firmware
567upgrade is described in :doc:`secure boot <tfm_secure_boot>`.
568
569--------------
570
Mingyang Sund3db85d2020-03-20 16:23:53 +0800571*Copyright (c) 2017-2020, Arm Limited. All rights reserved.*