Skip to content

Commit dc8527a

Browse files
Add size info, if elf-size-analyze is installed on the system
1 parent 75f14b1 commit dc8527a

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

CMakeLists.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,3 +144,16 @@ add_custom_target(upload
144144
COMMAND docker run --rm --network=host -v ${CMAKE_BINARY_DIR}:/workdir ghcr.io/xtech/fw-xcore-boot:latest -i tap0 upload /workdir/${CMAKE_PROJECT_NAME}.bin
145145
DEPENDS ${CMAKE_PROJECT_NAME}
146146
)
147+
148+
# Check if elf-size-analyze is available
149+
find_program(ELF_SIZE_ANALYZE_EXECUTABLE elf-size-analyze)
150+
151+
if(ELF_SIZE_ANALYZE_EXECUTABLE)
152+
add_custom_command(
153+
TARGET ${CMAKE_PROJECT_NAME} POST_BUILD
154+
COMMAND ${ELF_SIZE_ANALYZE_EXECUTABLE} -R -t arm-none-eabi- ${CMAKE_PROJECT_NAME}.elf
155+
COMMENT "Running elf-size-analyze on target binary..."
156+
)
157+
else()
158+
message(WARNING "elf-size-analyze not found! Skipping size analysis.")
159+
endif()

0 commit comments

Comments
 (0)