1 # Target of this port
\r
3 This port adds the support that FreeRTOS applications can call the secure
\r
4 services in Trusted Firmware M(TF-M) through Platform Security Architecture
\r
5 (PSA) API based on the ARM Cortex-M33 platform.
\r
7 The Platform Security Architecture (PSA) makes it quicker, easier and cheaper
\r
8 to design security into a device from the ground up. PSA is made up of four key
\r
9 stages: analyze, architect, implement, and certify. See [PSA Resource Page](https://developer.arm.com/architectures/security-architectures/platform-security-architecture).
\r
11 TF-M is an open source project. It provides a reference implementation of PSA
\r
12 for Arm M-profile architecture. Please get the details from this [link](https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/about/).
\r
14 # Derivation of the source code
\r
16 * ```os_wrapper_freertos.c```
\r
17 The implementation of APIs which are defined in ```\ns_interface\os_wrapper\mutex.h``` by tf-m-tests
\r
18 (tag: TF-Mv1.5.0 & TF-Mv1.6.0). The implementation is based on FreeRTOS mutex type semaphore.
\r
22 To build a project based on this port:
\r
23 * Step 1: build the secure image. Please follow the **Build the Secure Side** section for details.
\r
24 * Step 2: build the nonsecure image. Please follow the **Build the Non-Secure Side** for details.
\r
26 ## Build the Secure Side
\r
28 ### Get the TF-M source code
\r
30 See the [link](https://git.trustedfirmware.org/TF-M/trusted-firmware-m.git/) to get the source code. This port is supported by TF-M version **tag: TF-Mv1.5.0** & **tag: TF-Mv1.6.0**.
\r
34 Please refer to this [link](https://tf-m-user-guide.trustedfirmware.org/docs/technical_references/instructions/tfm_build_instruction.html) to build the secure side.
\r
35 _**Note:** ```TFM_NS_MANAGE_NSID``` must be configured as "OFF" when building TF-M_.
\r
37 ## Build the Non-Secure Side
\r
39 Please copy all the files in ```freertos_kernel\portable\GCC\ARM_CM33_NTZ``` into the ```freertos_kernel\portable\ThirdParty\GCC\ARM_CM33_TFM``` folder before using this port. Note that TrustZone is enabled in this port. The TF-M runs in the Secure Side.
\r
41 Please call the API ```tfm_ns_interface_init()``` which is defined in ```\app\tfm_ns_interface.c``` by tf-m-tests
\r
42 (tag: TF-Mv1.5.0 & TF-Mv1.6.0) at the very beginning of your application. Otherwise, it will always fail when calling a TF-M service in the Nonsecure Side.
\r
44 ### Configuration in FreeRTOS kernel
\r
46 * ```configRUN_FREERTOS_SECURE_ONLY```
\r
47 This macro should be configured as 0. In this port, TF-M runs in the Secure Side while FreeRTOS
\r
48 Kernel runs in the Non-Secure Side.
\r
50 * ```configENABLE_FPU```
\r
51 The setting of this macro is decided by the setting in Secure Side which is platform-specific.
\r
52 If the Secure Side enables Non-Secure access to FPU, then this macro can be configured as 0 or 1. Otherwise, this macro can only be configured as 0.
\r
54 * ```configENABLE_TRUSTZONE```
\r
55 This macro should be configured as 0 because TF-M doesn't use the secure context management function of FreeRTOS. New secure context management might be introduced when TF-M supports multiple secure context.
\r
58 ### Integrate TF-M Non-Secure interface with FreeRTOS project
\r
60 To enable calling TF-M services by the Non-Secure Side, the files below should be included in the FreeRTOS project and built together.
\r
61 * files in ```trusted-firmware-m\build\install\interface\src```
\r
62 These files contain the implementation of PSA Functional Developer APIs which can be called by Non-Secure Side directly and PSA Firmware Framework APIs in the IPC model. These files should be taken as part of the Non-Secure source code.
\r
63 * files in ```trusted-firmware-m\build\install\interface\include```
\r
64 These files are the necessary header files to call TF-M services.
\r
65 * ```trusted-firmware-m\build\install\interface\lib\s_veneers.o```
\r
66 This object file contains all the Non-Secure callable functions exported by
\r
67 TF-M and it should be linked when generating the Non-Secure image.
\r
71 *Copyright (c) 2020-2022, Arm Limited. All rights reserved.*
\r