Merge pull request #632 from nfi/verbosity-control-stm32w

Add support for verbosity control for building STM32W-based platforms
This commit is contained in:
Nicolas Tsiftes 2014-05-07 16:12:12 +02:00
commit 73086e34f7

View File

@ -100,9 +100,13 @@ endif
ifeq ($(STM32W_CPUREV), CC) ifeq ($(STM32W_CPUREV), CC)
LD-EXT=-stm32w108CC LD-EXT=-stm32w108CC
RAM_SIZE = 2*8192
FLASH_SIZE = 2*128*1024
${warning "using stm32w108CC specific ld file"} ${warning "using stm32w108CC specific ld file"}
else ifeq ($(STM32W_CPUREV), xB) else ifeq ($(STM32W_CPUREV), xB)
LD-EXT=-stm32w108xB LD-EXT=-stm32w108xB
RAM_SIZE = 8192
FLASH_SIZE = 128*1024
${warning "using stm32w108xB specific ld file"} ${warning "using stm32w108xB specific ld file"}
else 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."} ${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."}
@ -207,8 +211,6 @@ endif
### Custom rules ### Custom rules
OBJECTDIR = obj_$(TARGET)
ssubst = ${patsubst %.s,%.o,${patsubst %.s79,%.o,$(1)}} ssubst = ${patsubst %.s,%.o,${patsubst %.s79,%.o,$(1)}}
CONTIKI_OBJECTFILES += ${addprefix $(OBJECTDIR)/,${call ssubst, $(STM32W_S)}} CONTIKI_OBJECTFILES += ${addprefix $(OBJECTDIR)/,${call ssubst, $(STM32W_S)}}
@ -229,18 +231,21 @@ endif
CUSTOM_RULE_C_TO_OBJECTDIR_O = 1 CUSTOM_RULE_C_TO_OBJECTDIR_O = 1
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR) $(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) @$(SEDCOMMAND); rm -f $(@:.o=.P)
@$(FINALIZE_DEPENDENCY) @$(FINALIZE_DEPENDENCY)
CUSTOM_RULE_C_TO_CO = 1 CUSTOM_RULE_C_TO_CO = 1
%.co: %.c %.co: %.c
$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@ $(TRACE_CC)
$(Q)$(CC) $(CFLAGS) -DAUTOSTART_ENABLE $< -o $@
else #IAR else #IAR
CUSTOM_RULE_C_TO_CE = 1 CUSTOM_RULE_C_TO_CE = 1
%.ce: %.c %.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 $@ $(STRIP) --strip-unneeded -g -x $@
CUSTOM_RULE_LINK = 1 CUSTOM_RULE_LINK = 1
@ -259,12 +264,14 @@ symbols.c symbols.h:
endif endif
%.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(OBJECTDIR)/symbols.o %.$(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 @echo >> contiki-$(TARGET).map
@$(SIZE) $(SIZEFLAGS) $@ >> contiki-$(TARGET).map @$(SIZE) $(SIZEFLAGS) $@ >> contiki-$(TARGET).map
#%.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_OBJECTFILES) #%.$(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 # @echo "\n" >> contiki-$(TARGET).map
# @$(SIZE) $(SIZEFLAGS) $@ >> contiki-$(TARGET).map # @$(SIZE) $(SIZEFLAGS) $@ >> contiki-$(TARGET).map
@ -283,10 +290,12 @@ stm-motes:
@echo $(MOTES) @echo $(MOTES)
$(OBJECTDIR)/%.o: %.s79 | $(OBJECTDIR) $(OBJECTDIR)/%.o: %.s79 | $(OBJECTDIR)
$(AS) $(ASFLAGS) -o $@ $< $(TRACE_AS)
$(Q)$(AS) $(ASFLAGS) -o $@ $<
$(OBJECTDIR)/%.o: %.s | $(OBJECTDIR) $(OBJECTDIR)/%.o: %.s | $(OBJECTDIR)
$(AS) $(ASFLAGS) -o $@ $< $(TRACE_AS)
$(Q)$(AS) $(ASFLAGS) -o $@ $<
%.bin: %.$(TARGET) %.bin: %.$(TARGET)
$(OBJCOPY) $(OBJOPTS) $< $@ $(OBJCOPY) $(OBJOPTS) $< $@
@ -314,9 +323,13 @@ endif
# a target that gives a user-friendly memory profile, taking into account the RAM # 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 # 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 STACK_SIZE = 1280
ifndef RAM_SIZE
${error no ram size configured}
endif
ifndef FLASH_SIZE
${error no flash size configured}
endif
%.size: %.$(TARGET) %.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 "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;}' @size -A $< | egrep "text|isr_vector" | awk '{s+=$$2} END {f=$(FLASH_SIZE)-s; printf "[Flash] used %6d, free %6d\n",s,f;}'