File tree Expand file tree Collapse file tree 3 files changed +23
-23
lines changed Expand file tree Collapse file tree 3 files changed +23
-23
lines changed Original file line number Diff line number Diff line change @@ -132,8 +132,8 @@ endfunction()
132
132
#
133
133
function (mbed_set_mbed_target_linker_script target )
134
134
get_property (mbed_target_linker_script GLOBAL PROPERTY MBED_TARGET_LINKER_FILE )
135
+ mbed_generate_options_for_linker (${target} _linker_preprocess_definitions )
135
136
if (MBED_TOOLCHAIN STREQUAL "GCC_ARM" )
136
- mbed_generate_gcc_options_for_linker (${target} _linker_preprocess_definitions )
137
137
set (CMAKE_PRE_BUILD_COMMAND
138
138
COMMAND "arm-none-eabi-cpp" ${_linker_preprocess_definitions} -x assembler-with-cpp -E -Wp,-P
139
139
${mbed_target_linker_script} -o ${CMAKE_BINARY_DIR} /${target}.link_script.ld
@@ -146,6 +146,7 @@ function(mbed_set_mbed_target_linker_script target)
146
146
target_link_options (mbed-core
147
147
INTERFACE
148
148
"--scatter=${mbed_target_linker_script} "
149
+ "--predefine=${_linker_preprocess_definitions} "
149
150
)
150
151
endif ()
151
152
add_custom_command (
Original file line number Diff line number Diff line change 1
1
# Copyright (c) 2020 ARM Limited. All rights reserved.
2
2
# SPDX-License-Identifier: Apache-2.0
3
3
4
+ # Generate a file containing compile definitions
5
+ function (mbed_generate_options_for_linker target definitions_file )
6
+ set (_compile_definitions
7
+ "$<TARGET_PROPERTY:${target} ,COMPILE_DEFINITIONS>"
8
+ )
9
+
10
+ # Remove macro definitions that contain spaces as the lack of escape sequences and quotation marks
11
+ # in the macro when retrieved using generator expressions causes linker errors.
12
+ # This includes string macros, array macros, and macros with operations.
13
+ # TODO CMake: Add escape sequences and quotation marks where necessary instead of removing these macros.
14
+ set (_compile_definitions
15
+ "$<FILTER:${_compile_definitions} ,EXCLUDE, +>"
16
+ )
17
+
18
+ # Append -D to all macros as we pass these as response file to cxx compiler
19
+ set (_compile_definitions
20
+ "$<$<BOOL:${_compile_definitions} >:-D$<JOIN:${_compile_definitions} , -D>>"
21
+ )
22
+ file (GENERATE OUTPUT "${CMAKE_BINARY_DIR} /compile_time_defs.txt" CONTENT "${_compile_definitions} \n " )
23
+ set (${definitions_file} @${CMAKE_BINARY_DIR}/compile_time_defs.txt PARENT_SCOPE )
24
+ endfunction ()
4
25
# Set the system processor depending on the CPU core type
5
26
if (MBED_CPU_CORE STREQUAL Cortex-A9 )
6
27
set (CMAKE_SYSTEM_PROCESSOR cortex-a9 )
Original file line number Diff line number Diff line change @@ -58,28 +58,6 @@ function(mbed_set_toolchain_options target)
58
58
)
59
59
endfunction ()
60
60
61
- # Generate a file containing compile definitions
62
- function (mbed_generate_gcc_options_for_linker target definitions_file )
63
- set (_compile_definitions
64
- "$<TARGET_PROPERTY:${target} ,COMPILE_DEFINITIONS>"
65
- )
66
-
67
- # Remove macro definitions that contain spaces as the lack of escape sequences and quotation marks
68
- # in the macro when retrieved using generator expressions causes linker errors.
69
- # This includes string macros, array macros, and macros with operations.
70
- # TODO CMake: Add escape sequences and quotation marks where necessary instead of removing these macros.
71
- set (_compile_definitions
72
- "$<FILTER:${_compile_definitions} ,EXCLUDE, +>"
73
- )
74
-
75
- # Append -D to all macros as we pass these as response file to cxx compiler
76
- set (_compile_definitions
77
- "$<$<BOOL:${_compile_definitions} >:-D$<JOIN:${_compile_definitions} , -D>>"
78
- )
79
- file (GENERATE OUTPUT "${CMAKE_BINARY_DIR} /compile_time_defs.txt" CONTENT "${_compile_definitions} \n " )
80
- set (${definitions_file} @${CMAKE_BINARY_DIR}/compile_time_defs.txt PARENT_SCOPE )
81
- endfunction ()
82
-
83
61
# Configure the toolchain to select the selected C library
84
62
function (mbed_set_c_lib target lib_type )
85
63
if (${lib_type} STREQUAL "small" )
You can’t perform that action at this time.
0 commit comments