Skip to content

Commit

Permalink
add depth, json and html to memap (ARMmbed#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
JojoS62 authored Nov 13, 2022
1 parent 72832c7 commit e4469c3
Showing 1 changed file with 48 additions and 8 deletions.
56 changes: 48 additions & 8 deletions tools/cmake/mbed_target_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,54 @@ endfunction()
# Parse toolchain generated map file of `target` and display a readable table format.
#
function(mbed_generate_map_file target)
add_custom_command(
TARGET
${target}
POST_BUILD
COMMAND ${Python3_EXECUTABLE} ${mbed-os_SOURCE_DIR}/tools/memap.py -t ${MBED_TOOLCHAIN} ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}
)
# set default args for memap.py
set(MBED_MEMAP_DEPTH "2" CACHE STRING "directory depth level to display report")
set(MBED_MEMAP_CREATE_JSON FALSE CACHE BOOL "create report in json file")
set(MBED_MEMAP_CREATE_HTML FALSE CACHE BOOL "create report in html file")

# generate table for screen
add_custom_command(
TARGET
${target}
POST_BUILD
COMMAND ${Python3_EXECUTABLE} ${mbed-os_SOURCE_DIR}/tools/memap.py
-t ${MBED_TOOLCHAIN} ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
--depth ${MBED_MEMAP_DEPTH}
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}
)

# generate json file
if (${MBED_MEMAP_CREATE_JSON})
add_custom_command(
TARGET
${target}
POST_BUILD
COMMAND ${Python3_EXECUTABLE} ${mbed-os_SOURCE_DIR}/tools/memap.py
-t ${MBED_TOOLCHAIN} ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
--depth ${MBED_MEMAP_DEPTH}
-e json
-o ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.memmap.json
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}
)
endif()

# generate html file
if (${MBED_MEMAP_CREATE_HTML})
add_custom_command(
TARGET
${target}
POST_BUILD
COMMAND ${Python3_EXECUTABLE} ${mbed-os_SOURCE_DIR}/tools/memap.py
-t ${MBED_TOOLCHAIN} ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.map
--depth ${MBED_MEMAP_DEPTH}
-e html
-o ${CMAKE_CURRENT_BINARY_DIR}/${target}${CMAKE_EXECUTABLE_SUFFIX}.memmap.html
WORKING_DIRECTORY
${CMAKE_CURRENT_BINARY_DIR}
)
endif()
endfunction()

#
Expand Down

0 comments on commit e4469c3

Please sign in to comment.