CMake: move Gcc Arm memmap to configure app

This allows us to keep all in one place and fix (removing this function later)
pull/14265/head
Martin Kojtal 2021-02-10 19:37:40 +00:00
parent 8be5da2619
commit 207dcbb88b
2 changed files with 12 additions and 3 deletions

View File

@ -136,6 +136,7 @@ endif()
#
# Configures the application
# Note, this function will be removed in the next revisions
#
function(mbed_configure_app_target target)
# We need to generate a "response file" to pass to the C preprocessor because of path length
@ -146,6 +147,16 @@ function(mbed_configure_app_target target)
# using global properties.
mbed_generate_options_for_linker(${target} LINKER_PREPROCESS_DEFINITIONS)
set_property(GLOBAL PROPERTY COMPILE_DEFS_RESPONSE_FILE ${LINKER_PREPROCESS_DEFINITIONS})
# Gcc Arm requires memap to be set with app name, equally to ARMClang
# TODO: move this to toolchain and set properly
if(MBED_TOOLCHAIN STREQUAL "GCC_ARM")
message(${target})
target_link_options(mbed-core
INTERFACE
"-Wl,-Map=${CMAKE_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map"
)
endif()
endfunction()
#

View File

@ -35,11 +35,9 @@ function(mbed_set_linker_script input_target raw_linker_script_path)
set(LinkerScriptTarget ${input_target}LinkerScript)
add_custom_target(${LinkerScriptTarget} DEPENDS ${LINKER_SCRIPT_PATH} VERBATIM)
add_dependencies(${input_target} ${LinkerScriptTarget})
# We hardcore mmemory file to "application"
target_link_options(${input_target}
INTERFACE
"-T" "${LINKER_SCRIPT_PATH}"
"-Wl,-Map=${CMAKE_BINARY_DIR}/application${CMAKE_EXECUTABLE_SUFFIX}.map"
"-T" "${LINKER_SCRIPT_PATH}"
)
elseif(MBED_TOOLCHAIN STREQUAL "ARM")
target_link_options(${input_target}