How do I enable the FPU for the nrf5340dk/nrf5340/cpuapp/ns target?

I read other similar issues on this forum but they haven't helped solve my problem.  I started with the peripheral_uart example project.  Development and execution on the target is going well, but I need FPU support in my application.  I added CONFIG_FPU=y and CONFIG_FPU_SHARING=y in prj.conf, but that causes this build error:

CMake Error at cmake/utils.cmake:67 (message):

INVALID CONFIG: ( CONFIG_TFM_ENABLE_FP OR CONFIG_TFM_ENABLE_MVE OR
CONFIG_TFM_ENABLE_MVE_FP ) AND NOT CONFIG_TFM_ENABLE_CP10CP11
Call Stack (most recent call first):
config/cp_check.cmake:35 (tfm_invalid_config)
config/check_config.cmake:85 (include)
CMakeLists.txt:79 (include)

This should be a rather basic feature, how do I enable FPU support for the NRF5340 application core?

Parents
  • To enable Floating Point Unit (FPU) support on the nRF5340 application core, especially when using Trusted Firmware-M (TF-M), start by modifying your prj.conf file to add the configurations that turn on FPU and context sharing:

    CONFIG_FPU=y
    CONFIG_FPU_SHARING=y
    
    If your project relies on TF-M, you'll also need to enable FPU support in TF-M itself. Include these additional settings in your prj.conf:
    CONFIG_TFM=y
    CONFIG_TFM_ENABLE_FP=y
    CONFIG_TFM_ENABLE_CP10CP11=y

    These options make sure TF-M is set up to work with the FPU correctly.

    Check that your toolchain can handle floating-point operations. For GCC, for example, verify that it’s set to an appropriate floating-point ABI, such as -mfloat-abi=hard.

Reply
  • To enable Floating Point Unit (FPU) support on the nRF5340 application core, especially when using Trusted Firmware-M (TF-M), start by modifying your prj.conf file to add the configurations that turn on FPU and context sharing:

    CONFIG_FPU=y
    CONFIG_FPU_SHARING=y
    
    If your project relies on TF-M, you'll also need to enable FPU support in TF-M itself. Include these additional settings in your prj.conf:
    CONFIG_TFM=y
    CONFIG_TFM_ENABLE_FP=y
    CONFIG_TFM_ENABLE_CP10CP11=y

    These options make sure TF-M is set up to work with the FPU correctly.

    Check that your toolchain can handle floating-point operations. For GCC, for example, verify that it’s set to an appropriate floating-point ABI, such as -mfloat-abi=hard.

Children
  • Thank you for the response!  Unfortunately, it still fails to configure.  For the time-being I have switched to the nrf5340/cpuapp configuration instead of the nrf5340/cpuapp/ns configuration and have floating point working.  But why can't I build for the non-secure version?

    I added these options to prj.confg:

    CONFIG_FPU=y
    CONFIG_FPU_SHARING=y
    CONFIG_TFM=y
    CONFIG_TFM_ENABLE_FP=y
    CONFIG_TFM_ENABLE_CP10CP11=y
     
    And now have these configuration errors:
    Parsing C:/projects/advancedTauReader/samples/peripheral_uart/Kconfig
    Loaded configuration 'C:/ncs/v2.7.0/zephyr/boards/nordic/nrf5340dk/nrf5340dk_nrf5340_cpuapp_ns_defconfig'
    Merged configuration 'C:/projects/advancedTauReader/samples/peripheral_uart/prj.conf'
    Merged configuration 'C:/projects/advancedTauReader/samples/peripheral_uart/build_1/zephyr/misc/generated/extra_kconfig_options.conf'
    C:/projects/advancedTauReader/samples/peripheral_uart/prj.conf:55: warning: attempt to assign the value 'y' to the undefined symbol TFM

    C:/projects/advancedTauReader/samples/peripheral_uart/prj.conf:56: warning: attempt to assign the value 'y' to the undefined symbol TFM_ENABLE_FP

    C:/projects/advancedTauReader/samples/peripheral_uart/prj.conf:57: warning: attempt to assign the value 'y' to the undefined symbol TFM_ENABLE_CP10CP11

    error: Aborting due to Kconfig warnings
Related