Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 1 | ################## |
| 2 | First Things First |
| 3 | ################## |
| 4 | |
| 5 | ************ |
| 6 | Prerequisite |
| 7 | ************ |
Antonio de Angelis | 465cc7b | 2024-06-27 20:19:01 +0100 | [diff] [blame] | 8 | Trusted Firmware M provides a reference implementation of the Platform Security |
| 9 | Architecture (PSA) specifications, aligning with PSA Certified guidelines. |
| 10 | It is assumed that the reader is familiar with the specifications that can be |
| 11 | found |
| 12 | `here <https://developer.arm.com/architectures/security-architectures/platform-security-architecture>`__. |
Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 13 | |
Antonio de Angelis | 465cc7b | 2024-06-27 20:19:01 +0100 | [diff] [blame] | 14 | The current TF-M implementation on Armv8-M leverages TrustZone for Armv8-M so a |
Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 15 | good understanding of the v8-M architecture is also necessary. A good place to |
Antonio de Angelis | 465cc7b | 2024-06-27 20:19:01 +0100 | [diff] [blame] | 16 | get started with Armv8-M is |
Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 17 | `developer.arm.com <https://developer.arm.com/architectures/cpu-architecture/m-profile>`__. |
| 18 | |
| 19 | ************************** |
| 20 | Build and run instructions |
| 21 | ************************** |
| 22 | Trusted Firmware M source code is available on |
| 23 | `git.trustedfirmware.org <https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/>`__. |
| 24 | |
| 25 | To build & run TF-M: |
| 26 | |
| 27 | - Follow the this guide to set up and check your environment. |
| 28 | - Follow the |
Anton Komlev | 0dbe8f1 | 2022-06-17 16:48:12 +0100 | [diff] [blame] | 29 | :doc:`Build instructions </building/tfm_build_instruction>` |
Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 30 | to compile and build the TF-M source. |
Anton Komlev | 0dbe8f1 | 2022-06-17 16:48:12 +0100 | [diff] [blame] | 31 | - Follow the :doc:`Run TF-M examples on Arm platforms </building/run_tfm_examples_on_arm_platforms>` |
Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 32 | for information on running the example. |
| 33 | |
| 34 | To port TF-M to a another system or OS, follow the |
| 35 | :doc:`OS Integration Guide </integration_guide/index>` |
| 36 | |
Matthew Dalzell | 988bbd6 | 2025-06-05 15:49:26 +0100 | [diff] [blame^] | 37 | :doc:`Contributing Process </contributing/contributing_process>` contains guidance on how to |
Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 38 | contribute to this project. |
| 39 | |
| 40 | ######################### |
| 41 | Set up build environments |
| 42 | ######################### |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 43 | |
| 44 | TF-M officially supports a limited set of build environments and setups. In |
| 45 | this context, official support means that the environments listed below |
| 46 | are actively used by team members and active developers, hence users should |
| 47 | be able to recreate the same configurations by following the instructions |
| 48 | described below. In case of problems, the TF-M team provides support |
| 49 | only for these environments, but building in other environments can still be |
| 50 | possible. |
| 51 | |
| 52 | The following environments are supported: |
| 53 | |
| 54 | .. tabs:: |
| 55 | |
| 56 | .. group-tab:: Linux |
| 57 | |
| 58 | 1. version supported: |
| 59 | |
| 60 | Ubuntu 18.04 x64+ |
| 61 | |
| 62 | 2. install dependencies: |
| 63 | |
| 64 | .. code-block:: bash |
| 65 | |
| 66 | sudo apt-get install -y git curl wget build-essential libssl-dev python3 \ |
| 67 | python3-pip cmake make |
| 68 | |
| 69 | 3. verify cmake version: |
| 70 | |
| 71 | .. code-block:: bash |
| 72 | |
| 73 | cmake --version |
| 74 | |
| 75 | .. note:: |
| 76 | |
Nik Dewally | ae923b1 | 2024-06-26 15:30:09 +0100 | [diff] [blame] | 77 | Please download CMake version 3.21 or later from https://cmake.org/download/. |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 78 | |
| 79 | 4. add CMake path into environment: |
| 80 | |
| 81 | .. code-block:: bash |
| 82 | |
| 83 | export PATH=<CMake path>/bin:$PATH |
| 84 | |
| 85 | .. group-tab:: Windows |
| 86 | |
| 87 | 1. version supported: |
| 88 | |
| 89 | Windows 10 x64 |
| 90 | |
Nik Dewally | ae923b1 | 2024-06-26 15:30:09 +0100 | [diff] [blame] | 91 | 2. install dependencies: |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 92 | |
| 93 | - Git client latest version (https://git-scm.com/download/win) |
Nik Dewally | ae923b1 | 2024-06-26 15:30:09 +0100 | [diff] [blame] | 94 | - CMake version 3.21 or later (`native Windows version <https://cmake.org/download/>`__) |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 95 | - GNU make (http://gnuwin32.sourceforge.net/packages/make.htm) |
| 96 | - Python3 `(native Windows version) <https://www.python.org/downloads/>`__ and |
| 97 | the pip package manager (from Python 3.4 it's included) |
| 98 | |
| 99 | 3. add CMake path into environment: |
| 100 | |
| 101 | .. code-block:: bash |
| 102 | |
Anton Komlev | 3c785b2 | 2022-06-19 16:08:49 +0100 | [diff] [blame] | 103 | set PATH=<CMake_Path>\bin;%PATH% |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 104 | |
| 105 | ########################### |
| 106 | Install python dependencies |
| 107 | ########################### |
| 108 | |
| 109 | Clone the TF-M source code, and then install the TF-M's additional Python |
| 110 | dependencies. |
| 111 | |
| 112 | .. tabs:: |
| 113 | |
| 114 | .. group-tab:: Linux |
| 115 | |
| 116 | 1. get the TF-M source code: |
| 117 | |
| 118 | .. code-block:: bash |
| 119 | |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 120 | git clone https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git |
| 121 | |
| 122 | 2. TF-M's ``tools/requirements.txt`` file declares additional Python |
| 123 | dependencies. Install them with ``pip3``: |
| 124 | |
| 125 | .. code-block:: bash |
| 126 | |
| 127 | pip3 install --upgrade pip |
| 128 | cd trusted-firmware-m |
| 129 | pip3 install -r tools/requirements.txt |
| 130 | |
| 131 | .. group-tab:: Windows |
| 132 | |
| 133 | 1. get the TF-M source code: |
| 134 | |
| 135 | .. code-block:: bash |
| 136 | |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 137 | git clone https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git |
| 138 | |
| 139 | 2. TF-M's ``tools/requirements.txt`` file declares additional Python |
| 140 | dependencies. Install them with ``pip3``: |
| 141 | |
| 142 | .. code-block:: bash |
| 143 | |
| 144 | cd trusted-firmware-m |
| 145 | pip3 install -r tools\requirements.txt |
| 146 | |
| 147 | ################### |
| 148 | Install a toolchain |
| 149 | ################### |
| 150 | |
| 151 | To compile TF-M code, at least one of the supported compiler toolchains have to |
| 152 | be available in the build environment. The currently supported compiler |
| 153 | versions are: |
| 154 | |
Mudit Sharma | 8301e10 | 2025-04-10 11:44:31 +0100 | [diff] [blame] | 155 | - Arm Compiler minimum version v6.21 |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 156 | |
| 157 | .. tabs:: |
| 158 | |
| 159 | .. group-tab:: Linux |
| 160 | |
| 161 | - Download the standalone packages from `here <https://developer.arm.com/products/software-development-tools/compilers/arm-compiler/downloads/version-6>`__. |
| 162 | - Add Arm Compiler into environment: |
| 163 | |
| 164 | .. code-block:: bash |
| 165 | |
David Hu | 3aca3ed | 2022-01-12 20:58:05 +0800 | [diff] [blame] | 166 | export PATH=<ARM_CLANG_PATH>/bin:$PATH |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 167 | export ARM_PRODUCT_PATH=<ARM_CLANG_PATH>/sw/mappings |
| 168 | |
David Hu | 3aca3ed | 2022-01-12 20:58:05 +0800 | [diff] [blame] | 169 | - Configure proper tool variant and license. |
| 170 | |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 171 | .. group-tab:: Windows |
| 172 | |
| 173 | - Download the standalone packages from `here <https://developer.arm.com/products/software-development-tools/compilers/arm-compiler/downloads/version-6>`__. |
| 174 | - Add Arm Compiler into environment: |
| 175 | |
| 176 | .. code-block:: bash |
| 177 | |
Anton Komlev | 3c785b2 | 2022-06-19 16:08:49 +0100 | [diff] [blame] | 178 | set PATH=<ARM_CLANG_PATH>\bin;%PATH% |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 179 | set ARM_PRODUCT_PATH=<ARM_CLANG_PATH>\sw\mappings |
| 180 | |
David Hu | 3aca3ed | 2022-01-12 20:58:05 +0800 | [diff] [blame] | 181 | - Configure proper tool variant and license. |
| 182 | |
Mudit Sharma | 8301e10 | 2025-04-10 11:44:31 +0100 | [diff] [blame] | 183 | - GNU Arm compiler version minimum 10.3.2021.10 |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 184 | |
| 185 | .. tabs:: |
| 186 | |
| 187 | .. group-tab:: Linux |
| 188 | |
| 189 | - Download the GNU Arm compiler from `here <https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads>`__. |
| 190 | - Add GNU Arm into environment: |
| 191 | |
| 192 | .. code-block:: bash |
| 193 | |
| 194 | export PATH=<GNU_ARM_PATH>/bin:$PATH |
| 195 | |
| 196 | .. group-tab:: Windows |
| 197 | |
| 198 | - Download the GNU Arm compiler from `here <https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads>`__. |
| 199 | - Add GNU Arm into environment: |
| 200 | |
| 201 | .. code-block:: bash |
| 202 | |
Anton Komlev | 3c785b2 | 2022-06-19 16:08:49 +0100 | [diff] [blame] | 203 | set PATH=<GNU_ARM_PATH>\bin;%PATH% |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 204 | |
Mudit Sharma | 8301e10 | 2025-04-10 11:44:31 +0100 | [diff] [blame] | 205 | - IAR Arm compiler v9.30.1 |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 206 | |
| 207 | .. tabs:: |
| 208 | |
| 209 | .. group-tab:: Linux |
| 210 | |
Matthew Dalzell | 988bbd6 | 2025-06-05 15:49:26 +0100 | [diff] [blame^] | 211 | - Download IAR build tools from `here <https://www.iar.com/embedded-development-tools/iar-build-tools>`__. |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 212 | - Add IAR Arm compiler into environment: |
| 213 | |
| 214 | .. code-block:: bash |
| 215 | |
| 216 | export PATH=<IAR_COMPILER_PATH>/bin:$PATH |
| 217 | |
| 218 | .. group-tab:: Windows |
| 219 | |
Matthew Dalzell | 988bbd6 | 2025-06-05 15:49:26 +0100 | [diff] [blame^] | 220 | - Download IAR build tools from `here <https://www.iar.com/embedded-development-tools/iar-build-tools>`__. |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 221 | - Add IAR Arm compiler into environment: |
| 222 | |
| 223 | .. code-block:: bash |
| 224 | |
Anton Komlev | 3c785b2 | 2022-06-19 16:08:49 +0100 | [diff] [blame] | 225 | set PATH=<IAR_COMPILER_PATH>\bin;%PATH% |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 226 | |
Anton Komlev | 25afa33 | 2024-12-27 15:19:51 +0000 | [diff] [blame] | 227 | - LLVM Embedded Toolchain for Arm v18.1.3+ |
| 228 | |
| 229 | .. tabs:: |
| 230 | |
| 231 | .. group-tab:: Linux |
| 232 | |
| 233 | - Download the LLVM Embedded Toolchain for Arm from `here <https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm>`__. |
| 234 | - Add LLVM Embedded into environment: |
| 235 | |
| 236 | .. code-block:: bash |
| 237 | |
| 238 | export PATH=<LLVM_PATH>/bin:$PATH |
| 239 | |
| 240 | .. group-tab:: Windows |
| 241 | |
| 242 | - Download the LLVM Embedded Toolchain for Arm from `here <https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm>`__. |
| 243 | - Add LLVM Embedded into environment: |
| 244 | |
| 245 | .. code-block:: bash |
| 246 | |
| 247 | set PATH=<LLVM_PATH>\bin;%PATH% |
| 248 | |
| 249 | .. note:: |
| 250 | |
| 251 | Not all platforms support this toolchain. Please refer to a platform documentation or check with the platform owner. |
| 252 | |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 253 | ############################# |
| 254 | Build AN521 regression sample |
| 255 | ############################# |
| 256 | |
| 257 | Here, we take building TF-M for AN521 platform with regression tests using GCC |
| 258 | as an example: |
| 259 | |
| 260 | .. tabs:: |
| 261 | |
| 262 | .. group-tab:: Linux |
| 263 | |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 264 | Get the TF-M tests source code: |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 265 | |
| 266 | .. code-block:: bash |
| 267 | |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 268 | git clone https://git.trustedfirmware.org/TF-M/tf-m-tests.git |
| 269 | |
| 270 | Build SPE and NSPE. |
| 271 | |
| 272 | .. code-block:: bash |
| 273 | |
| 274 | cd </tf-m-tests/tests_reg> |
Matthew Dalzell | cb5e8b1 | 2024-03-20 14:35:39 +0000 | [diff] [blame] | 275 | cmake -S spe -B build_spe -DTFM_PLATFORM=arm/mps2/an521 -DCONFIG_TFM_SOURCE_PATH=<TF-M source dir absolute path> \ |
| 276 | -DCMAKE_BUILD_TYPE=Debug -DTFM_TOOLCHAIN_FILE=<TF-M source dir absolute path>/toolchain_GNUARM.cmake \ |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 277 | -DTEST_S=ON -DTEST_NS=ON \ |
| 278 | cmake --build build_spe -- install |
| 279 | |
Matthew Dalzell | cb5e8b1 | 2024-03-20 14:35:39 +0000 | [diff] [blame] | 280 | cmake -S . -B build_test -DCONFIG_SPE_PATH=<tf-m-tests absolute path>/tests_reg/build_spe/api_ns \ |
| 281 | -DCMAKE_BUILD_TYPE=Debug -DTFM_TOOLCHAIN_FILE=<tf-m-tests absolute path>/tests_reg/build_spe/api_ns/cmake/toolchain_ns_GNUARM.cmake |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 282 | cmake --build build_test |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 283 | |
| 284 | .. group-tab:: Windows |
| 285 | |
Ken Liu | 6792e04 | 2023-11-13 14:48:00 +0800 | [diff] [blame] | 286 | .. important:: |
| 287 | Use "/" instead of "\\" when assigning Windows paths to CMAKE |
| 288 | variables, for example, use "c:/build" instead of "c:\\\\build". |
| 289 | |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 290 | Get the TF-M tests source code: |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 291 | |
| 292 | .. code-block:: bash |
| 293 | |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 294 | git clone https://git.trustedfirmware.org/TF-M/tf-m-tests.git |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 295 | |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 296 | Build SPE and NSPE. |
| 297 | |
| 298 | .. code-block:: bash |
| 299 | |
| 300 | cd </tf-m-tests/tests_reg> |
Matthew Dalzell | cb5e8b1 | 2024-03-20 14:35:39 +0000 | [diff] [blame] | 301 | cmake -G"Unix Makefiles" -S spe -B build_spe -DTFM_PLATFORM=arm/mps2/an521 -DCONFIG_TFM_SOURCE_PATH=<TF-M source dir absolute path> \ |
| 302 | -DCMAKE_BUILD_TYPE=Debug -DTFM_TOOLCHAIN_FILE=<TF-M source dir absolute path>/toolchain_GNUARM.cmake \ |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 303 | -DTEST_S=ON -DTEST_NS=ON \ |
| 304 | cmake --build build_spe -- install |
| 305 | |
Matthew Dalzell | cb5e8b1 | 2024-03-20 14:35:39 +0000 | [diff] [blame] | 306 | cmake -G"Unix Makefiles" -S . -B build_test -DCONFIG_SPE_PATH=<tf-m-tests absolute path>/tests_reg/build_spe/api_ns \ |
| 307 | -DCMAKE_BUILD_TYPE=Debug -DTFM_TOOLCHAIN_FILE=<tf-m-tests absolute path>/tests_reg/build_spe/api_ns/cmake/toolchain_ns_GNUARM.cmake |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 308 | cmake --build build_test |
Anton Komlev | 8150642 | 2022-02-15 21:53:13 +0000 | [diff] [blame] | 309 | |
| 310 | .. note:: |
| 311 | The latest Windows support long paths, but if you are less lucky |
| 312 | then you can reduce paths by moving the build directory closer to |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 313 | the root by changing the ``-B`` option of the commands, for example, |
| 314 | to ``C:\build_spe`` and ``C:\build_test`` folders. |
Anton Komlev | 8150642 | 2022-02-15 21:53:13 +0000 | [diff] [blame] | 315 | |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 316 | ########################### |
| 317 | Run AN521 regression sample |
| 318 | ########################### |
| 319 | |
| 320 | Run the sample code on SSE-200 Fast-Model, using FVP_MPS2_AEMv8M provided by |
| 321 | Arm Development Studio. |
| 322 | |
| 323 | .. note:: |
| 324 | |
| 325 | Arm Development Studio is not essential to develop TF-M, you can skip this |
| 326 | section if don't want to try on Arm develop boards. |
| 327 | |
| 328 | .. tabs:: |
| 329 | |
| 330 | .. group-tab:: Linux |
| 331 | |
| 332 | 1. install Arm Development Studio to get the fast-model. |
| 333 | |
Matthew Dalzell | 988bbd6 | 2025-06-05 15:49:26 +0100 | [diff] [blame^] | 334 | Download Arm Development Studio from `here <https://developer.arm.com/Tools%20and%20Software/Arm%20Development%20Studio#Downloads>`__. |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 335 | |
| 336 | 2. Add ``bl2.axf`` and ``tfm_s_ns_signed.bin`` to symbol files in Debug |
| 337 | Configuration menu. |
| 338 | |
| 339 | .. code-block:: bash |
| 340 | |
| 341 | <DS_PATH>/sw/models/bin/FVP_MPS2_AEMv8M \ |
| 342 | --parameter fvp_mps2.platform_type=2 \ |
| 343 | --parameter cpu0.baseline=0 \ |
| 344 | --parameter cpu0.INITVTOR_S=0x10000000 \ |
| 345 | --parameter cpu0.semihosting-enable=0 \ |
| 346 | --parameter fvp_mps2.DISABLE_GATING=0 \ |
| 347 | --parameter fvp_mps2.telnetterminal0.start_telnet=1 \ |
| 348 | --parameter fvp_mps2.telnetterminal1.start_telnet=0 \ |
| 349 | --parameter fvp_mps2.telnetterminal2.start_telnet=0 \ |
| 350 | --parameter fvp_mps2.telnetterminal0.quiet=0 \ |
| 351 | --parameter fvp_mps2.telnetterminal1.quiet=1 \ |
| 352 | --parameter fvp_mps2.telnetterminal2.quiet=1 \ |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 353 | --application cpu0=<build_spe>/api_ns/bin/bl2.axf \ |
| 354 | --data cpu0=<build_test>/tfm_s_ns_signed.bin@0x10080000 |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 355 | |
Jason Guo | f64dc6b | 2023-07-06 15:55:26 +0800 | [diff] [blame] | 356 | .. note:: |
| 357 | |
| 358 | The log is output to telnet by default. |
| 359 | It can be also redirected to stdout by adding the following parameter. |
| 360 | |
| 361 | .. code-block:: bash |
| 362 | |
| 363 | --parameter fvp_mps2.UART0.out_file=/dev/stdout |
| 364 | |
| 365 | To automatically terminate the fast-model when it finishes running, |
| 366 | you can add the following parameters: |
| 367 | |
| 368 | .. code-block:: bash |
| 369 | |
| 370 | --parameter fvp_mps2.UART0.shutdown_on_eot=1 |
| 371 | |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 372 | .. group-tab:: Windows |
| 373 | |
| 374 | 1. install Arm Development Studio to get the fast-model. |
| 375 | |
Matthew Dalzell | 988bbd6 | 2025-06-05 15:49:26 +0100 | [diff] [blame^] | 376 | Download Arm Development Studio from `here <https://developer.arm.com/Tools%20and%20Software/Arm%20Development%20Studio#Downloads>`__. |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 377 | |
| 378 | 2. Add ``bl2.axf`` and ``tfm_s_ns_signed.bin`` to symbol files in Debug |
| 379 | Configuration menu. |
| 380 | |
| 381 | .. code-block:: bash |
| 382 | |
| 383 | <DS_PATH>\sw\models\bin\FVP_MPS2_AEMv8M \ |
| 384 | --parameter fvp_mps2.platform_type=2 \ |
| 385 | --parameter cpu0.baseline=0 \ |
| 386 | --parameter cpu0.INITVTOR_S=0x10000000 \ |
| 387 | --parameter cpu0.semihosting-enable=0 \ |
| 388 | --parameter fvp_mps2.DISABLE_GATING=0 \ |
| 389 | --parameter fvp_mps2.telnetterminal0.start_telnet=1 \ |
| 390 | --parameter fvp_mps2.telnetterminal1.start_telnet=0 \ |
| 391 | --parameter fvp_mps2.telnetterminal2.start_telnet=0 \ |
| 392 | --parameter fvp_mps2.telnetterminal0.quiet=0 \ |
| 393 | --parameter fvp_mps2.telnetterminal1.quiet=1 \ |
| 394 | --parameter fvp_mps2.telnetterminal2.quiet=1 \ |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 395 | --application cpu0=<build_spe>/api_ns/bin/bl2.axf \ |
| 396 | --data cpu0=<build_test>/tfm_s_ns_signed.bin@0x10080000 |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 397 | |
Jason Guo | f64dc6b | 2023-07-06 15:55:26 +0800 | [diff] [blame] | 398 | .. note:: |
| 399 | |
| 400 | To automatically terminate the fast-model when it finishes running, |
| 401 | you can add the following parameters: |
| 402 | |
| 403 | .. code-block:: bash |
| 404 | |
| 405 | --parameter fvp_mps2.UART0.shutdown_on_eot=1 |
| 406 | |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 407 | After completing the procedure you should see the following messages on the |
| 408 | DAPLink UART (baud 115200 8n1):: |
| 409 | |
Kevin Peng | 2d17044 | 2023-11-20 14:09:07 +0800 | [diff] [blame] | 410 | ... |
| 411 | #### Execute test suites for the Secure area #### |
| 412 | Running Test Suite PSA protected storage S interface tests (TFM_S_PS_TEST_1XXX)... |
| 413 | > Executing 'TFM_S_PS_TEST_1001' |
| 414 | Description: 'Set interface' |
| 415 | TEST: TFM_S_PS_TEST_1001 - PASSED! |
| 416 | > Executing 'TFM_S_PS_TEST_1002' |
| 417 | Description: 'Set interface with create flags' |
| 418 | TEST: TFM_S_PS_TEST_1002 - PASSED! |
| 419 | > Executing 'TFM_S_PS_TEST_1003' |
| 420 | Description: 'Set interface with NULL data pointer' |
| 421 | TEST: TFM_S_PS_TEST_1003 - PASSED! |
| 422 | > Executing 'TFM_S_PS_TEST_1005' |
| 423 | Description: 'Set interface with write once UID' |
| 424 | TEST: TFM_S_PS_TEST_1005 - PASSED! |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 425 | .... |
| 426 | |
| 427 | ########################## |
| 428 | Tool & Dependency overview |
| 429 | ########################## |
| 430 | |
| 431 | To build the TF-M firmware the following tools are needed: |
| 432 | |
Anton Komlev | 4c436bf | 2021-10-18 21:59:55 +0100 | [diff] [blame] | 433 | - C compiler of supported toolchains |
Nik Dewally | ae923b1 | 2024-06-26 15:30:09 +0100 | [diff] [blame] | 434 | - CMake version 3.21 or later |
Anton Komlev | 4c436bf | 2021-10-18 21:59:55 +0100 | [diff] [blame] | 435 | - Git |
| 436 | - gmake, aka GNU Make |
| 437 | - Python v3.x |
Nicola Mazzucato | afd24bb | 2024-02-14 17:27:27 +0000 | [diff] [blame] | 438 | - a set of python modules listed in ``tools/requirements.txt`` |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 439 | |
Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 440 | **************** |
Anton Komlev | 4c436bf | 2021-10-18 21:59:55 +0100 | [diff] [blame] | 441 | Dependency chain |
Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 442 | **************** |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 443 | |
| 444 | .. uml:: |
| 445 | |
| 446 | @startuml |
| 447 | skinparam state { |
| 448 | BackgroundColor #92AEE0 |
| 449 | FontColor black |
| 450 | FontSize 16 |
| 451 | AttributeFontColor black |
| 452 | AttributeFontSize 16 |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 453 | } |
| 454 | state fw as "Firmware" : TF-M binary |
| 455 | state c_comp as "C Compiler" : C99 |
Anton Komlev | 4c436bf | 2021-10-18 21:59:55 +0100 | [diff] [blame] | 456 | state python as "Python" : v3.x |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 457 | |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 458 | fw --> c_comp |
| 459 | fw --> CMake |
| 460 | CMake --> gmake |
Anton Komlev | 4c436bf | 2021-10-18 21:59:55 +0100 | [diff] [blame] | 461 | CMake --> Ninja |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 462 | fw --> cryptography |
| 463 | fw --> pyasn1 |
| 464 | fw --> yaml |
| 465 | fw --> jinja2 |
Ross Burton | 5ba8239 | 2021-11-10 16:56:10 +0000 | [diff] [blame] | 466 | fw --> cbor2 |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 467 | fw --> click |
| 468 | fw --> imgtool |
Anton Komlev | 4c436bf | 2021-10-18 21:59:55 +0100 | [diff] [blame] | 469 | c_comp --> GCC |
| 470 | c_comp --> CLANG |
| 471 | c_comp --> IAR |
| 472 | cryptography --> python |
| 473 | pyasn1 --> python |
| 474 | yaml --> python |
| 475 | jinja2 --> python |
Ross Burton | 5ba8239 | 2021-11-10 16:56:10 +0000 | [diff] [blame] | 476 | cbor2 --> python |
Anton Komlev | 4c436bf | 2021-10-18 21:59:55 +0100 | [diff] [blame] | 477 | click --> python |
| 478 | imgtool --> python |
Jianliang Shen | dfddc98 | 2022-11-29 15:08:19 +0800 | [diff] [blame] | 479 | kconfiglib --> python |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 480 | @enduml |
| 481 | |
Anton Komlev | 91281f0 | 2022-04-22 09:24:20 +0100 | [diff] [blame] | 482 | .. rubric:: Next steps |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 483 | |
| 484 | Here are some next steps for exploring TF-M: |
| 485 | |
Anton Komlev | 0dbe8f1 | 2022-06-17 16:48:12 +0100 | [diff] [blame] | 486 | - Detailed :doc:`Build instructions </building/tfm_build_instruction>`. |
| 487 | - :doc:`IAR Build instructions </building/tfm_build_instruction_iar>`. |
| 488 | - Try other :doc:`Samples and Demos </building/run_tfm_examples_on_arm_platforms>`. |
| 489 | - :doc:`Documentation generation </building/documentation_generation>`. |
Summer Qin | 6d5c91c | 2021-05-24 15:32:44 +0800 | [diff] [blame] | 490 | |
| 491 | -------------- |
| 492 | |
Mudit Sharma | 8301e10 | 2025-04-10 11:44:31 +0100 | [diff] [blame] | 493 | *SPDX-License-Identifier: BSD-3-Clause* |
| 494 | |
| 495 | *SPDX-FileCopyrightText: Copyright The TrustedFirmware-M Contributors* |