From 4e7abb09c27a9382495670a7324397ea0ad5b393 Mon Sep 17 00:00:00 2001 From: Niclas Finne Date: Mon, 17 Feb 2014 14:22:08 +0100 Subject: [PATCH 1/3] Support verbosity control when building for STM32W-based platforms --- cpu/stm32w108/Makefile.stm32w108 | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/cpu/stm32w108/Makefile.stm32w108 b/cpu/stm32w108/Makefile.stm32w108 index 29e2f9c72..5fcb0dcef 100644 --- a/cpu/stm32w108/Makefile.stm32w108 +++ b/cpu/stm32w108/Makefile.stm32w108 @@ -229,18 +229,21 @@ endif CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 $(OBJECTDIR)/%.o: %.c | $(OBJECTDIR) - $(CC) $(CFLAGS) $< --dependencies=m $(@:.o=.P) -o $@ + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) $< --dependencies=m $(@:.o=.P) -o $@ @$(SEDCOMMAND); rm -f $(@:.o=.P) @$(FINALIZE_DEPENDENCY) CUSTOM_RULE_C_TO_CO = 1 %.co: %.c - $(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@ + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@ else #IAR CUSTOM_RULE_C_TO_CE = 1 %.ce: %.c - $(CC) $(CFLAGS) -fno-merge-constants -fno-function-sections -DAUTOSTART_ENABLE -c $< -o $@ + $(TRACE_CC) + $(Q)$(CC) $(CFLAGS) -fno-merge-constants -fno-function-sections -DAUTOSTART_ENABLE -c $< -o $@ $(STRIP) --strip-unneeded -g -x $@ CUSTOM_RULE_LINK = 1 @@ -259,12 +262,14 @@ symbols.c symbols.h: endif %.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(OBJECTDIR)/symbols.o - $(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} -Wl,-\( ${filter %.a,$^} $(TARGET_LIBFILES) -Wl,-\) -o $@ + $(TRACE_LD) + $(Q)$(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} -Wl,-\( ${filter %.a,$^} $(TARGET_LIBFILES) -Wl,-\) -o $@ @echo >> contiki-$(TARGET).map @$(SIZE) $(SIZEFLAGS) $@ >> contiki-$(TARGET).map #%.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_OBJECTFILES) -# $(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@ +# $(TRACE_LD) +# $(Q)$(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@ # @echo "\n" >> contiki-$(TARGET).map # @$(SIZE) $(SIZEFLAGS) $@ >> contiki-$(TARGET).map @@ -283,10 +288,12 @@ stm-motes: @echo $(MOTES) $(OBJECTDIR)/%.o: %.s79 | $(OBJECTDIR) - $(AS) $(ASFLAGS) -o $@ $< + $(TRACE_AS) + $(Q)$(AS) $(ASFLAGS) -o $@ $< $(OBJECTDIR)/%.o: %.s | $(OBJECTDIR) - $(AS) $(ASFLAGS) -o $@ $< + $(TRACE_AS) + $(Q)$(AS) $(ASFLAGS) -o $@ $< %.bin: %.$(TARGET) $(OBJCOPY) $(OBJOPTS) $< $@ From 0122373fdccf5a041e6d0fac970a942ab67ca73c Mon Sep 17 00:00:00 2001 From: Niclas Finne Date: Mon, 17 Feb 2014 14:26:04 +0100 Subject: [PATCH 2/3] OBJECTDIR is defined by Makefile.include --- cpu/stm32w108/Makefile.stm32w108 | 2 -- 1 file changed, 2 deletions(-) diff --git a/cpu/stm32w108/Makefile.stm32w108 b/cpu/stm32w108/Makefile.stm32w108 index 5fcb0dcef..76ac36faf 100644 --- a/cpu/stm32w108/Makefile.stm32w108 +++ b/cpu/stm32w108/Makefile.stm32w108 @@ -207,8 +207,6 @@ endif ### Custom rules -OBJECTDIR = obj_$(TARGET) - ssubst = ${patsubst %.s,%.o,${patsubst %.s79,%.o,$(1)}} CONTIKI_OBJECTFILES += ${addprefix $(OBJECTDIR)/,${call ssubst, $(STM32W_S)}} From 757950f87f6225790fca06c701c430c3bdef6ec4 Mon Sep 17 00:00:00 2001 From: Niclas Finne Date: Mon, 17 Feb 2014 14:50:00 +0100 Subject: [PATCH 3/3] Set the RAM and flash size based on the CPU configuration for STM32W --- cpu/stm32w108/Makefile.stm32w108 | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cpu/stm32w108/Makefile.stm32w108 b/cpu/stm32w108/Makefile.stm32w108 index 76ac36faf..dce0b1383 100644 --- a/cpu/stm32w108/Makefile.stm32w108 +++ b/cpu/stm32w108/Makefile.stm32w108 @@ -100,9 +100,13 @@ endif ifeq ($(STM32W_CPUREV), CC) LD-EXT=-stm32w108CC + RAM_SIZE = 2*8192 + FLASH_SIZE = 2*128*1024 ${warning "using stm32w108CC specific ld file"} else ifeq ($(STM32W_CPUREV), xB) LD-EXT=-stm32w108xB + RAM_SIZE = 8192 + FLASH_SIZE = 128*1024 ${warning "using stm32w108xB specific ld file"} else ${error "Bad STM32W_CPUREV value or no STM32W_CPUREV value specified. Cpu revision should be specified. Please read cpu/stm32w108/README.txt for more details."} @@ -319,9 +323,13 @@ endif # a target that gives a user-friendly memory profile, taking into account the RAM # that is statically occupied by the stack as defined in cpu/stm32w108/gnu.ld -RAM_SIZE = 2*8192 -FLASH_SIZE = 2*128*1024 STACK_SIZE = 1280 +ifndef RAM_SIZE + ${error no ram size configured} +endif +ifndef FLASH_SIZE + ${error no flash size configured} +endif %.size: %.$(TARGET) @size -A $< | egrep "data|bss" | awk '{s+=$$2} END {s=s+$(STACK_SIZE); f=$(RAM_SIZE)-s; printf "[RAM] used %6d, free %6d\n",s,f;}' @size -A $< | egrep "text|isr_vector" | awk '{s+=$$2} END {f=$(FLASH_SIZE)-s; printf "[Flash] used %6d, free %6d\n",s,f;}'