mirror of https://github.com/ARMmbed/mbed-os.git
CMake: Add a function to generate executable artifacts with memap (#13695)
- Add linker option to generate map file for GCC_ARM and ARM toolchain - Add mbed_generate_map_file function to call memap.py (parse the map file). - Add mbed_generate_executable function to generate executable artifacts with a memory map tablepull/13566/head
parent
22dd57b35b
commit
d84baa8fa1
|
@ -167,3 +167,28 @@ function(mbed_generate_bin_hex target)
|
|||
VERBATIM
|
||||
)
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Parse toolchain generated map file of `target` and display a readable table format.
|
||||
#
|
||||
function(mbed_generate_map_file target)
|
||||
find_package (Python3)
|
||||
add_custom_command(
|
||||
TARGET
|
||||
${target}
|
||||
POST_BUILD
|
||||
COMMAND ${Python3_EXECUTABLE} ${MBED_ROOT}/tools/memap.py -t ${MBED_TOOLCHAIN} -d 4 ${CMAKE_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
|
||||
WORKING_DIRECTORY
|
||||
${CMAKE_BINARY_DIR}
|
||||
COMMENT
|
||||
"Displaying memory map for ${target}"
|
||||
)
|
||||
endfunction()
|
||||
|
||||
#
|
||||
# Generate executables
|
||||
#
|
||||
function(mbed_generate_executable target)
|
||||
mbed_generate_bin_hex(${target})
|
||||
mbed_generate_map_file(${target})
|
||||
endfunction()
|
||||
|
|
|
@ -55,6 +55,7 @@ function(mbed_set_toolchain_options target)
|
|||
|
||||
list(APPEND link_options
|
||||
"${MBED_STUDIO_ARM_COMPILER}"
|
||||
"--map"
|
||||
)
|
||||
|
||||
# Add linking time preprocessor macro for TFM targets
|
||||
|
|
|
@ -21,6 +21,8 @@ function(mbed_set_toolchain_options target)
|
|||
"-Wl,--end-group"
|
||||
"-specs=nosys.specs"
|
||||
"-T" "${CMAKE_BINARY_DIR}/${APP_TARGET}.link_script.ld"
|
||||
"-Wl,-Map=${CMAKE_BINARY_DIR}/${APP_TARGET}.map"
|
||||
"-Wl,--cref"
|
||||
)
|
||||
|
||||
# Add linking time preprocessor macro for TFM targets
|
||||
|
|
Loading…
Reference in New Issue