Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | Trusted Firmware-A Tests - User Guide |
| 2 | ===================================== |
| 3 | |
| 4 | .. section-numbering:: |
| 5 | :suffix: . |
| 6 | |
| 7 | .. contents:: |
| 8 | |
| 9 | This document describes how to build the Trusted Firmware-A Tests (TF-A Tests) |
| 10 | and run them on a set of platforms. It assumes that the reader has previous |
| 11 | experience building and running the `Trusted Firmware-A (TF-A)`_. |
| 12 | |
| 13 | Host machine requirements |
| 14 | ------------------------- |
| 15 | |
| 16 | The minimum recommended machine specification for building the software and |
| 17 | running the `FVP models`_ is a dual-core processor running at 2GHz with 12GB of |
| 18 | RAM. For best performance, use a machine with a quad-core processor running at |
| 19 | 2.6GHz with 16GB of RAM. |
| 20 | |
| 21 | The software has been tested on Ubuntu 16.04 LTS (64-bit). Packages used for |
| 22 | building the software were installed from that distribution unless otherwise |
| 23 | specified. |
| 24 | |
| 25 | Tools |
| 26 | ----- |
| 27 | |
| 28 | Install the required packages to build TF-A Tests with the following command: |
| 29 | |
| 30 | :: |
| 31 | |
Antonio Nino Diaz | 0c697f9 | 2018-11-30 10:51:26 +0000 | [diff] [blame] | 32 | sudo apt-get install device-tree-compiler build-essential make git perl libxml-libxml-perl |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 33 | |
| 34 | Download and install the GNU cross-toolchain from Linaro. The TF-A Tests have |
| 35 | been tested with version 6.2-2016.11 (gcc 6.2): |
| 36 | |
| 37 | - `AArch32 GNU cross-toolchain`_ |
| 38 | - `AArch64 GNU cross-toolchain`_ |
| 39 | |
| 40 | In addition, the following optional packages and tools may be needed: |
| 41 | |
| 42 | - For debugging, Arm `Development Studio 5 (DS-5)`_. |
| 43 | |
| 44 | Getting the TF-A Tests source code |
| 45 | ---------------------------------- |
| 46 | |
| 47 | Download the TF-A Tests source code using the following command: |
| 48 | |
| 49 | :: |
| 50 | |
Sandrine Bailleux | 2d0136e | 2018-11-05 14:21:27 +0100 | [diff] [blame] | 51 | git clone https://git.trustedfirmware.org/TF-A/tf-a-tests.git |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 52 | |
| 53 | Building TF-A Tests |
| 54 | ------------------- |
| 55 | |
| 56 | - Before building TF-A Tests, the environment variable ``CROSS_COMPILE`` must |
| 57 | point to the Linaro cross compiler. |
| 58 | |
| 59 | For AArch64: |
| 60 | |
| 61 | :: |
| 62 | |
| 63 | export CROSS_COMPILE=<path-to-aarch64-gcc>/bin/aarch64-linux-gnu- |
| 64 | |
| 65 | For AArch32: |
| 66 | |
| 67 | :: |
| 68 | |
| 69 | export CROSS_COMPILE=<path-to-aarch32-gcc>/bin/arm-linux-gnueabihf- |
| 70 | |
| 71 | - Change to the root directory of the TF-A Tests source tree and build. |
| 72 | |
| 73 | For AArch64: |
| 74 | |
| 75 | :: |
| 76 | |
| 77 | make PLAT=<platform> |
| 78 | |
| 79 | For AArch32: |
| 80 | |
| 81 | :: |
| 82 | |
| 83 | make PLAT=<platform> ARCH=aarch32 |
| 84 | |
| 85 | Notes: |
| 86 | |
| 87 | - If ``PLAT`` is not specified, ``fvp`` is assumed by default. See the |
| 88 | `Summary of build options`_ for more information on available build |
| 89 | options. |
| 90 | |
| 91 | - By default this produces a release version of the build. To produce a |
| 92 | debug version instead, build the code with ``DEBUG=1``. |
| 93 | |
| 94 | - The build process creates products in a ``build/`` directory tree, |
| 95 | building the objects and binaries for each test image in separate |
| 96 | sub-directories. The following binary files are created from the |
| 97 | corresponding ELF files: |
| 98 | |
| 99 | - ``build/<platform>/<build-type>/tftf.bin`` |
| 100 | - ``build/<platform>/<build-type>/ns_bl1u.bin`` |
| 101 | - ``build/<platform>/<build-type>/ns_bl2u.bin`` |
| 102 | - ``build/<platform>/<build-type>/el3_payload.bin`` |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 103 | - ``build/<platform>/<build-type>/cactus_mm.bin`` |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 104 | - ``build/<platform>/<build-type>/cactus.bin`` |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 105 | - ``build/<platform>/<build-type>/ivy.bin`` |
Antonio Nino Diaz | fee6e7e | 2019-03-28 13:16:04 +0000 | [diff] [blame] | 106 | - ``build/<platform>/<build-type>/quark.bin`` |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 107 | |
| 108 | where ``<platform>`` is the name of the chosen platform and ``<build-type>`` |
| 109 | is either ``debug`` or ``release``. The actual number of images might differ |
| 110 | depending on the platform. |
| 111 | |
| 112 | Refer to the sections below for more information about each image. |
| 113 | |
| 114 | - Build products for a specific build variant can be removed using: |
| 115 | |
| 116 | :: |
| 117 | |
| 118 | make DEBUG=<D> PLAT=<platform> clean |
| 119 | |
| 120 | ... where ``<D>`` is ``0`` or ``1``, as specified when building. |
| 121 | |
| 122 | The build tree can be removed completely using: |
| 123 | |
| 124 | :: |
| 125 | |
| 126 | make realclean |
| 127 | |
| 128 | - Use the following command to list all supported build commands: |
| 129 | |
| 130 | :: |
| 131 | |
| 132 | make help |
| 133 | |
| 134 | TFTF test image |
| 135 | ``````````````` |
| 136 | |
| 137 | ``tftf.bin`` is the main test image to exercise the TF-A features. The other |
| 138 | test images provided in this repository are optional dependencies that TFTF |
| 139 | needs to test some specific features. |
| 140 | |
| 141 | ``tftf.bin`` may be built independently of the other test images using the |
| 142 | following command: |
| 143 | |
| 144 | :: |
| 145 | |
| 146 | make PLAT=<platform> tftf |
| 147 | |
| 148 | In TF-A boot flow, ``tftf.bin`` replaces the ``BL33`` image and should be |
| 149 | injected in the FIP image. This might be achieved by running the following |
| 150 | command from the TF-A root directory: |
| 151 | |
| 152 | :: |
| 153 | |
| 154 | BL33=tftf.bin make PLAT=<platform> fip |
| 155 | |
| 156 | Please refer to the `TF-A User guide`_ for further details. |
| 157 | |
| 158 | NS_BL1U and NS_BL2U test images |
| 159 | ``````````````````````````````` |
| 160 | |
| 161 | ``ns_bl1u.bin`` and ``ns_bl2u.bin`` are test images that exercise the `Firmware |
| 162 | Update`_ (FWU) feature of TF-A [#]_. Throughout this document, they will be |
| 163 | referred as the `FWU test images`. |
| 164 | |
| 165 | In addition to updating the firmware, the FWU test images also embed some tests |
| 166 | that exercise the `FWU state machine`_ implemented in the TF-A. They send valid |
| 167 | and invalid SMC requests to the TF-A BL1 image in order to test its robustness. |
| 168 | |
| 169 | NS_BL1U test image |
| 170 | '''''''''''''''''' |
| 171 | |
| 172 | The ``NS_BL1U`` image acts as the `Application Processor (AP) Firmware Update |
| 173 | Boot ROM`. This typically is the first software agent executing on the AP in the |
| 174 | Normal World during a firmware update operation. Its primary purpose is to load |
| 175 | subsequent firmware update images from an external interface, such as NOR Flash, |
| 176 | and communicate with ``BL1`` to authenticate those images. |
| 177 | |
| 178 | The ``NS_BL1U`` test image provided in this repository performs the following |
| 179 | tasks: |
| 180 | |
| 181 | - Load FWU images from external non-volatile storage (typically flash memory) |
| 182 | to Non-Secure RAM. |
| 183 | |
| 184 | - Request TF-A BL1 to copy these images in Secure RAM and authenticate them. |
| 185 | |
| 186 | - Jump to ``NS_BL2U`` which carries out the next steps in the firmware update |
| 187 | process. |
| 188 | |
| 189 | This image may be built independently of the other test images using the |
| 190 | following command: |
| 191 | |
| 192 | :: |
| 193 | |
| 194 | make PLAT=<platform> ns_bl1u |
| 195 | |
| 196 | NS_BL2U test image |
| 197 | '''''''''''''''''' |
| 198 | |
| 199 | The ``NS_BL2U`` image acts as the `AP Firmware Updater`. Its primary |
| 200 | responsibility is to load a new set of firmware images from an external |
| 201 | interface and write them into non-volatile storage. |
| 202 | |
| 203 | The ``NS_BL2U`` test image provided in this repository overrides the original |
| 204 | FIP image stored in flash with the backup FIP image (see below). |
| 205 | |
| 206 | This image may be built independently of the other test images using the |
| 207 | following command: |
| 208 | |
| 209 | :: |
| 210 | |
| 211 | make PLAT=<platform> ns_bl2u |
| 212 | |
| 213 | Putting it all together |
| 214 | ''''''''''''''''''''''' |
| 215 | |
| 216 | The FWU test images should be used in conjunction with the TFTF image, as the |
| 217 | latter initiates the FWU process by corrupting the FIP image and resetting the |
| 218 | target. Once the FWU process is complete, TFTF takes over again and checks that |
| 219 | the firmware was successfully updated. |
| 220 | |
| 221 | To sum up, 3 images must be built out of the TF-A Tests repository in order to |
| 222 | test the TF-A Firmware Update feature: |
| 223 | |
John Tsichritzis | 4586e0d | 2018-10-18 10:00:28 +0100 | [diff] [blame] | 224 | - ``ns_bl1u.bin`` |
| 225 | - ``ns_bl2u.bin`` |
| 226 | - ``tftf.bin`` |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 227 | |
| 228 | Once that's done, they must be combined in the right way. |
| 229 | |
John Tsichritzis | 4586e0d | 2018-10-18 10:00:28 +0100 | [diff] [blame] | 230 | - ``ns_bl1u.bin`` is a standalone image and does not require any further |
| 231 | processing. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 232 | |
John Tsichritzis | 4586e0d | 2018-10-18 10:00:28 +0100 | [diff] [blame] | 233 | - ``ns_bl2u.bin`` must be injected into the ``FWU_FIP`` image. This might be |
| 234 | achieved by setting ``NS_BL2U=ns_bl2u.bin`` when building the ``FWU_FIP`` |
| 235 | image out of the TF-A repository. Please refer to the section `Building FIP |
| 236 | images with support for Trusted Board Boot`_ in the TF-A User Guide. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 237 | |
John Tsichritzis | 4586e0d | 2018-10-18 10:00:28 +0100 | [diff] [blame] | 238 | - ``tftf.bin`` must be injected in the standard FIP image, as explained |
| 239 | in section `TFTF test image`_. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 240 | |
| 241 | Additionally, on Juno platform, the FWU FIP must contain a ``SCP_BL2U`` image. |
| 242 | This image can simply be a copy of the standard ``SCP_BL2`` image if no specific |
| 243 | firmware update operations need to be carried on the SCP side. |
| 244 | |
| 245 | Finally, the backup FIP image must be created. This can simply be a copy of the |
| 246 | standard FIP image, which means that the Firmware Update process will restore |
| 247 | the original, uncorrupted FIP image. |
| 248 | |
| 249 | EL3 test payload |
| 250 | ```````````````` |
| 251 | |
| 252 | ``el3_payload.bin`` is a test image exercising the alternative `EL3 payload boot |
| 253 | flow`_ in TF-A. Refer to the `EL3 test payload README file`_ for more details |
| 254 | about its behaviour and how to build and run it. |
| 255 | |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 256 | SPM test images |
| 257 | ``````````````` |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 258 | |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 259 | This repository contains 3 Secure Partitions that exercise the `Secure Partition |
| 260 | Manager`_ (SPM) in TF-A [#]_. Cactus-MM is designed to test the SPM |
| 261 | implementation based on the `ARM Management Mode Interface`_ (MM), while Cactus |
| 262 | and Ivy can test the SPM implementation based on the SPCI and SPRT draft |
| 263 | specifications. Note that it isn't possible to use both communication mechanisms |
| 264 | at once: If Cactus-MM is used Cactus and Ivy can't be used. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 265 | |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 266 | They run in Secure-EL0 and perform the following tasks: |
| 267 | |
| 268 | - Test that TF-A has correctly setup the secure partition environment: They |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 269 | should be allowed to perform cache maintenance operations, access floating |
| 270 | point registers, etc. |
| 271 | |
| 272 | - Test that TF-A accepts to change data access permissions and instruction |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 273 | permissions on behalf of the Secure Partitions for memory regions the latter |
| 274 | owns. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 275 | |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 276 | - Test communication with SPM through either MM, or both SPCI and SPRT. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 277 | |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 278 | They are only supported on AArch64 FVP. They can be built independently of the |
| 279 | other test images using the following command: |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 280 | |
| 281 | :: |
| 282 | |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 283 | make PLAT=fvp cactus ivy cactus_mm |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 284 | |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 285 | In the TF-A boot flow, the partitions replace the ``BL32`` image and should be |
| 286 | injected in the FIP image. To test SPM-MM with Cactus-MM, it is enough to use |
| 287 | ``cactus_mm.bin`` as BL32 image. To test the SPM based on SPCI and SPRT, it is |
| 288 | needed to use ``sp_tool`` to build a Secure Partition package that can be used |
| 289 | as BL32 image. |
| 290 | |
| 291 | To run the full set of tests in the Secure Partitions, they should be used in |
| 292 | conjunction with the TFTF image. |
| 293 | |
| 294 | For SPM-MM, the following commands can be used to build the tests: |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 295 | |
| 296 | :: |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 297 | # TF-A-Tests repository: |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 298 | |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 299 | make PLAT=fvp TESTS=spm-mm tftf cactus_mm |
| 300 | |
| 301 | # TF-A repository: |
| 302 | |
| 303 | make BL33=path/to/tftf.bin BL32=path/to/cactus_mm.bin \ |
| 304 | PLAT=fvp EL3_EXCEPTION_HANDLING=1 ENABLE_SPM=1 all fip |
| 305 | |
| 306 | For SPM based on SPCI and SPRT: |
| 307 | |
| 308 | :: |
| 309 | # TF-A-Tests repository: |
| 310 | |
| 311 | make PLAT=fvp TESTS=spm tftf cactus ivy |
| 312 | |
| 313 | # TF-A repository: |
| 314 | |
| 315 | make sptool |
| 316 | |
| 317 | tools/sptool/sptool -o sp_package.bin \ |
| 318 | -i path/to/cactus.bin:path/to/cactus.dtb \ |
| 319 | -i path/to/ivy.bin:path/to/ivy.dtb |
| 320 | |
| 321 | make BL33=path/to/tftf.bin BL32=path/to/sp_package.bin \ |
| 322 | PLAT=fvp ENABLE_SPM=1 SPM_MM=0 ARM_BL31_IN_DRAM=1 all fip |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 323 | |
| 324 | Please refer to the `TF-A User guide`_ for further details. |
| 325 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 326 | Summary of build options |
| 327 | ```````````````````````` |
| 328 | |
| 329 | As much as possible, TF-A Tests dynamically detect the platform hardware |
| 330 | components and available features. There are a few build options to select |
| 331 | specific features where the dynamic detection falls short. This section lists |
| 332 | them. |
| 333 | |
| 334 | Unless mentioned otherwise, these options are expected to be specified at the |
| 335 | build command line and are not to be modified in any component makefiles. |
| 336 | |
| 337 | Note that the build system doesn't track dependencies for build options. |
| 338 | Therefore, if any of the build options are changed from a previous build, a |
| 339 | clean build must be performed. |
| 340 | |
| 341 | Build options shared across test images |
| 342 | ''''''''''''''''''''''''''''''''''''''' |
| 343 | |
| 344 | Most of the build options listed in this section apply to TFTF, the FWU test |
| 345 | images and Cactus, unless otherwise specified. These do not influence the EL3 |
| 346 | payload, whose simplistic build system is mostly independent. |
| 347 | |
| 348 | - ``ARCH``: Choose the target build architecture for TF-A Tests. It can take |
| 349 | either ``aarch64`` or ``aarch32`` as values. By default, it is defined to |
| 350 | ``aarch64``. Not all test images support this build option. |
| 351 | |
| 352 | - ``ARM_ARCH_MAJOR``: The major version of Arm Architecture to target when |
| 353 | compiling TF-A Tests. Its value must be numeric, and defaults to 8. |
| 354 | |
| 355 | - ``ARM_ARCH_MINOR``: The minor version of Arm Architecture to target when |
| 356 | compiling TF-A Tests. Its value must be a numeric, and defaults to 0. |
| 357 | |
| 358 | - ``DEBUG``: Chooses between a debug and a release build. A debug build |
| 359 | typically embeds assertions checking the validity of some assumptions and its |
| 360 | output is more verbose. The option can take either 0 (release) or 1 (debug) |
| 361 | as values. 0 is the default. |
| 362 | |
| 363 | - ``ENABLE_ASSERTIONS``: This option controls whether calls to ``assert()`` are |
| 364 | compiled out. |
| 365 | |
John Tsichritzis | 4586e0d | 2018-10-18 10:00:28 +0100 | [diff] [blame] | 366 | - For debug builds, this option defaults to 1, and calls to ``assert()`` are |
| 367 | compiled in. |
| 368 | - For release builds, this option defaults to 0 and calls to ``assert()`` |
| 369 | are compiled out. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 370 | |
John Tsichritzis | 4586e0d | 2018-10-18 10:00:28 +0100 | [diff] [blame] | 371 | This option can be set independently of ``DEBUG``. It can also be used to |
| 372 | hide any auxiliary code that is only required for the assertion and does not |
| 373 | fit in the assertion itself. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 374 | |
| 375 | - ``LOG_LEVEL``: Chooses the log level, which controls the amount of console log |
| 376 | output compiled into the build. This should be one of the following: |
| 377 | |
| 378 | :: |
| 379 | |
| 380 | 0 (LOG_LEVEL_NONE) |
| 381 | 10 (LOG_LEVEL_ERROR) |
| 382 | 20 (LOG_LEVEL_NOTICE) |
| 383 | 30 (LOG_LEVEL_WARNING) |
| 384 | 40 (LOG_LEVEL_INFO) |
| 385 | 50 (LOG_LEVEL_VERBOSE) |
| 386 | |
| 387 | All log output up to and including the selected log level is compiled into |
| 388 | the build. The default value is 40 in debug builds and 20 in release builds. |
| 389 | |
| 390 | - ``PLAT``: Choose a platform to build TF-A Tests for. The chosen platform name |
| 391 | must be a subdirectory of any depth under ``plat/``, and must contain a |
| 392 | platform makefile named ``platform.mk``. For example, to build TF-A Tests for |
| 393 | the Arm Juno board, select ``PLAT=juno``. |
| 394 | |
| 395 | - ``V``: Verbose build. If assigned anything other than 0, the build commands |
| 396 | are printed. Default is 0. |
| 397 | |
| 398 | TFTF build options |
| 399 | '''''''''''''''''' |
| 400 | |
Antonio Nino Diaz | 2f13f42 | 2019-03-13 13:57:39 +0000 | [diff] [blame] | 401 | - ``ENABLE_PAUTH``: Boolean option to enable ARMv8.3 Pointer Authentication |
| 402 | (``ARMv8.3-PAuth``) support in the Trusted Firmware-A Test Framework itself. |
| 403 | If enabled, it is needed to use a compiler that supports the option |
Alexei Fedorov | e72ce61 | 2019-10-03 10:57:53 +0100 | [diff] [blame] | 404 | ``-mbranch-protection`` (GCC 9 and later). It defaults to 0. |
Antonio Nino Diaz | 2f13f42 | 2019-03-13 13:57:39 +0000 | [diff] [blame] | 405 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 406 | - ``NEW_TEST_SESSION``: Choose whether a new test session should be started |
| 407 | every time or whether the framework should determine whether a previous |
| 408 | session was interrupted and resume it. It can take either 1 (always |
| 409 | start new session) or 0 (resume session as appropriate). 1 is the default. |
| 410 | |
Sandrine Bailleux | 43ded0f | 2018-10-03 17:15:05 +0200 | [diff] [blame] | 411 | - ``TESTS``: Set of tests to run. Use the following command to list all |
| 412 | possible sets of tests: |
| 413 | |
| 414 | :: |
| 415 | |
| 416 | make help_tests |
| 417 | |
| 418 | If no set of tests is specified, the standard tests will be selected (see |
| 419 | ``tftf/tests/tests-standard.xml``). |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 420 | |
| 421 | - ``USE_NVM``: Used to select the location of test results. It can take either 0 |
| 422 | (RAM) or 1 (non-volatile memory like flash) as test results storage. Default |
| 423 | value is 0, as writing to the flash significantly slows tests down. |
| 424 | |
| 425 | FWU test images build options |
| 426 | ''''''''''''''''''''''''''''' |
| 427 | |
| 428 | - ``FIRMWARE_UPDATE``: Whether the Firmware Update test images (i.e. |
| 429 | ``NS_BL1U`` and ``NS_BL2U``) should be built. The default value is 0. The |
| 430 | platform makefile is free to override this value if Firmware Update is |
| 431 | supported on this platform. |
| 432 | |
| 433 | Checking source code style |
| 434 | -------------------------- |
| 435 | |
| 436 | When making changes to the source for submission to the project, the source must |
| 437 | be in compliance with the Linux style guide. To assist with this, the project |
| 438 | Makefile provides two targets, which both utilise the ``checkpatch.pl`` script |
| 439 | that ships with the Linux source tree. |
| 440 | |
| 441 | To check the entire source tree, you must first download copies of |
| 442 | ``checkpatch.pl``, ``spelling.txt`` and ``const_structs.checkpatch`` available |
| 443 | in the `Linux master tree`_ scripts directory, then set the ``CHECKPATCH`` |
| 444 | environment variable to point to ``checkpatch.pl`` (with the other 2 files in |
| 445 | the same directory). |
| 446 | |
| 447 | Then use the following command: |
| 448 | |
| 449 | :: |
| 450 | |
| 451 | make CHECKPATCH=<path-to-linux>/linux/scripts/checkpatch.pl checkcodebase |
| 452 | |
| 453 | To limit the coding style checks to your local changes, use: |
| 454 | |
| 455 | :: |
| 456 | |
| 457 | make CHECKPATCH=<path-to-linux>/linux/scripts/checkpatch.pl checkpatch |
| 458 | |
| 459 | By default, this will check all patches between ``origin/master`` and your local |
| 460 | branch. If you wish to use a different reference commit, this can be specified |
| 461 | using the ``BASE_COMMIT`` variable. |
| 462 | |
| 463 | Running the TF-A Tests |
| 464 | ---------------------- |
| 465 | |
| 466 | Refer to the sections `Running the software on FVP`_ and `Running the software |
| 467 | on Juno`_ in `TF-A User Guide`_. The same instructions mostly apply to run the |
| 468 | TF-A Tests on those 2 platforms. The difference is that the following images are |
| 469 | not needed here: |
| 470 | |
| 471 | - Normal World bootloader. The TFTF replaces it in the boot flow; |
| 472 | |
| 473 | - Linux Kernel; |
| 474 | |
| 475 | - Device tree; |
| 476 | |
| 477 | - Filesystem. |
| 478 | |
| 479 | In other words, only the following software images are needed: |
| 480 | |
| 481 | - ``BL1`` firmware image; |
| 482 | |
| 483 | - ``FIP`` image containing the following images: |
John Tsichritzis | 4586e0d | 2018-10-18 10:00:28 +0100 | [diff] [blame] | 484 | |
| 485 | - ``BL2``; |
| 486 | - ``SCP_BL2`` if required by the platform (e.g. Juno); |
| 487 | - ``BL31``; |
| 488 | - ``BL32`` (optional); |
| 489 | - ``tftf.bin`` (standing as the BL33 image). |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 490 | |
Joel Hutton | d18c45f | 2019-02-08 14:33:52 +0000 | [diff] [blame] | 491 | Running the manual tests on FVP |
| 492 | ``````````````````````````````` |
| 493 | The manual tests rely on storing state in non-volatile memory (NVM) across |
| 494 | reboot. On FVP the NVM is not persistent across reboots, so the following |
| 495 | flag must be used to write the NVM to a file when the model exits. |
| 496 | |
| 497 | :: |
Joel Hutton | d18c45f | 2019-02-08 14:33:52 +0000 | [diff] [blame] | 498 | -C bp.flashloader0.fnameWrite=[filename] |
| 499 | |
Joel Hutton | 941bec5 | 2019-03-22 16:40:33 +0000 | [diff] [blame] | 500 | To ensure the model exits on shutdown the following flag must be used: |
| 501 | |
| 502 | :: |
| 503 | -C bp.ve_sysregs.exit_on_shutdown=1 |
| 504 | |
Joel Hutton | d18c45f | 2019-02-08 14:33:52 +0000 | [diff] [blame] | 505 | After the model has been shutdown, this file must be fed back in to continue |
| 506 | the test. Note this flash file includes the FIP image, so the original fip.bin |
| 507 | does not need to be passed in. The following flag is used: |
| 508 | |
| 509 | :: |
| 510 | |
| 511 | -C bp.flashloader0.fname=[filename] |
| 512 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 513 | Running the FWU tests |
| 514 | ````````````````````` |
| 515 | |
| 516 | As previously mentioned in section `Putting it all together`_, there are a |
| 517 | couple of extra images involved when running the FWU tests. They need to be |
| 518 | loaded at the right addresses, which depend on the platform. |
| 519 | |
| 520 | FVP |
| 521 | ''' |
| 522 | |
| 523 | In addition to the usual BL1 and FIP images, the following extra images must be |
| 524 | loaded: |
| 525 | |
| 526 | - ``NS_BL1U`` image at address ``0x0BEB8000`` (i.e. NS_BL1U_BASE macro in TF-A) |
| 527 | - ``FWU_FIP`` image at address ``0x08400000`` (i.e. NS_BL2U_BASE macro in TF-A) |
| 528 | - ``Backup FIP`` image at address ``0x09000000`` (i.e. FIP_BKP_ADDRESS macro in |
| 529 | TF-A tests). |
| 530 | |
| 531 | An example script is provided in `scripts/run_fwu_fvp.sh`_. |
| 532 | |
| 533 | Juno |
| 534 | '''' |
| 535 | |
| 536 | The same set of extra images and load addresses apply for Juno as for FVP. |
| 537 | |
| 538 | The new images must be programmed in flash memory by adding some entries in the |
| 539 | ``SITE1/HBI0262x/images.txt`` configuration file on the Juno SD card (where |
| 540 | ``x`` depends on the revision of the Juno board). Refer to the `Juno Getting |
| 541 | Started Guide`_, section 2.3 "Flash memory programming" for more |
| 542 | information. Users should ensure these do not overlap with any other entries in |
| 543 | the file. |
| 544 | |
| 545 | Addresses in this file are expressed as an offset from the base address of the |
| 546 | flash (that is, ``0x08000000``). |
| 547 | |
| 548 | :: |
| 549 | |
| 550 | NOR10UPDATE: AUTO ; Image Update:NONE/AUTO/FORCE |
| 551 | NOR10ADDRESS: 0x00400000 ; Image Flash Address |
| 552 | NOR10FILE: \SOFTWARE\fwu_fip.bin ; Image File Name |
| 553 | NOR10LOAD: 00000000 ; Image Load Address |
| 554 | NOR10ENTRY: 00000000 ; Image Entry Point |
| 555 | |
| 556 | NOR11UPDATE: AUTO ; Image Update:NONE/AUTO/FORCE |
| 557 | NOR11ADDRESS: 0x03EB8000 ; Image Flash Address |
| 558 | NOR11FILE: \SOFTWARE\ns_bl1u.bin ; Image File Name |
| 559 | NOR11LOAD: 00000000 ; Image Load Address |
| 560 | NOR11ENTRY: 00000000 ; Image Load Address |
| 561 | |
| 562 | NOR12UPDATE: AUTO ; Image Update:NONE/AUTO/FORCE |
| 563 | NOR12ADDRESS: 0x01000000 ; Image Flash Address |
| 564 | NOR12FILE: \SOFTWARE\backup_fip.bin ; Image File Name |
| 565 | NOR12LOAD: 00000000 ; Image Load Address |
| 566 | NOR12ENTRY: 00000000 ; Image Entry Point |
| 567 | |
| 568 | -------------- |
| 569 | |
| 570 | .. [#] Therefore, the Trusted Board Boot feature must be enabled in TF-A for |
| 571 | the FWU test images to work. Please refer the `TF-A User guide`_ for |
| 572 | further details. |
| 573 | |
| 574 | .. [#] Therefore, the Secure Partition Manager must be enabled in TF-A for |
Antonio Nino Diaz | abb570e | 2019-03-25 13:13:57 +0000 | [diff] [blame] | 575 | any of the test Secure Partitions to work. Please refer to the `TF-A User |
| 576 | guide`_ for further details. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 577 | |
| 578 | -------------- |
| 579 | |
Joel Hutton | d18c45f | 2019-02-08 14:33:52 +0000 | [diff] [blame] | 580 | *Copyright (c) 2018-2019, Arm Limited. All rights reserved.* |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 581 | |
| 582 | .. _Development Studio 5 (DS-5): https://developer.arm.com/products/software-development-tools/ds-5-development-studio |
| 583 | |
| 584 | .. _FVP models: https://developer.arm.com/products/system-design/fixed-virtual-platforms |
| 585 | |
| 586 | .. _AArch32 GNU cross-toolchain: http://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/arm-linux-gnueabihf/gcc-linaro-6.2.1-2016.11-x86_64_arm-linux-gnueabihf.tar.xz |
| 587 | .. _AArch64 GNU cross-toolchain: http://releases.linaro.org/components/toolchain/binaries/6.2-2016.11/aarch64-linux-gnu/gcc-linaro-6.2.1-2016.11-x86_64_aarch64-linux-gnu.tar.xz |
| 588 | |
| 589 | .. _Linux master tree: https://github.com/torvalds/linux/tree/master/ |
| 590 | |
Sandrine Bailleux | b308d01 | 2019-04-10 09:30:10 +0200 | [diff] [blame] | 591 | .. _TF-A: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 592 | .. _Trusted Firmware-A (TF-A): TF-A_ |
Sandrine Bailleux | b308d01 | 2019-04-10 09:30:10 +0200 | [diff] [blame] | 593 | .. _EL3 payload boot flow: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/user-guide.rst#el3-payloads-alternative-boot-flow |
| 594 | .. _TF-A User Guide: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/user-guide.rst |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 595 | .. _Firmware Update: FWU_ |
Sandrine Bailleux | b308d01 | 2019-04-10 09:30:10 +0200 | [diff] [blame] | 596 | .. _FWU: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/firmware-update.rst |
| 597 | .. _FWU state machine: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/firmware-update.rst#fwu-state-machine |
| 598 | .. _Running the software on FVP: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/user-guide.rst#running-the-software-on-fvp |
| 599 | .. _Running the software on Juno: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/user-guide.rst#running-the-software-on-juno |
| 600 | .. _Building FIP images with support for Trusted Board Boot: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/user-guide.rst#building-fip-images-with-support-for-trusted-board-boot |
| 601 | .. _Secure partition Manager: https://git.trustedfirmware.org/TF-A/trusted-firmware-a.git/about/docs/secure-partition-manager-design.rst |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 602 | |
| 603 | .. _EL3 test payload README file: ../el3_payload/README |
| 604 | .. _scripts/run_fwu_fvp.sh: ../scripts/run_fwu_fvp.sh |
| 605 | |
| 606 | .. _ARM Management Mode Interface: http://infocenter.arm.com/help/topic/com.arm.doc.den0060a/DEN0060A_ARM_MM_Interface_Specification.pdf |
| 607 | .. _Juno Getting Started Guide: http://infocenter.arm.com/help/topic/com.arm.doc.dui0928e/DUI0928E_juno_arm_development_platform_gsg.pdf |