mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-16 12:51:47 +00:00
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.
This commit is contained in:
parent
a57c4eabae
commit
7d9467e431
@ -7,7 +7,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
LUFA_BUILD_MODULES += BUILD
|
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_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
|
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:
|
# TARGETS:
|
||||||
#
|
#
|
||||||
# size - List built application size
|
# 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
|
# all - Build application and list size
|
||||||
# elf - Build application ELF debug object file
|
# elf - Build application ELF debug object file
|
||||||
# hex - Build application HEX object files
|
# 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_BUILD_END := Finished building project \"$(TARGET)\".
|
||||||
MSG_COMPILE_CMD := ' [CC] :'
|
MSG_COMPILE_CMD := ' [CC] :'
|
||||||
MSG_ASSEMBLE_CMD := ' [AS] :'
|
MSG_ASSEMBLE_CMD := ' [AS] :'
|
||||||
|
MSG_NM_CMD := ' [NM] :'
|
||||||
MSG_REMOVE_CMD := ' [RM] :'
|
MSG_REMOVE_CMD := ' [RM] :'
|
||||||
MSG_LINKER_CMD := ' [LNK] :'
|
MSG_LINKER_CMD := ' [LNK] :'
|
||||||
MSG_SIZE_CMD := ' [SIZE] :'
|
MSG_SIZE_CMD := ' [SIZE] :'
|
||||||
@ -175,12 +178,16 @@ check_source:
|
|||||||
fi; \
|
fi; \
|
||||||
done
|
done
|
||||||
|
|
||||||
size:
|
size: $(TARGET).elf
|
||||||
@echo $(MSG_SIZE_CMD) Determining size of \"$(TARGET).elf\"
|
@echo $(MSG_SIZE_CMD) Determining size of \"$(TARGET).elf\"
|
||||||
@if test -f $(TARGET).elf; then \
|
@if test -f $(TARGET).elf; then \
|
||||||
$(CROSS)size $(SIZE_MCU_FLAG) $(SIZE_FORMAT_FLAG) $(TARGET).elf ; 2>/dev/null; \
|
$(CROSS)size $(SIZE_MCU_FLAG) $(SIZE_FORMAT_FLAG) $(TARGET).elf ; 2>/dev/null; \
|
||||||
fi
|
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:
|
clean:
|
||||||
@echo $(MSG_REMOVE_CMD) Removing object files of \"$(TARGET)\"
|
@echo $(MSG_REMOVE_CMD) Removing object files of \"$(TARGET)\"
|
||||||
rm -f $(OBJECT_FILES)
|
rm -f $(OBJECT_FILES)
|
||||||
@ -228,4 +235,4 @@ lss: $(TARGET).lss
|
|||||||
-include $(DEPENDENCY_FILES)
|
-include $(DEPENDENCY_FILES)
|
||||||
|
|
||||||
# Phony build targets for this module
|
# Phony build targets for this module
|
||||||
.PHONY: begin end gcc_version check_source size elf hex lss clean
|
.PHONY: begin end gcc_version check_source size symbol-sizes elf hex lss clean
|
Loading…
Reference in New Issue
Block a user