target_arm.cmake 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. # SPDX-License-Identifier: Apache-2.0
  2. list(APPEND TOOLCHAIN_C_FLAGS -mcpu=${GCC_M_CPU})
  3. list(APPEND TOOLCHAIN_LD_FLAGS -mcpu=${GCC_M_CPU})
  4. if(CONFIG_COMPILER_ISA_THUMB2)
  5. list(APPEND TOOLCHAIN_C_FLAGS -mthumb)
  6. list(APPEND TOOLCHAIN_LD_FLAGS -mthumb)
  7. endif()
  8. list(APPEND TOOLCHAIN_C_FLAGS -mabi=aapcs)
  9. list(APPEND TOOLCHAIN_LD_FLAGS -mabi=aapcs)
  10. # Defines a mapping from GCC_M_CPU to FPU
  11. if(CONFIG_CPU_HAS_FPU_DOUBLE_PRECISION)
  12. set(PRECISION_TOKEN)
  13. else()
  14. set(PRECISION_TOKEN sp-)
  15. endif()
  16. set(FPU_FOR_cortex-m4 fpv4-${PRECISION_TOKEN}d16)
  17. set(FPU_FOR_cortex-m7 fpv5-${PRECISION_TOKEN}d16)
  18. set(FPU_FOR_cortex-m33 fpv5-${PRECISION_TOKEN}d16)
  19. set(FPU_FOR_cortex-m33+nodsp fpv5-${PRECISION_TOKEN}d16)
  20. set(FPU_FOR_cortex-m55 auto)
  21. set(FPU_FOR_cortex-m55+nomve.fp auto)
  22. set(FPU_FOR_cortex-m55+nomve auto)
  23. set(FPU_FOR_cortex-m55+nodsp auto)
  24. if(CONFIG_FPU)
  25. list(APPEND TOOLCHAIN_C_FLAGS -mfpu=${FPU_FOR_${GCC_M_CPU}})
  26. list(APPEND TOOLCHAIN_LD_FLAGS -mfpu=${FPU_FOR_${GCC_M_CPU}})
  27. if (CONFIG_FP_SOFTABI)
  28. list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=softfp)
  29. list(APPEND TOOLCHAIN_LD_FLAGS -mfloat-abi=softfp)
  30. elseif(CONFIG_FP_HARDABI)
  31. list(APPEND TOOLCHAIN_C_FLAGS -mfloat-abi=hard)
  32. list(APPEND TOOLCHAIN_LD_FLAGS -mfloat-abi=hard)
  33. endif()
  34. endif()
  35. if(CONFIG_FP16)
  36. if (CONFIG_FP16_IEEE)
  37. if ($(COMPILER) STREQUAL "gcc")
  38. list(APPEND TOOLCHAIN_C_FLAGS -mfp16-format=ieee)
  39. list(APPEND TOOLCHAIN_LD_FLAGS -mfp16-format=ieee)
  40. endif()
  41. elseif(CONFIG_FP16_ALT)
  42. list(APPEND TOOLCHAIN_C_FLAGS -mfp16-format=alternative)
  43. list(APPEND TOOLCHAIN_LD_FLAGS -mfp16-format=alternative)
  44. endif()
  45. endif()