@@ -22,47 +22,75 @@ function(mbed_generate_options_for_linker target output_response_file_path)
22
22
file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR} /compile_time_defs.txt" CONTENT "${_compile_definitions} \n " )
23
23
set (${output_response_file_path} @${CMAKE_CURRENT_BINARY_DIR}/compile_time_defs.txt PARENT_SCOPE )
24
24
endfunction ()
25
- # Set the system processor depending on the CPU core type
26
- if (MBED_CPU_CORE STREQUAL Cortex-A9 )
27
- set (CMAKE_SYSTEM_PROCESSOR cortex-a9 )
28
- elseif (MBED_CPU_CORE STREQUAL Cortex-A5 )
29
- set (CMAKE_SYSTEM_PROCESSOR cortex-a5 )
30
- elseif (MBED_CPU_CORE STREQUAL Cortex-M0+ )
31
- set (CMAKE_SYSTEM_PROCESSOR cortex-m0plus )
32
- elseif (MBED_CPU_CORE STREQUAL Cortex-M0 )
33
- set (CMAKE_SYSTEM_PROCESSOR cortex-m0 )
34
- elseif (MBED_CPU_CORE STREQUAL Cortex-M1 )
35
- set (CMAKE_SYSTEM_PROCESSOR cortex-m1 )
36
- elseif (MBED_CPU_CORE STREQUAL Cortex-M23-NS )
37
- set (CMAKE_SYSTEM_PROCESSOR cortex-m23 )
38
- elseif (MBED_CPU_CORE STREQUAL Cortex-M23 )
39
- set (CMAKE_SYSTEM_PROCESSOR cortex-m23 )
40
- elseif (MBED_CPU_CORE STREQUAL Cortex-M3 )
41
- set (CMAKE_SYSTEM_PROCESSOR cortex-m3 )
42
- elseif (MBED_CPU_CORE STREQUAL Cortex-M33-NS )
43
- set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
44
- elseif (MBED_CPU_CORE STREQUAL Cortex-M33 )
45
- set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
46
- elseif (MBED_CPU_CORE STREQUAL Cortex-M33F-NS )
47
- set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
48
- elseif (MBED_CPU_CORE STREQUAL Cortex-M33F )
49
- set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
50
- elseif (MBED_CPU_CORE STREQUAL Cortex-M33FE-NS )
51
- set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
52
- elseif (MBED_CPU_CORE STREQUAL Cortex-M33FE )
53
- set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
54
- elseif (MBED_CPU_CORE STREQUAL Cortex-M4 )
55
- set (CMAKE_SYSTEM_PROCESSOR cortex-m4 )
56
- elseif (MBED_CPU_CORE STREQUAL Cortex-M4F )
57
- set (CMAKE_SYSTEM_PROCESSOR cortex-m4 )
58
- elseif (MBED_CPU_CORE STREQUAL Cortex-M55 )
59
- set (CMAKE_SYSTEM_PROCESSOR cortex-m55 )
60
- elseif (MBED_CPU_CORE STREQUAL Cortex-M7 )
61
- set (CMAKE_SYSTEM_PROCESSOR cortex-m7 )
62
- elseif (MBED_CPU_CORE STREQUAL Cortex-M7F )
63
- set (CMAKE_SYSTEM_PROCESSOR cortex-m7 )
64
- elseif (MBED_CPU_CORE STREQUAL Cortex-M7FD )
65
- set (CMAKE_SYSTEM_PROCESSOR cortex-m7 )
25
+
26
+ # Backward compatibility with older CMake which uses CMAKE_SYSTEM_PROCESSOR to
27
+ # automatically add compile and link options for the Arm Compiler.
28
+ # Note: From version 3.21, CMake by default (policy CMP0123 set to NEW) does not
29
+ # use this macro anymore, and projects have full control over compile and link
30
+ # options. This is because the old algorithm based on CMAKE_SYSTEM_PROCESSOR
31
+ # is too restrictive and does not support things like Cortex-M33.no_dsp.no_fp.
32
+ if (MBED_TOOLCHAIN STREQUAL "ARM" )
33
+ if (NOT POLICY CMP0123 )
34
+ # Old versions of CMake do not have CMP0123.
35
+ # In the future, support for old versions of CMake will be
36
+ # dropped from Mbed OS.
37
+ set (deprecated_system_processor ON )
38
+ else ()
39
+ cmake_policy (GET CMP0123 policy_CMP0123 )
40
+ if ("${policy_CMP0123} " STREQUAL "" )
41
+ # CMP0123 is unset if an old `cmake_minimum_required()` is used with a
42
+ # new CMake. Enable new CMP0123 to take advantage of the improvement
43
+ # and dismiss deprecation warnings from CMake.
44
+ cmake_policy (SET CMP0123 NEW )
45
+ elseif ("${policy_CMP0123} " STREQUAL "OLD" )
46
+ # Respect old CMP0123 forced by user application
47
+ set (deprecated_system_processor ON )
48
+ endif ()
49
+ endif ()
50
+ endif ()
51
+
52
+ if (deprecated_system_processor )
53
+ if (MBED_CPU_CORE STREQUAL Cortex-A9 )
54
+ set (CMAKE_SYSTEM_PROCESSOR cortex-a9 )
55
+ elseif (MBED_CPU_CORE STREQUAL Cortex-A5 )
56
+ set (CMAKE_SYSTEM_PROCESSOR cortex-a5 )
57
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M0+ )
58
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m0plus )
59
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M0 )
60
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m0 )
61
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M1 )
62
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m1 )
63
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M23-NS )
64
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m23 )
65
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M23 )
66
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m23 )
67
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M3 )
68
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m3 )
69
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M33-NS )
70
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
71
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M33 )
72
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
73
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M33F-NS )
74
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
75
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M33F )
76
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
77
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M33FE-NS )
78
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
79
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M33FE )
80
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m33 )
81
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M4 )
82
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m4 )
83
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M4F )
84
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m4 )
85
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M55 )
86
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m55 )
87
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M7 )
88
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m7 )
89
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M7F )
90
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m7 )
91
+ elseif (MBED_CPU_CORE STREQUAL Cortex-M7FD )
92
+ set (CMAKE_SYSTEM_PROCESSOR cortex-m7 )
93
+ endif ()
66
94
endif ()
67
95
68
96
# Compiler setup
0 commit comments