Skip to content

Commit 0972738

Browse files
Rebase linker script change properly, re-add external toolchain file support
1 parent f07c0cd commit 0972738

File tree

4 files changed

+8
-14
lines changed

4 files changed

+8
-14
lines changed

CMakeLists.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ endif()
5454

5555
mbed_set_cpu_core_definitions(mbed-core)
5656
if(${MBED_TOOLCHAIN_FILE_USED})
57-
mbed_set_toolchain_options(mbed-core)
5857
mbed_set_profile_options(mbed-core ${MBED_TOOLCHAIN})
5958
mbed_set_c_lib(mbed-core ${MBED_C_LIB})
6059
mbed_set_printf_lib(mbed-core ${MBED_PRINTF_LIB})
@@ -134,7 +133,7 @@ function(mbed_set_mbed_target_linker_script target)
134133
if(MBED_TOOLCHAIN STREQUAL "GCC_ARM")
135134
set(CMAKE_PRE_BUILD_COMMAND
136135
COMMAND "arm-none-eabi-cpp" ${_linker_preprocess_definitions} -x assembler-with-cpp -E -Wp,-P
137-
${mbed_target_linker_script} -o ${CMAKE_BINARY_DIR}/${APP_NAME}.link_script.ld
136+
${mbed_target_linker_script} -o ${CMAKE_BINARY_DIR}/${target}.link_script.ld
138137

139138
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
140139
BYPRODUCTS "${CMAKE_BINARY_DIR}/${target}.link_script.ld"

tools/cmake/app.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@ endif()
1010
include(${MBED_CONFIG_PATH}/mbed_config.cmake)
1111

1212
# Load toolchain file
13-
set(MBED_TOOLCHAIN_FILE_USED TRUE CACHE INTERNAL "")
14-
include(${MBED_PATH}/tools/cmake/toolchain.cmake)
13+
if(NOT CMAKE_TOOLCHAIN_FILE OR MBED_TOOLCHAIN_FILE_USED)
14+
set(MBED_TOOLCHAIN_FILE_USED TRUE CACHE INTERNAL "")
15+
include(${MBED_PATH}/tools/cmake/toolchain.cmake)
16+
endif()
1517

1618
# Specify available build profiles and add options for the selected build profile
1719
include(${MBED_PATH}/tools/cmake/profile.cmake)

tools/cmake/toolchains/ARM.cmake

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,11 @@ list(APPEND link_options
3737

3838
# Add linking time preprocessor macro for TFM targets
3939
if(MBED_CPU_CORE MATCHES "-NS$")
40-
)
40+
list(APPEND link_options
41+
"--predefine=\"-DDOMAIN_NS=0x1\""
42+
)
4143
endif()
4244

43-
function(mbed_set_toolchain_options target)
44-
# blank for ARMClang
45-
endfunction()
46-
4745
# Configure the toolchain to select the selected C library
4846
function(mbed_set_c_lib target lib_type)
4947
if (${lib_type} STREQUAL "small")

tools/cmake/toolchains/GCC_ARM.cmake

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ set(CMAKE_CXX_COMPILER "arm-none-eabi-g++")
77
set(GCC_ELF2BIN "arm-none-eabi-objcopy")
88
set_property(GLOBAL PROPERTY ELF2BIN ${GCC_ELF2BIN})
99

10-
# Sets toolchain options for a target
11-
function(mbed_set_toolchain_options target)
12-
13-
endfunction(mbed_set_toolchain_options)
14-
1510
# build toolchain flags that get passed to everything (including CMake compiler checks)
1611
list(APPEND link_options
1712
"-Wl,--start-group"

0 commit comments

Comments
 (0)