Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | # SPDX-License-Identifier: Apache-2.0
set(flag_for_ram_report ram)
set(flag_for_rom_report rom)
set(flag_for_footprint all -q)
set(report_depth 99)
if(DEFINED ZEPHYR_WORKSPACE)
set(workspace_arg "--workspace=${ZEPHYR_WORKSPACE}")
elseif(DEFINED WEST_TOPDIR)
set(workspace_arg "--workspace=${WEST_TOPDIR}")
endif()
foreach(report ram_report rom_report footprint)
add_custom_target(
${report}
${PYTHON_EXECUTABLE}
${ZEPHYR_BASE}/scripts/footprint/size_report
-k ${ZEPHYR_BINARY_DIR}/${KERNEL_ELF_NAME}
-z ${ZEPHYR_BASE}
-o ${CMAKE_BINARY_DIR}
${workspace_arg}
-d ${report_depth}
${flag_for_${report}}
DEPENDS ${logical_target_for_zephyr_elf}
$<TARGET_PROPERTY:zephyr_property_target,${report}_DEPENDENCIES>
USES_TERMINAL
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
endforeach()
if (CONFIG_BUILD_WITH_TFM)
foreach(report ram_report rom_report footprint)
add_custom_target(
tfm_${report}
${PYTHON_EXECUTABLE}
${ZEPHYR_BASE}/scripts/footprint/size_report
-k $<TARGET_PROPERTY:tfm,TFM_S_ELF_FILE>
-z ${ZEPHYR_BASE}
-o ${CMAKE_BINARY_DIR}
${workspace_arg}
-d ${report_depth}
${flag_for_${report}}
DEPENDS tfm
USES_TERMINAL
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
endforeach()
endif()
if (CONFIG_TFM_BL2)
foreach(report ram_report rom_report footprint)
add_custom_target(
bl2_${report}
${PYTHON_EXECUTABLE}
${ZEPHYR_BASE}/scripts/footprint/size_report
-k $<TARGET_PROPERTY:tfm,BL2_ELF_FILE>
-z ${ZEPHYR_BASE}
-o ${CMAKE_BINARY_DIR}
${workspace_arg}
-d ${report_depth}
${flag_for_${report}}
DEPENDS tfm
USES_TERMINAL
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
endforeach()
endif()
find_program(PUNCOVER puncover)
if(NOT ${PUNCOVER} STREQUAL PUNCOVER-NOTFOUND)
add_custom_target(
puncover
${PUNCOVER}
--elf_file ${ZEPHYR_BINARY_DIR}/${KERNEL_ELF_NAME}
--gcc_tools_base ${CROSS_COMPILE}
--src_root ${ZEPHYR_BASE}
--build_dir ${CMAKE_BINARY_DIR}
DEPENDS ${logical_target_for_zephyr_elf}
$<TARGET_PROPERTY:zephyr_property_target,${report}_DEPENDENCIES>
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
USES_TERMINAL
)
endif()
find_program(PAHOLE pahole)
if(NOT ${PAHOLE} STREQUAL PAHOLE-NOTFOUND)
add_custom_target(
pahole
${PAHOLE}
--anon_include
--nested_anon_include
--show_decl_info
$<$<BOOL:${CMAKE_VERBOSE_MAKEFILE}>:--verbose>
${ZEPHYR_BINARY_DIR}/${KERNEL_ELF_NAME}
DEPENDS ${logical_target_for_zephyr_elf}
$<TARGET_PROPERTY:zephyr_property_target,${report}_DEPENDENCIES>
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
USES_TERMINAL
)
endif()
|