CMake: Create separate function to set MCU core compile defintions

The new function (mbed_set_cpu_core_definitions()) should always be
called as it has defintions needed by Mbed OS to work with that
particular MCU core.
mbed_set_cpu_core_options() should only be called if a third-party
toolchain file has not been used as it has compile options that can
cause conflicts.
pull/13566/head
Hugues Kamba 2020-10-28 16:24:32 +00:00
parent 76f4953688
commit 46c35965c5
18 changed files with 45 additions and 9 deletions

View File

@ -39,7 +39,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-A9"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_A9

View File

@ -35,7 +35,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M0plus"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M0PLUS

View File

@ -34,7 +34,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"-cpu=Cortex-M0"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M0

View File

@ -34,7 +34,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M1"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M3

View File

@ -34,7 +34,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M23"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M23

View File

@ -34,7 +34,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M23"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M23

View File

@ -34,7 +34,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M3"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M3

View File

@ -36,7 +36,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M33.no_dsp.no_fp"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M33

View File

@ -38,7 +38,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M33.no_dsp.no_fp"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M33

View File

@ -39,7 +39,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M33.no_dsp"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M33

View File

@ -39,7 +39,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M33.no_dsp"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M33

View File

@ -37,7 +37,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M33"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M33

View File

@ -37,7 +37,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M33"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M33

View File

@ -36,7 +36,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M4.no_fp"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M4

View File

@ -3,15 +3,6 @@
# Sets cpu core options
function(mbed_set_cpu_core_options target mbed_toolchain)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M4
ARM_MATH_CM4
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
if(${mbed_toolchain} STREQUAL "GCC_ARM")
list(APPEND common_toolchain_options
"-mthumb"
@ -49,3 +40,14 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M4
ARM_MATH_CM4
__FPU_PRESENT=1
__CMSIS_RTOS
__MBED_CMSIS_RTOS_CM
)
endfunction()

View File

@ -36,7 +36,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M7.no_fp"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M7

View File

@ -39,7 +39,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M7.fp.sp"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M7

View File

@ -39,7 +39,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
"--cpu=Cortex-M7"
)
endif()
endfunction()
function(mbed_set_cpu_core_definitions target)
target_compile_definitions(${target}
INTERFACE
__CORTEX_M7