blob: fcd511c1ed8d24a8c25c6ec319b6087d85b89477 [file] [log] [blame]
Feder Liang4f7c75b2021-09-14 16:15:15 +08001######################
2Floating-Point Support
3######################
4
5TF-M adds several configuration flags to control Floating point (FP) [1]_
6support in TF-M Secure Processing Environment (SPE).
7Non Secure Processing Environment (NSPE) is not allowed to access Floating
8Point Unit (FPU) [2]_ when FP support is enabled in SPE at current stage.
9
10* Support GNU Arm Embedded Toolchain [3]_.
11* Support FP Application Binary Interface (ABI) [4]_ types: software, hybird,
12 hardware.
13* Support lazy stacking on/off.
14* Support Inter-Process Communication (IPC) [5]_ model in TF-M, and doesn't
15 support LIBRARY model.
16* Support Armv8-M [6]_ mainline or later.
17* Support isolation level 1,2,3.
18
19FP support is enabled on Arm musca S1 [7]_ platform as a reference
20implementation. Please refer to musca s1 platform code when FP support is
21enabled on other platforms.
22
23Secure libraries are compiled with ``COMPILER_CP_FLAG`` and linked with
24``LINKER_CP_OPTION`` for different FP ABI types. All those libraries shall be
25built with the same FP ABI type. Otherwise, linking errors may occur due to FP
26ABI type conflicts.
27
28If FP ABI types mismatch error is generated during build, pleae check whether
29the library is compiled with ``COMPILER_CP_FLAG``.
30Example:
31
32.. code-block:: cmake
33
34 target_compile_options(lib
35 PRIVATE
36 ${COMPILER_CP_FLAG}
37 )
38
39===================================
40CMake configurations for FP support
41===================================
42The following CMake configurations configure ``COMPILER_CP_FLAG`` in TF-M SPE.
43
44* ``CONFIG_TFM_SPE_FP`` are used to configure FP ABI type for secure side.
45
46 +-------------------+---------------------------+
47 | CONFIG_TFM_SPE_FP | FP ABI type [2]_ [3]_ |
48 +===================+===========================+
49 | 0 (default) | Software |
50 +-------------------+---------------------------+
51 | 1 | Hybird |
52 +-------------------+---------------------------+
53 | 2 | Hardware |
54 +-------------------+---------------------------+
55
56 FP software ABI type is default for secure side in TF-M (mfloat-abi=soft).
57
58* ``CONFIG_TFM_LAZY_STACKING_SPE`` is used to enable/disable lazy stacking
59 feature from secure side. This feature is only valid for FP hardware or
60 hybird option.
61
62 +------------------------------+---------------------------+
63 | CONFIG_TFM_LAZY_STACKING_SPE | Description |
64 +==============================+===========================+
65 | 0FF | Disable lazy stacking |
66 +------------------------------+---------------------------+
67 | ON (default) | Enable lazy stacking |
68 +------------------------------+---------------------------+
69
70* ``CONFIG_TFM_FP_ARCH`` specifies which FP architecture is available on the
71 target, valid for FP hardware or hybird option.
72
73 FP architecture is processor dependent. For GNUARM compiler, example value
74 are: auto, fpv5-d16, fpv5-sp-d16, etc.
75
76 Default value of ``CONFIG_TFM_FP_ARCH`` for GNUARM compiler is fpv5-sp-d16.
77
78 This parameter shall be specified by platform. Please check compiler
79 reference manual and processor hardware manual for more details to set
80 correct FPU configuration for platform.
81
82
83*********
84Reference
85*********
86.. [1] `High-Performance Hardware Support for Floating-Point Operations <https://www.arm.com/why-arm/technologies/floating-point>`_
87
88.. [2] `Cortex-M4 Technical Reference Manual <https://developer.arm.com/documentation/ddi0439/b/Floating-Point-Unit/About-the-FPU>`_
89
90.. [3] `GNU Arm Embedded Toolchain <https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm>`_
91
92.. [4] `Float Point ABI <https://www.keil.com/support/man/docs/armclang_ref/armclang_ref_chr1417451577871.htm>`_
93
94.. [5] :doc:`TF-M Inter-Process Communication </docs/technical_references/design_docs/tfm_psa_inter_process_communication>`
95
96.. [6] `Armv8-M Architecture Reference Manual <https://developer.arm.com/documentation/ddi0553/latest>`_
97
98.. [7] `Musca-S1 Test Chip Board <https://developer.arm.com/tools-and-software/development-boards/iot-test-chips-and-boards/musca-s1-test-chip-board>`_
99
100
101--------------
102
103*Copyright (c) 2021, Arm Limited. All rights reserved.*