From 7d9467e431c224ad0996bf64ab8d549b995d6259 Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Mon, 4 Jun 2012 15:38:45 +0000 Subject: Add symbol-sizes target to the BUILD build system module to print a size-sorted list of symbols from a compiled application, in decimal bytes. --- LUFA/Build/lufa.build.in | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/LUFA/Build/lufa.build.in b/LUFA/Build/lufa.build.in index b81f6a563..8be02c37b 100644 --- a/LUFA/Build/lufa.build.in +++ b/LUFA/Build/lufa.build.in @@ -7,7 +7,7 @@ # LUFA_BUILD_MODULES += BUILD -LUFA_BUILD_TARGETS += size all elf hex lss clean +LUFA_BUILD_TARGETS += size symbol-sizes all elf hex lss clean LUFA_BUILD_MANDATORY_VARS += TARGET ARCH MCU SRC F_USB LUFA_PATH LUFA_BUILD_OPTIONAL_VARS += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_FLAGS CPP_FLAGS ASM_FLAGS CC_FLAGS LD_FLAGS @@ -21,6 +21,8 @@ LUFA_BUILD_OPTIONAL_VARS += BOARD OPTIMIZATION C_STANDARD CPP_STANDARD F_CPU C_ # TARGETS: # # size - List built application size +# symbol-sizes - Print application symbols from the binary ELF +# file as a list sorted by size in bytes # all - Build application and list size # elf - Build application ELF debug object file # hex - Build application HEX object files @@ -101,6 +103,7 @@ MSG_BUILD_BEGIN := Begin compilation of project \"$(TARGET)\"... MSG_BUILD_END := Finished building project \"$(TARGET)\". MSG_COMPILE_CMD := ' [CC] :' MSG_ASSEMBLE_CMD := ' [AS] :' +MSG_NM_CMD := ' [NM] :' MSG_REMOVE_CMD := ' [RM] :' MSG_LINKER_CMD := ' [LNK] :' MSG_SIZE_CMD := ' [SIZE] :' @@ -175,12 +178,16 @@ check_source: fi; \ done -size: +size: $(TARGET).elf @echo $(MSG_SIZE_CMD) Determining size of \"$(TARGET).elf\" @if test -f $(TARGET).elf; then \ $(CROSS)size $(SIZE_MCU_FLAG) $(SIZE_FORMAT_FLAG) $(TARGET).elf ; 2>/dev/null; \ fi +symbol-sizes: $(TARGET).elf + @echo $(MSG_NM_CMD) Extracting \"$(TARGET).elf\" symbols with decimal byte sizes + avr-nm --size-sort --demangle --radix=d $(TARGET).elf + clean: @echo $(MSG_REMOVE_CMD) Removing object files of \"$(TARGET)\" rm -f $(OBJECT_FILES) @@ -228,4 +235,4 @@ lss: $(TARGET).lss -include $(DEPENDENCY_FILES) # Phony build targets for this module -.PHONY: begin end gcc_version check_source size elf hex lss clean \ No newline at end of file +.PHONY: begin end gcc_version check_source size symbol-sizes elf hex lss clean \ No newline at end of file -- cgit v1.2.3