From 7e13081776db8341b5f9793f6bd529410c75ec91 Mon Sep 17 00:00:00 2001 From: Andre Guedes Date: Wed, 1 Jul 2015 18:20:20 -0300 Subject: [PATCH] galileo: Print elf sections sizes after build This patch changes Galileo's buildsystem to print the elf sections sizes after a new image is built. This way we can easily track how these sections increase or decrease after any change. To achieve that, we define a custom linking rule which is pretty much the same as the default linking rule define in Makefile.include, but we run 'size' command after the image is built. --- cpu/x86/Makefile.x86 | 1 + platform/galileo/Makefile.customrules-galileo | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/cpu/x86/Makefile.x86 b/cpu/x86/Makefile.x86 index 46ab27817..899b78bd3 100644 --- a/cpu/x86/Makefile.x86 +++ b/cpu/x86/Makefile.x86 @@ -7,6 +7,7 @@ CC = gcc LD = gcc AS = as OBJCOPY = objcopy +SIZE = size STRIP = strip CFLAGSNO = -Wall -g -I/usr/local/include CFLAGS += $(CFLAGSNO) diff --git a/platform/galileo/Makefile.customrules-galileo b/platform/galileo/Makefile.customrules-galileo index 0ab0e662c..eceebb9c4 100644 --- a/platform/galileo/Makefile.customrules-galileo +++ b/platform/galileo/Makefile.customrules-galileo @@ -6,3 +6,10 @@ OPENOCD_SCRIPTS = $(CONTIKI)/platform/galileo/bsp/openocd-scripts debug: $(CONTIKI_PROJECT).$(TARGET) @openocd -s $(OPENOCD_SCRIPTS) -f debug.cfg &> $(shell pwd)/LOG_OPENOCD & @$(GDB) $< -ex "target remote :3333" + +CUSTOM_RULE_LINK=1 +%.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a + $(TRACE_LD) + $(Q)$(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} \ + ${filter %.a,$^} $(TARGET_LIBFILES) -o $@ + @$(SIZE) $@