@@ -75,21 +75,13 @@ endfunction()
75
75
# Specifies linker script used for linking `target`.
76
76
#
77
77
function (mbed_set_mbed_target_linker_script target )
78
- get_property (mbed_target_startup GLOBAL PROPERTY MBED_TARGET_LINKER_FILE )
79
-
80
- # TODO: @mbed-os-tools This pre-build commands should get details from target + profile.
78
+ get_property (mbed_target_linker_script GLOBAL PROPERTY MBED_TARGET_LINKER_FILE )
79
+ mbed_generate_gcc_options_for_linker (${target} _linker_preprocess_definitions _linker_preprocess_options )
81
80
if (MBED_TOOLCHAIN STREQUAL "GCC_ARM" )
82
81
set (CMAKE_PRE_BUILD_COMMAND
83
82
COMMAND "arm-none-eabi-cpp" -E -P
84
- -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r
85
- -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r
86
- -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n
87
- -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
88
- -DMBED_ROM_START=0x0 -DMBED_ROM_SIZE=0x100000 -DMBED_RAM_START=0x20000000
89
- -DMBED_RAM_SIZE=0x30000 -DMBED_RAM1_START=0x1fff0000
90
- -DMBED_RAM1_SIZE=0x10000 -DMBED_BOOT_STACK_SIZE=1024
91
- -DXIP_ENABLE=0
92
- ${mbed_target_startup} -o ${CMAKE_BINARY_DIR} /${target}.link_script.ld
83
+ ${_linker_preprocess_options} ${_linker_preprocess_definitions}
84
+ ${mbed_target_linker_script} -o ${CMAKE_BINARY_DIR} /${target}.link_script.ld
93
85
94
86
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
95
87
BYPRODUCTS "${CMAKE_BINARY_DIR} /${target} .link_script.ld"
@@ -98,7 +90,7 @@ function(mbed_set_mbed_target_linker_script target)
98
90
set (CMAKE_PRE_BUILD_COMMAND COMMAND "" )
99
91
target_link_options (mbed-os
100
92
PUBLIC
101
- "--scatter=${mbed_target_startup } "
93
+ "--scatter=${mbed_target_linker_script } "
102
94
)
103
95
endif ()
104
96
add_custom_command (
0 commit comments