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