mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #14299 from hugueskamba/hk_cmake_refactor_mapfile_generation
CMake: Refactor mapfile generationpull/14355/head
commit
eceaea54fd
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (c) 2020 ARM Limited. All rights reserved.
|
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
# This is the boilerplate for Mbed OS
|
# This is the boilerplate for Mbed OS
|
||||||
|
@ -139,21 +139,6 @@ string(PREPEND MBED_TARGET_CONVERTED "mbed-")
|
||||||
|
|
||||||
target_link_libraries(mbed-core INTERFACE ${MBED_TARGET_CONVERTED})
|
target_link_libraries(mbed-core INTERFACE ${MBED_TARGET_CONVERTED})
|
||||||
|
|
||||||
#
|
|
||||||
# Configures the application
|
|
||||||
# Note, this function will be removed in the next revisions
|
|
||||||
#
|
|
||||||
function(mbed_configure_app_target target)
|
|
||||||
# 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")
|
|
||||||
target_link_options(mbed-core
|
|
||||||
INTERFACE
|
|
||||||
"-Wl,-Map=${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Converts output file of `target` to binary file and to Intel HEX file.
|
# Converts output file of `target` to binary file and to Intel HEX file.
|
||||||
#
|
#
|
||||||
|
@ -233,6 +218,10 @@ endfunction()
|
||||||
# Set post build operations
|
# Set post build operations
|
||||||
#
|
#
|
||||||
function(mbed_set_post_build target)
|
function(mbed_set_post_build target)
|
||||||
|
# The mapfile name includes the top-level target name and the
|
||||||
|
# executable suffix for all toolchains as CMake hardcodes the name of the
|
||||||
|
# diagnostic output file for some toolchains.
|
||||||
|
mbed_configure_memory_map(mbed-core "${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map")
|
||||||
mbed_validate_application_profile(${target})
|
mbed_validate_application_profile(${target})
|
||||||
mbed_generate_bin_hex(${target})
|
mbed_generate_bin_hex(${target})
|
||||||
|
|
||||||
|
@ -249,3 +238,7 @@ if ("${CMAKE_GENERATOR}" MATCHES "Ninja")
|
||||||
set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "")
|
set(CMAKE_NINJA_FORCE_RESPONSE_FILE 1 CACHE INTERNAL "")
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# TODO: Remove once all example applications have removed it
|
||||||
|
function(mbed_configure_app_target target)
|
||||||
|
endfunction()
|
||||||
|
|
|
@ -31,10 +31,6 @@ list(APPEND asm_compile_options
|
||||||
--target=arm-arm-none-eabi
|
--target=arm-arm-none-eabi
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND link_options
|
|
||||||
"--map"
|
|
||||||
)
|
|
||||||
|
|
||||||
# Add linking time preprocessor macro for TFM targets
|
# Add linking time preprocessor macro for TFM targets
|
||||||
if(MBED_CPU_CORE MATCHES "-NS$")
|
if(MBED_CPU_CORE MATCHES "-NS$")
|
||||||
list(APPEND link_options
|
list(APPEND link_options
|
||||||
|
@ -67,3 +63,15 @@ function(mbed_set_printf_lib target lib_type)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# Add linker flags to generate a mapfile with a given name
|
||||||
|
# `mapfile` is overridden as CMake provides the name of the diagnostic output
|
||||||
|
# file by providing armlink with the --list command line option.
|
||||||
|
# See https://gitlab.kitware.com/cmake/cmake/-/issues/21538
|
||||||
|
function(mbed_configure_memory_map target mapfile)
|
||||||
|
target_link_options(${target}
|
||||||
|
INTERFACE
|
||||||
|
"--map"
|
||||||
|
"--list=${mapfile}"
|
||||||
|
)
|
||||||
|
endfunction()
|
||||||
|
|
|
@ -84,3 +84,11 @@ function(mbed_set_printf_lib target lib_type)
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
# Add linker flags to generate a mapfile with a given name
|
||||||
|
function(mbed_configure_memory_map target mapfile)
|
||||||
|
target_link_options(${target}
|
||||||
|
INTERFACE
|
||||||
|
"-Wl,-Map=${mapfile}"
|
||||||
|
)
|
||||||
|
endfunction()
|
||||||
|
|
Loading…
Reference in New Issue