Skip to content

Commit 46c3596

Browse files
committed
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.
1 parent 76f4953 commit 46c3596

18 files changed

+45
-9
lines changed

tools/cmake/cores/Cortex-A9.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
3939
"--cpu=Cortex-A9"
4040
)
4141
endif()
42+
endfunction()
4243

44+
function(mbed_set_cpu_core_definitions target)
4345
target_compile_definitions(${target}
4446
INTERFACE
4547
__CORTEX_A9

tools/cmake/cores/Cortex-M0+.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
3535
"--cpu=Cortex-M0plus"
3636
)
3737
endif()
38+
endfunction()
3839

40+
function(mbed_set_cpu_core_definitions target)
3941
target_compile_definitions(${target}
4042
INTERFACE
4143
__CORTEX_M0PLUS

tools/cmake/cores/Cortex-M0.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
3434
"-cpu=Cortex-M0"
3535
)
3636
endif()
37+
endfunction()
3738

39+
function(mbed_set_cpu_core_definitions target)
3840
target_compile_definitions(${target}
3941
INTERFACE
4042
__CORTEX_M0

tools/cmake/cores/Cortex-M1.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
3434
"--cpu=Cortex-M1"
3535
)
3636
endif()
37+
endfunction()
3738

39+
function(mbed_set_cpu_core_definitions target)
3840
target_compile_definitions(${target}
3941
INTERFACE
4042
__CORTEX_M3

tools/cmake/cores/Cortex-M23-NS.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
3434
"--cpu=Cortex-M23"
3535
)
3636
endif()
37+
endfunction()
3738

39+
function(mbed_set_cpu_core_definitions target)
3840
target_compile_definitions(${target}
3941
INTERFACE
4042
__CORTEX_M23

tools/cmake/cores/Cortex-M23.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
3434
"--cpu=Cortex-M23"
3535
)
3636
endif()
37+
endfunction()
3738

39+
function(mbed_set_cpu_core_definitions target)
3840
target_compile_definitions(${target}
3941
INTERFACE
4042
__CORTEX_M23

tools/cmake/cores/Cortex-M3.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
3434
"--cpu=Cortex-M3"
3535
)
3636
endif()
37+
endfunction()
3738

39+
function(mbed_set_cpu_core_definitions target)
3840
target_compile_definitions(${target}
3941
INTERFACE
4042
__CORTEX_M3

tools/cmake/cores/Cortex-M33-NS.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
3636
"--cpu=Cortex-M33.no_dsp.no_fp"
3737
)
3838
endif()
39+
endfunction()
3940

41+
function(mbed_set_cpu_core_definitions target)
4042
target_compile_definitions(${target}
4143
INTERFACE
4244
__CORTEX_M33

tools/cmake/cores/Cortex-M33.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
3838
"--cpu=Cortex-M33.no_dsp.no_fp"
3939
)
4040
endif()
41+
endfunction()
4142

43+
function(mbed_set_cpu_core_definitions target)
4244
target_compile_definitions(${target}
4345
INTERFACE
4446
__CORTEX_M33

tools/cmake/cores/Cortex-M33F-NS.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ function(mbed_set_cpu_core_options target mbed_toolchain)
3939
"--cpu=Cortex-M33.no_dsp"
4040
)
4141
endif()
42+
endfunction()
4243

44+
function(mbed_set_cpu_core_definitions target)
4345
target_compile_definitions(${target}
4446
INTERFACE
4547
__CORTEX_M33

0 commit comments

Comments
 (0)