Skip to content

Commit

Permalink
Merge pull request contiki-os#632 from nfi/verbosity-control-stm32w
Browse files Browse the repository at this point in the history
Add support for verbosity control for building STM32W-based platforms
  • Loading branch information
Nicolas Tsiftes committed May 7, 2014
2 parents 4af2661 + 757950f commit 73086e3
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions cpu/stm32w108/Makefile.stm32w108
Original file line number Diff line number Diff line change
Expand Up @@ -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."}
Expand Down Expand Up @@ -207,8 +211,6 @@ endif

### Custom rules

OBJECTDIR = obj_$(TARGET)

ssubst = ${patsubst %.s,%.o,${patsubst %.s79,%.o,$(1)}}

CONTIKI_OBJECTFILES += ${addprefix $(OBJECTDIR)/,${call ssubst, $(STM32W_S)}}
Expand All @@ -229,18 +231,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
Expand All @@ -259,12 +264,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

Expand All @@ -283,10 +290,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) $< $@
Expand Down Expand Up @@ -314,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;}'

0 comments on commit 73086e3

Please sign in to comment.