Galanakis, Minos | 41f8597 | 2019-09-30 15:56:40 +0100 | [diff] [blame] | 1 | ########## |
| 2 | User guide |
| 3 | ########## |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 4 | How to compile and run TF-M and example test application for CoreLink |
| 5 | SSE-200 subsystem on the MPS2 board and on the Fast Model(FVP). |
| 6 | |
| 7 | Follow :doc:`build instruction <tfm_build_instruction>` to build the binaries. |
Summer Qin | abf6698 | 2021-04-06 17:22:15 +0800 | [diff] [blame] | 8 | Follow :doc:`secure boot </docs/technical_references/tfm_secure_boot>` to build the |
| 9 | binaries with or without BL2 bootloader. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 10 | |
| 11 | **************************************************************** |
| 12 | Execute TF-M example and regression tests on MPS2 boards and FVP |
| 13 | **************************************************************** |
Minos Galanakis | 3b740a1 | 2020-10-15 11:10:26 +0100 | [diff] [blame] | 14 | The BL2 bootloader and TF-M example application and tests have been verified |
| 15 | using the reference model for MPS2 (AN521), in `Keil MDK`_ , |
| 16 | `Fixed Virtual Platforms`_ and `Arm Development Studio`_ . |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 17 | |
| 18 | .. Note:: |
Minos Galanakis | 3b740a1 | 2020-10-15 11:10:26 +0100 | [diff] [blame] | 19 | The name of the reference model's executable can vary depending on toolchain. |
| 20 | |
| 21 | - SMM-SSE-200 for `Keil MDK`_ |
| 22 | |
| 23 | - FVP_MPS2_AEMv8M for `Fixed Virtual Platforms`_ and `Arm Development Studio`_ |
| 24 | |
| 25 | For more information please refer to the appropriate toolchain's |
| 26 | documentation: `Keil MDK Documentation`_ , |
| 27 | `Fixed Virtual Platforms Documentation`_ , |
| 28 | `Arm Development Studio Documentation`_ |
| 29 | |
| 30 | To run the example code on an SSE-200 Fast-Model |
| 31 | ================================================ |
| 32 | Using FVP_MPS2_AEMv8M provided by `Arm Development Studio`_ 2019.1. |
| 33 | |
| 34 | |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 35 | |
| 36 | Example application and regression tests without BL2 bootloader |
| 37 | --------------------------------------------------------------- |
| 38 | Add ``tfm_s.axf`` and ``tfm_ns.axf`` to symbol files in Debug Configuration |
| 39 | menu. |
| 40 | |
| 41 | .. code-block:: bash |
| 42 | |
Minos Galanakis | 3b740a1 | 2020-10-15 11:10:26 +0100 | [diff] [blame] | 43 | <DS_PATH>/sw/models/bin/FVP_MPS2_AEMv8M \ |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 44 | --parameter fvp_mps2.platform_type=2 \ |
| 45 | --parameter cpu0.baseline=0 \ |
| 46 | --parameter cpu0.INITVTOR_S=0x10000000 \ |
| 47 | --parameter cpu0.semihosting-enable=0 \ |
| 48 | --parameter fvp_mps2.DISABLE_GATING=0 \ |
| 49 | --parameter fvp_mps2.telnetterminal0.start_telnet=1 \ |
| 50 | --parameter fvp_mps2.telnetterminal1.start_telnet=0 \ |
| 51 | --parameter fvp_mps2.telnetterminal2.start_telnet=0 \ |
| 52 | --parameter fvp_mps2.telnetterminal0.quiet=0 \ |
| 53 | --parameter fvp_mps2.telnetterminal1.quiet=1 \ |
| 54 | --parameter fvp_mps2.telnetterminal2.quiet=1 \ |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 55 | --application cpu0=<build_dir>/bin/tfm_s.axf \ |
| 56 | --data cpu0=<build_dir>/bin/tfm_ns.bin@0x00100000 |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 57 | |
| 58 | Example application and regression tests with BL2 bootloader |
| 59 | ------------------------------------------------------------ |
| 60 | To test TF-M with bootloader, one must apply the following changes: |
| 61 | |
Summer Qin | 57096f9 | 2020-09-25 14:33:36 +0800 | [diff] [blame] | 62 | - Add ``bl2.axf`` to symbol files in DS-5 in Debug Configuration |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 63 | menu. |
| 64 | - Replace the last two lines of the previous command with this: |
| 65 | |
| 66 | .. code-block:: bash |
| 67 | |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 68 | --application cpu0=<build_dir>/bin/bl2.axf \ |
| 69 | --data cpu0=<build_dir>/bin/tfm_s_ns_signed.bin@0x10080000 |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 70 | |
| 71 | Test software upgrade with BL2 bootloader |
| 72 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 73 | BL2 bootloader is mandatory to test software update. Furthermore two TF-M blob |
| 74 | must be built. Outputs of example application and regression test can be used to |
David Vincze | 8bdfc2d | 2019-03-18 15:49:23 +0100 | [diff] [blame] | 75 | test it. Load output of example application to the primary slot (0x10080000) and |
| 76 | output of regression test to the secondary slot (0x10180000). Add the following |
| 77 | line to the end of the previous chapter: |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 78 | |
| 79 | .. code-block:: bash |
| 80 | |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 81 | --data cpu0=<build_dir>/bin/tfm_s_ns_signed.bin@0x10180000 |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 82 | |
| 83 | To run the example code on SSE 200 FPGA on MPS2 board |
| 84 | ===================================================== |
| 85 | FPGA image is available to download |
| 86 | `here <https://developer.arm.com/products/system-design/development-boards/cortex-m-prototyping-systems/mps2>`__ |
| 87 | |
| 88 | To run BL2 bootloader and TF-M example application and tests in the MPS2 board, |
| 89 | it is required to have SMM-SSE-200 for MPS2 (AN521) image in the MPS2 board SD |
| 90 | card. The image should be located in |
| 91 | ``<MPS2 device name>/MB/HBI0263<board revision letter>/AN521`` |
| 92 | |
| 93 | The MPS2 board tested is HBI0263C referred also as MPS2+. |
| 94 | |
| 95 | .. Warning:: |
| 96 | |
| 97 | If you change the exe names, MPS2 expects file names in 8.3 format. |
| 98 | |
| 99 | Example application |
| 100 | ------------------- |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 101 | #. Copy ``bl2.bin`` and ``tfm_s_ns_signed.bin`` files from |
| 102 | ``<build_dir>/bin`` to |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 103 | ``<MPS2 device name>/SOFTWARE/`` |
| 104 | #. Open ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt`` |
| 105 | #. Update the ``AN521/images.txt`` file as follows:: |
| 106 | |
| 107 | TITLE: Versatile Express Images Configuration File |
| 108 | [IMAGES] |
| 109 | TOTALIMAGES: 2 ;Number of Images (Max: 32) |
| 110 | IMAGE0ADDRESS: 0x10000000 |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 111 | IMAGE0FILE: \Software\bl2.bin ; BL2 bootloader |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 112 | IMAGE1ADDRESS: 0x10080000 |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 113 | IMAGE1FILE: \Software\tfm_s_ns_signed.bin ; TF-M example application binary blob |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 114 | |
| 115 | #. Close ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt`` |
| 116 | #. Unmount/eject the ``<MPS2 device name>`` unit |
| 117 | #. Reset the board to execute the TF-M example application |
| 118 | #. After completing the procedure you should be able to visualize on the serial |
| 119 | port (baud 115200 8n1) the following messages:: |
| 120 | |
| 121 | [INF] Starting bootloader |
| 122 | [INF] Image 0: magic=good, copy_done=0xff, image_ok=0xff |
| 123 | [INF] Scratch: magic=bad, copy_done=0x5, image_ok=0xcf |
David Vincze | 8bdfc2d | 2019-03-18 15:49:23 +0100 | [diff] [blame] | 124 | [INF] Boot source: primary slot |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 125 | [INF] Swap type: none |
| 126 | [INF] Bootloader chainload address offset: 0x80000 |
| 127 | [INF] Jumping to the first image slot |
| 128 | [Sec Thread] Secure image initializing! |
| 129 | |
| 130 | Regression tests |
| 131 | ---------------- |
| 132 | After completing the procedure you should be able to visualize on the serial |
| 133 | port (baud 115200 8n1) the following messages:: |
| 134 | |
| 135 | [INF] Starting bootloader |
| 136 | [INF] Image 0: magic=good, copy_done=0xff, image_ok=0xff |
| 137 | [INF] Scratch: magic=bad, copy_done=0x5, image_ok=0xcf |
David Vincze | 8bdfc2d | 2019-03-18 15:49:23 +0100 | [diff] [blame] | 138 | [INF] Boot source: primary slot |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 139 | [INF] Swap type: none |
| 140 | [INF] Bootloader chainload address offset: 0x80000 |
| 141 | [INF] Jumping to the first image slot |
| 142 | [Sec Thread] Secure image initializing! |
Jamie Fox | b8a9270 | 2019-06-05 17:19:31 +0100 | [diff] [blame] | 143 | |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 144 | #### Execute test suites for the protected storage service #### |
| 145 | Running Test Suite PS secure interface tests (TFM_PS_TEST_2XXX)... |
Jamie Fox | b8a9270 | 2019-06-05 17:19:31 +0100 | [diff] [blame] | 146 | |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 147 | > Executing 'TFM_PS_TEST_2001' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 148 | Description: 'Create interface' |
| 149 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 150 | > Executing 'TFM_PS_TEST_2002' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 151 | Description: 'Get handle interface (DEPRECATED)' |
| 152 | This test is DEPRECATED and the test execution was SKIPPED |
| 153 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 154 | > Executing 'TFM_PS_TEST_2003' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 155 | Description: 'Get handle with null handle pointer (DEPRECATED)' |
| 156 | This test is DEPRECATED and the test execution was SKIPPED |
| 157 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 158 | > Executing 'TFM_PS_TEST_2004' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 159 | Description: 'Write interface' |
| 160 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 161 | > Executing 'TFM_PS_TEST_2005' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 162 | Description: 'Read interface' |
| 163 | .... |
| 164 | |
| 165 | .. Note:: |
| 166 | |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 167 | PS reliability tests take a few minutes to run on the MPS2. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 168 | |
| 169 | Example application without BL2 bootloader |
| 170 | ------------------------------------------ |
| 171 | #. Copy ``tfm_s.bin`` and ``tfm_ns.bin`` files from |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 172 | ``<build_dir>/bin`` to |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 173 | ``<MPS2 device name>/SOFTWARE/`` |
| 174 | #. Open ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt`` |
| 175 | #. Update the ``AN521/images.txt`` file as follows:: |
| 176 | |
| 177 | TITLE: Versatile Express Images Configuration File |
| 178 | [IMAGES] |
| 179 | TOTALIMAGES: 2 ;Number of Images (Max: 32) |
| 180 | IMAGE0ADDRESS: 0x10000000 |
| 181 | IMAGE0FILE: \Software\tfm_s.bin ; Secure code |
| 182 | IMAGE1ADDRESS: 0x00100000 |
| 183 | IMAGE1FILE: \Software\tfm_ns.bin ; Non-secure code |
| 184 | |
| 185 | #. Close ``<MPS2 device name>/MB/HBI0263C/AN521/images.txt`` |
| 186 | #. Unmount/eject the ``<MPS2 device name>`` unit |
| 187 | #. Reset the board to execute the TF-M example application |
| 188 | #. After completing the procedure you should be able to visualize on the serial |
| 189 | port (baud 115200 8n1) the following messages:: |
| 190 | |
| 191 | [Sec Thread] Secure image initializing! |
| 192 | |
| 193 | Regression tests without BL2 bootloader |
| 194 | --------------------------------------- |
| 195 | After completing the procedure you should be able to visualize on the serial |
| 196 | port (baud 115200 8n1) the following messages:: |
| 197 | |
| 198 | [Sec Thread] Secure image initializing! |
Jamie Fox | b8a9270 | 2019-06-05 17:19:31 +0100 | [diff] [blame] | 199 | |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 200 | #### Execute test suites for the protected storage service #### |
| 201 | Running Test Suite PS secure interface tests (TFM_PS_TEST_2XXX)... |
Jamie Fox | b8a9270 | 2019-06-05 17:19:31 +0100 | [diff] [blame] | 202 | |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 203 | > Executing 'TFM_PS_TEST_2001' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 204 | Description: 'Create interface' |
| 205 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 206 | > Executing 'TFM_PS_TEST_2002' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 207 | Description: 'Get handle interface (DEPRECATED)' |
| 208 | This test is DEPRECATED and the test execution was SKIPPED |
| 209 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 210 | > Executing 'TFM_PS_TEST_2003' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 211 | Description: 'Get handle with null handle pointer (DEPRECATED)' |
| 212 | This test is DEPRECATED and the test execution was SKIPPED |
| 213 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 214 | > Executing 'TFM_PS_TEST_2004' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 215 | Description: 'Write interface' |
| 216 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 217 | > Executing 'TFM_PS_TEST_2005' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 218 | Description: 'Read interface' |
| 219 | .... |
| 220 | |
| 221 | ******************************************************************* |
| 222 | Execute TF-M example and regression tests on Musca test chip boards |
| 223 | ******************************************************************* |
| 224 | .. Note:: |
| 225 | |
| 226 | Before executing any images on Musca-B1 board, please check the |
Summer Qin | 2de23d0 | 2021-05-14 13:44:14 +0800 | [diff] [blame] | 227 | :doc:`target platform readme </platform/ext/target/arm/musca_b1/sse_200/readme>` |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 228 | to have the correct setup. |
| 229 | |
| 230 | Example application with BL2 bootloader |
| 231 | ======================================= |
| 232 | |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 233 | #. Create a unified hex file comprising of both ``bl2.bin`` and |
| 234 | ``tfm_s_ns_signed.bin``. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 235 | |
Jamie Fox | b5215c3 | 2019-06-05 17:39:39 +0100 | [diff] [blame] | 236 | - For Musca-B1 |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 237 | |
Jamie Fox | b5215c3 | 2019-06-05 17:39:39 +0100 | [diff] [blame] | 238 | - Windows:: |
Jamie Fox | b8a9270 | 2019-06-05 17:19:31 +0100 | [diff] [blame] | 239 | |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 240 | srec_cat.exe bin\bl2.bin -Binary -offset 0xA000000 bin\tfm_s_ns_signed.bin -Binary -offset 0xA020000 -o tfm.hex -Intel |
Jamie Fox | b8a9270 | 2019-06-05 17:19:31 +0100 | [diff] [blame] | 241 | |
Jamie Fox | b5215c3 | 2019-06-05 17:39:39 +0100 | [diff] [blame] | 242 | - Linux:: |
Jamie Fox | b8a9270 | 2019-06-05 17:19:31 +0100 | [diff] [blame] | 243 | |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 244 | srec_cat bin/bl2.bin -Binary -offset 0xA000000 bin/tfm_s_ns_signed.bin -Binary -offset 0xA020000 -o tfm.hex -Intel |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 245 | |
Marton Berke | 8aae06f | 2019-11-25 16:46:12 +0100 | [diff] [blame] | 246 | - For Musca-S1 |
| 247 | |
| 248 | - Windows:: |
| 249 | |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 250 | srec_cat.exe bin\bl2.bin -Binary -offset 0xA000000 bin\tfm_s_ns_signed.bin -Binary -offset 0xA020000 -o tfm.hex -Intel |
Marton Berke | 8aae06f | 2019-11-25 16:46:12 +0100 | [diff] [blame] | 251 | |
| 252 | - Linux:: |
| 253 | |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 254 | srec_cat bin/bl2.bin -Binary -offset 0xA000000 bin/tfm_s_ns_signed.bin -Binary -offset 0xA020000 -o tfm.hex -Intel |
Marton Berke | 8aae06f | 2019-11-25 16:46:12 +0100 | [diff] [blame] | 255 | |
Jamie Fox | b5215c3 | 2019-06-05 17:39:39 +0100 | [diff] [blame] | 256 | #. 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 Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 265 | |
| 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 Vincze | 8bdfc2d | 2019-03-18 15:49:23 +0100 | [diff] [blame] | 269 | [INF] Boot source: primary slot |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 270 | [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 | |
| 275 | Regression tests with BL2 bootloader |
| 276 | ==================================== |
Jamie Fox | 14d7529 | 2020-07-03 12:52:29 +0100 | [diff] [blame] | 277 | .. 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 Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 293 | After completing the procedure you should see the following messages on the |
Jamie Fox | b5215c3 | 2019-06-05 17:39:39 +0100 | [diff] [blame] | 294 | DAPLink UART (baud 115200 8n1):: |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 295 | |
| 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 Vincze | 8bdfc2d | 2019-03-18 15:49:23 +0100 | [diff] [blame] | 299 | [INF] Boot source: primary slot |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 300 | [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 Fox | b8a9270 | 2019-06-05 17:19:31 +0100 | [diff] [blame] | 304 | |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 305 | #### 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 Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 308 | Description: 'Create interface' |
| 309 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 310 | > Executing 'TFM_PS_TEST_2002' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 311 | Description: 'Get handle interface (DEPRECATED)' |
| 312 | This test is DEPRECATED and the test execution was SKIPPED |
| 313 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 314 | > Executing 'TFM_PS_TEST_2003' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 315 | Description: 'Get handle with null handle pointer (DEPRECATED)' |
| 316 | This test is DEPRECATED and the test execution was SKIPPED |
| 317 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 318 | > Executing 'TFM_PS_TEST_2004' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 319 | Description: 'Get attributes interface' |
| 320 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 321 | > Executing 'TFM_PS_TEST_2005' |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 322 | Description: 'Get attributes with null attributes struct pointer' |
| 323 | .... |
| 324 | |
Jamie Fox | 19c91c2 | 2019-02-10 18:04:58 +0000 | [diff] [blame] | 325 | PSA API tests |
| 326 | ============= |
| 327 | Follow the build instructions for the PSA API tests and then follow the above |
| 328 | procedures for flashing the image to the board. The PSA API tests are linked |
| 329 | into the TF-M binaries and will automatically run. A log similar to the |
| 330 | following should be visible on the UART; it is normal for some tests to be |
| 331 | skipped 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 |
Minos Galanakis | b00faed | 2021-03-11 10:11:34 +0000 | [diff] [blame] | 391 | of the flash (``0xFF``). |
Jamie Fox | 19c91c2 | 2019-02-10 18:04:58 +0000 | [diff] [blame] | 392 | |
| 393 | Refer to the platform flash layout for appropriate addresses to erase on |
| 394 | other platforms. |
| 395 | |
| 396 | This step is not required on targets that emulate flash storage in RAM, as |
| 397 | it will be erased each time the device is reset. Note, however, that a warm |
| 398 | reset may not clear SRAM contents, so it may be necessary to power the |
| 399 | device off and on again between test runs. |
| 400 | |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 401 | Example application or regression tests on Musca-B1 without BL2 bootloader |
| 402 | ========================================================================== |
| 403 | |
| 404 | Follow the above procedures, but create a unified hex file out of ``tfm_s.bin`` |
| 405 | and ``tfm_ns.bin``: |
| 406 | |
| 407 | - Windows:: |
| 408 | |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 409 | srec_cat.exe bin\tfm_s.bin -Binary -offset 0xA000000 bin\tfm_ns.bin -Binary -offset 0xA080000 -o tfm.hex -Intel |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 410 | |
| 411 | - Linux:: |
| 412 | |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 413 | srec_cat bin/tfm_s.bin -Binary -offset 0xA000000 bin/tfm_ns.bin -Binary -offset 0xA080000 -o tfm.hex -Intel |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 414 | |
Mark Horvath | 8dcc383 | 2020-08-07 15:10:52 +0200 | [diff] [blame] | 415 | Example application or regression tests on Musca-B1 using the Secure Enclave |
| 416 | ============================================================================ |
| 417 | |
| 418 | Follow the above procedures, but to create a unified hex please check the |
Summer Qin | 2de23d0 | 2021-05-14 13:44:14 +0800 | [diff] [blame] | 419 | :doc:`Musca-B1 Secure Enclave readme </platform/ext/target/arm/musca_b1/secure_enclave/readme>`. |
Mark Horvath | 8dcc383 | 2020-08-07 15:10:52 +0200 | [diff] [blame] | 420 | |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 421 | ******************************************************** |
| 422 | Execute TF-M example and regression tests on MPS3 boards |
| 423 | ******************************************************** |
| 424 | |
| 425 | To run the example code on CoreLink SSE-200 Subsystem for MPS3 (AN524) |
| 426 | ====================================================================== |
| 427 | FPGA image is available to download `here <https://www.arm.com/products/development-tools/development-boards/mps3>`__ |
| 428 | |
| 429 | To run BL2 bootloader and TF-M example application and tests in the MPS3 board, |
| 430 | it is required to have SMM-SSE-200 for MPS3 (AN524) image in the MPS3 board |
| 431 | SD card. The image should be located in |
| 432 | ``<MPS3 device name>/MB/HBI<BoardNumberBoardrevision>/AN524`` |
| 433 | |
| 434 | And the current boot memory for AN524 is QSPI flash, so you need to set the |
| 435 | correct REMAP option in |
| 436 | ``<MPS3 device name>/MB/HBI<BoardNumberBoardrevision>/AN524/an524_v1.txt`` |
| 437 | |
| 438 | :: |
| 439 | |
| 440 | REMAP: QSPI ;REMAP boot device BRAM/QSPI. Must match REMAPVAL below. |
| 441 | REMAPVAL: 1 ;REMAP register value e.g. 0-BRAM. 1-QSPI |
| 442 | |
| 443 | The MPS3 board tested is HBI0309B. |
| 444 | |
| 445 | .. Note:: |
| 446 | If you change the exe names, MPS3 expects file names in 8.3 format. |
| 447 | |
| 448 | Example application |
| 449 | ------------------- |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 450 | #. Copy ``bl2.bin`` and ``tfm_s_ns_signed.bin`` files from |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 451 | build dir to ``<MPS3 device name>/SOFTWARE/`` |
| 452 | #. Open ``<MPS3 device name>/MB/HBI0309B/AN524/images.txt`` |
| 453 | #. Update the ``images.txt`` file as follows:: |
| 454 | |
| 455 | TITLE: Arm MPS3 FPGA prototyping board Images Configuration File |
| 456 | |
| 457 | [IMAGES] |
| 458 | TOTALIMAGES: 2 ;Number of Images (Max: 32) |
| 459 | |
| 460 | IMAGE0UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE |
| 461 | IMAGE0ADDRESS: 0x00000000 ;Please select the required executable program |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 462 | IMAGE0FILE: \SOFTWARE\bl2.bin |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 463 | IMAGE1UPDATE: AUTO |
| 464 | IMAGE1ADDRESS: 0x00040000 |
Raef Coles | 1ecb813 | 2020-10-02 15:11:24 +0100 | [diff] [blame] | 465 | IMAGE1FILE: \SOFTWARE\tfm_s_ns_signed.bin |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 466 | |
| 467 | #. Close ``<MPS3 device name>/MB/HBI0309B/AN524/images.txt`` |
| 468 | #. Unmount/eject the ``<MPS3 device name>`` unit |
| 469 | #. Reset the board to execute the TF-M example application |
| 470 | #. After completing the procedure you should be able to visualize on the serial |
| 471 | port (baud 115200 8n1) the following messages:: |
| 472 | |
| 473 | [INF] Starting bootloader |
| 474 | [INF] Image 0: magic= good, copy_done=0xff, image_ok=0xff |
| 475 | [INF] Scratch: magic=unset, copy_done=0x43, image_ok=0xff |
| 476 | [INF] Boot source: slot 0 |
| 477 | [INF] Swap type: none |
| 478 | [INF] Bootloader chainload address offset: 0x40000 |
| 479 | [INF] Jumping to the first image slot |
| 480 | [Sec Thread] Secure image initializing! |
| 481 | |
| 482 | Regression tests |
| 483 | ---------------- |
| 484 | After completing the procedure you should be able to visualize on the serial |
| 485 | port (baud 115200 8n1) the following messages:: |
| 486 | |
| 487 | [INF] Starting bootloader |
| 488 | [INF] Image 0: magic= good, copy_done=0xff, image_ok=0xff |
| 489 | [INF] Scratch: magic=unset, copy_done=0x9, image_ok=0xff |
| 490 | [INF] Boot source: slot 0 |
| 491 | [INF] Swap type: none |
| 492 | [INF] Bootloader chainload address offset: 0x40000 |
| 493 | [INF] Jumping to the first image slot |
| 494 | [Sec Thread] Secure image initializing! |
| 495 | |
| 496 | #### Execute test suites for the Secure area #### |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 497 | Running Test Suite PSA protected storage S interface tests (TFM_PS_TEST_2XXX)... |
| 498 | > Executing 'TFM_PS_TEST_2001' |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 499 | Description: 'Set interface' |
| 500 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 501 | > Executing 'TFM_PS_TEST_2002' |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 502 | Description: 'Set interface with create flags' |
| 503 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 504 | > Executing 'TFM_PS_TEST_2003' |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 505 | Description: 'Set interface with NULL data pointer' |
| 506 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 507 | > Executing 'TFM_PS_TEST_2004' |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 508 | Description: 'Set interface with invalid data length' |
| 509 | TEST PASSED! |
| 510 | .... |
| 511 | |
| 512 | .. Note:: |
| 513 | Some of the attestation tests take a few minutes to run on the MPS3. |
| 514 | |
| 515 | Example application without BL2 bootloader |
| 516 | ------------------------------------------ |
| 517 | #. Copy ``tfm_s.bin`` and ``tfm_ns.bin`` files from |
| 518 | build dir to ``<MPS3 device name>/SOFTWARE/`` |
| 519 | #. Open ``<MPS3 device name>/MB/HBI0309B/AN524/images.txt`` |
| 520 | #. Update the ``images.txt`` file as follows:: |
| 521 | |
| 522 | TITLE: Arm MPS3 FPGA prototyping board Images Configuration File |
| 523 | |
| 524 | [IMAGES] |
| 525 | TOTALIMAGES: 2 ;Number of Images (Max: 32) |
| 526 | |
| 527 | IMAGE0UPDATE: AUTO ;Image Update:NONE/AUTO/FORCE |
| 528 | IMAGE0ADDRESS: 0x00000000 ;Please select the required executable program |
| 529 | IMAGE0FILE: \SOFTWARE\tfm_s.bin |
| 530 | IMAGE1UPDATE: AUTO |
Mingyang Sun | d3db85d | 2020-03-20 16:23:53 +0800 | [diff] [blame] | 531 | IMAGE1ADDRESS: 0x000C0000 |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 532 | IMAGE1FILE: \SOFTWARE\tfm_ns.bin |
| 533 | |
| 534 | #. Close ``<MPS3 device name>/MB/HBI0309B/AN521/images.txt`` |
| 535 | #. Unmount/eject the ``<MPS3 device name>`` unit |
| 536 | #. Reset the board to execute the TF-M example application |
| 537 | #. After completing the procedure you should be able to visualize on the serial |
| 538 | port (baud 115200 8n1) the following messages:: |
| 539 | |
| 540 | [Sec Thread] Secure image initializing! |
| 541 | |
| 542 | Regression tests without BL2 bootloader |
| 543 | --------------------------------------- |
| 544 | After completing the procedure you should be able to visualize on the serial |
| 545 | port (baud 115200 8n1) the following messages:: |
| 546 | |
| 547 | [Sec Thread] Secure image initializing! |
| 548 | |
| 549 | #### Execute test suites for the Secure area #### |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 550 | Running Test Suite PSA protected storage S interface tests (TFM_PS_TEST_2XXX)... |
| 551 | > Executing 'TFM_PS_TEST_2001' |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 552 | Description: 'Set interface' |
| 553 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 554 | > Executing 'TFM_PS_TEST_2002' |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 555 | Description: 'Set interface with create flags' |
| 556 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 557 | > Executing 'TFM_PS_TEST_2003' |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 558 | Description: 'Set interface with NULL data pointer' |
| 559 | TEST PASSED! |
Kevin Peng | c6d7450 | 2020-03-04 16:55:37 +0800 | [diff] [blame] | 560 | > Executing 'TFM_PS_TEST_2004' |
Kevin Peng | 0a14211 | 2018-09-21 10:42:22 +0800 | [diff] [blame] | 561 | Description: 'Set interface with invalid data length' |
| 562 | TEST PASSED! |
| 563 | .... |
| 564 | |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 565 | Firmware upgrade and image validation with BL2 bootloader |
| 566 | ========================================================= |
| 567 | High level operation of BL2 bootloader and instructions for testing firmware |
Summer Qin | abf6698 | 2021-04-06 17:22:15 +0800 | [diff] [blame] | 568 | upgrade is described in :doc:`secure boot </docs/technical_references/tfm_secure_boot>`. |
Gyorgy Szing | db9783c | 2019-04-17 21:08:48 +0200 | [diff] [blame] | 569 | |
| 570 | -------------- |
| 571 | |
Minos Galanakis | 3b740a1 | 2020-10-15 11:10:26 +0100 | [diff] [blame] | 572 | .. _Arm Development Studio: https://developer.arm.com/tools-and-software/embedded/arm-development-studio |
| 573 | .. _Arm Development Studio Documentation: https://developer.arm.com/tools-and-software/embedded/arm-development-studio/learn/docs |
| 574 | .. _Fixed Virtual Platforms: https://developer.arm.com/tools-and-software/simulation-models/fixed-virtual-platforms |
| 575 | .. _Fixed Virtual Platforms Documentation: https://developer.arm.com/documentation/100966/latest |
| 576 | .. _Keil MDK: http://www2.keil.com/mdk5 |
| 577 | .. _Keil MDK Documentation: https://www2.keil.com/mdk5/docs |
| 578 | |
Summer Qin | abf6698 | 2021-04-06 17:22:15 +0800 | [diff] [blame] | 579 | *Copyright (c) 2017-2021, Arm Limited. All rights reserved.* |