From ce540a8bcadfd87f84e387972e3c57d425eb7750 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 30 Mar 2018 20:12:31 +0100 Subject: [PATCH 1/8] Harmonise filename pattern for the .map file All map files are now called example-platform.map (e.g. hello-world-native.map). --- Makefile.include | 4 ++++ arch/cpu/arm/cortex-m/cm3/Makefile.cm3 | 2 +- arch/cpu/msp430/Makefile.msp430 | 6 +++--- arch/cpu/native/Makefile.native | 4 ++-- arch/cpu/nrf52832/Makefile.nrf52832 | 2 +- arch/platform/jn516x/Makefile.jn516x | 2 +- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Makefile.include b/Makefile.include index a37c5ad6a..9afb271df 100644 --- a/Makefile.include +++ b/Makefile.include @@ -288,6 +288,10 @@ sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ rm -f $(@:.o=.$$$$) endef +### Harmonize filename of a .map file, if the platform's build system wants +### to create one +CONTIKI_NG_PROJECT_MAP = $(addsuffix -$(TARGET).map, $(basename $@)) + clean: -rm -f *~ *core core *.srec \ *.lst *.map *.o \ diff --git a/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 b/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 index f5547fea0..f5e8d2a3c 100644 --- a/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 +++ b/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 @@ -5,7 +5,7 @@ CFLAGS += -mcpu=cortex-m3 LDFLAGS += -mcpu=cortex-m3 -nostartfiles LDFLAGS += -T $(LDSCRIPT) LDFLAGS += -Wl,--gc-sections,--sort-section=alignment -LDFLAGS += -Wl,-Map=$(@:.elf=-$(TARGET).map),--cref,--no-warn-mismatch +LDFLAGS += -Wl,-Map=$(CONTIKI_NG_PROJECT_MAP),--cref,--no-warn-mismatch OBJCOPY_FLAGS += --gap-fill 0xff diff --git a/arch/cpu/msp430/Makefile.msp430 b/arch/cpu/msp430/Makefile.msp430 index ec8c33664..0bb9f356e 100644 --- a/arch/cpu/msp430/Makefile.msp430 +++ b/arch/cpu/msp430/Makefile.msp430 @@ -75,7 +75,7 @@ CFLAGSNO = --dlib_config "$(IAR_PATH)/LIB/DLIB/dl430xlfn.h" $(CFLAGSWERROR) # CFLAGSNO = --dlib_config $(IAR_PATH)/LIB/DLIB/dl430xlfn.h -Ohz --multiplier=32 --multiplier_location=4C0 --hw_workaround=CPU40 --core=430X $(CFLAGSWERROR) --data_model large --double=32 endif -LDFLAGSNO += -B -l contiki-$(TARGET).map -s __program_start +LDFLAGSNO += -B -l $(CONTIKI_NG_PROJECT_MAP) -s __program_start # Stack and heap size in hex ifndef IAR_STACK_SIZE IAR_STACK_SIZE=300 @@ -165,7 +165,7 @@ ifndef CFLAGSNO CFLAGSNO = -Wall -mmcu=$(CC_MCU) $(CFLAGSWERROR) endif CFLAGS += -Os -fno-strict-aliasing -LDFLAGS += -mmcu=$(CC_MCU) -Wl,-Map=contiki-$(TARGET).map +LDFLAGS += -mmcu=$(CC_MCU) -Wl,-Map=$(CONTIKI_NG_PROJECT_MAP) ### These flags can reduce the code size and RAM usage with up to 10% SMALL ?= 1 @@ -221,7 +221,7 @@ $(COOJA_PATH)/mspsim/mspsim.jar: $(COOJA_PATH)/mspsim/build.xml java -jar ${COOJA_PATH}/mspsim/mspsim.jar -platform=${TARGET} $< mspsim-maptable: contiki-${TARGET}.map - java -classpath ${COOJA_PATH}/mspsim/mspsim.jar se.sics.mspsim.util.MapTable $< + java -classpath ${COOJA_PATH}/mspsim/mspsim.jar se.sics.mspsim.util.MapTable $(CONTIKI_NG_PROJECT_MAP) core-labels.o: core.${TARGET} ${CONTIKI}/tools/msp430-make-labels core.${TARGET} > core-labels.S diff --git a/arch/cpu/native/Makefile.native b/arch/cpu/native/Makefile.native index 90a784e34..cda288e65 100644 --- a/arch/cpu/native/Makefile.native +++ b/arch/cpu/native/Makefile.native @@ -21,11 +21,11 @@ CFLAGS += $(CFLAGSNO) ifeq ($(HOST_OS),Darwin) AROPTS = -r -LDFLAGS += -Wl,-flat_namespace +LDFLAGS += -Wl,-flat_namespace,-map,$(CONTIKI_NG_PROJECT_MAP) CFLAGS += -DHAVE_SNPRINTF=1 -U__ASSERT_USE_STDERR else ifeq ($(HOST_OS),Linux) -LDFLAGS += -Wl,-Map=contiki-$(TARGET).map,-export-dynamic +LDFLAGS += -Wl,-Map=$(CONTIKI_NG_PROJECT_MAP),-export-dynamic endif endif diff --git a/arch/cpu/nrf52832/Makefile.nrf52832 b/arch/cpu/nrf52832/Makefile.nrf52832 index c2bdbbf81..3eea82453 100644 --- a/arch/cpu/nrf52832/Makefile.nrf52832 +++ b/arch/cpu/nrf52832/Makefile.nrf52832 @@ -139,7 +139,7 @@ CFLAGS += -ggdb CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 # keep every function in separate section. This will allow linker to dump unused functions -LDFLAGS += -Xlinker -Map=$(@:.elf=-$(TARGET).map) +LDFLAGS += -Xlinker -Map=$(CONTIKI_NG_PROJECT_MAP) LDFLAGS += -mabi=aapcs -L $(TEMPLATE_PATH) -T$(LINKER_SCRIPT) LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 # let linker to dump unused sections diff --git a/arch/platform/jn516x/Makefile.jn516x b/arch/platform/jn516x/Makefile.jn516x index ecdcc2f58..a442dff73 100644 --- a/arch/platform/jn516x/Makefile.jn516x +++ b/arch/platform/jn516x/Makefile.jn516x @@ -239,7 +239,7 @@ ifneq ($(wildcard $(SDK_BASE_DIR)/Components/Library/*),) $(Q)$(CC) -Wl,--gc-sections $(LDFLAGS) -T$(LINKCMD) -o $@ -Wl,--start-group \ $(patsubst /cygdrive/c/%,c:/%,${filter-out %.a,$^}) \ $(patsubst /cygdrive/c/%,c:/%,${filter %.a,$^}) \ - $(ALLLIBS) -Wl,--end-group -Wl,-Map,contiki-$(TARGET).map + $(ALLLIBS) -Wl,--end-group -Wl,-Map,$(CONTIKI_NG_PROJECT_MAP) $(OBJCOPY) -S -O binary $@ $@.bin else # The SDK does not include libraries, only build objects and libraries, skip linking From 16d8c5b4f925e02c6f8badadd9b3ad494653d18e Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 30 Mar 2018 20:14:33 +0100 Subject: [PATCH 2/8] Use a variable for the Contiki-NG archive file Prevents having to hard-code the filename in multiple cpu/platform makefiles and allows us to easily rename it across the board in the future --- Makefile.include | 6 ++++-- arch/cpu/arm/cortex-m/cm4/Makefile.cm4 | 2 +- arch/cpu/msp430/Makefile.msp430 | 2 +- arch/platform/jn516x/Makefile.jn516x | 4 ++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile.include b/Makefile.include index 9afb271df..d399b77f1 100644 --- a/Makefile.include +++ b/Makefile.include @@ -10,6 +10,8 @@ WERROR ?= 1 include $(CONTIKI)/Makefile.identify-target +CONTIKI_NG_TARGET_LIB = contiki-ng-$(TARGET).a + ifeq ($(DEFINES),) -include Makefile.$(TARGET).defines ifneq ($(DEFINES),) @@ -355,7 +357,7 @@ ifndef AROPTS endif ifndef CUSTOM_RULE_ALLOBJS_TO_TARGETLIB -contiki-$(TARGET).a: $(CONTIKI_OBJECTFILES) +$(CONTIKI_NG_TARGET_LIB): $(CONTIKI_OBJECTFILES) $(TRACE_AR) $(Q)$(AR) $(AROPTS) $@ $^ endif @@ -365,7 +367,7 @@ ifndef LD endif ifndef CUSTOM_RULE_LINK -%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a +%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_NG_TARGET_LIB) $(TRACE_LD) $(Q)$(LD) $(LDFLAGS) $(TARGET_STARTFILES) ${filter-out %.a,$^} \ ${filter %.a,$^} $(TARGET_LIBFILES) -o $@ diff --git a/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 b/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 index 78367b0eb..1f3cdd00b 100644 --- a/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 +++ b/arch/cpu/arm/cortex-m/cm4/Makefile.cm4 @@ -6,7 +6,7 @@ LDFLAGS += -mcpu=cortex-m4 ### Compilation rules CUSTOM_RULE_LINK=1 -%.elf: $(TARGET_STARTFILES) %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(TARGET_LIBS) +%.elf: $(TARGET_STARTFILES) %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_NG_TARGET_LIB) $(TARGET_LIBS) $(TRACE_LD) $(Q)$(CC) $(LDFLAGS) ${filter %.o %.a,$^} -o $@ diff --git a/arch/cpu/msp430/Makefile.msp430 b/arch/cpu/msp430/Makefile.msp430 index 0bb9f356e..2f0b18d0e 100644 --- a/arch/cpu/msp430/Makefile.msp430 +++ b/arch/cpu/msp430/Makefile.msp430 @@ -197,7 +197,7 @@ PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)} mv $< $@ ifdef IAR -%.ihex: %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a +%.ihex: %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_NG_TARGET_LIB) $(LD) $(LDFLAGSNO) -Fintel-extended $(TARGET_STARTFILES) ${filter-out %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -o $@ else %.ihex: %.$(TARGET) diff --git a/arch/platform/jn516x/Makefile.jn516x b/arch/platform/jn516x/Makefile.jn516x index a442dff73..a70c4f3e6 100644 --- a/arch/platform/jn516x/Makefile.jn516x +++ b/arch/platform/jn516x/Makefile.jn516x @@ -234,7 +234,7 @@ ABS_APPLIBS = $(addsuffix _$(JENNIC_CHIP_FAMILY).a,$(addprefix $(COMPONENTS_BASE ifneq ($(wildcard $(SDK_BASE_DIR)/Components/Library/*),) # The SDK is fully installed, proceed to linking and objcopy to ready-to-upload .jn516x.bin file -%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(ABS_APPLIBS) +%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_NG_TARGET_LIB) $(ABS_APPLIBS) echo ${filter %.a,$^} $(Q)$(CC) -Wl,--gc-sections $(LDFLAGS) -T$(LINKCMD) -o $@ -Wl,--start-group \ $(patsubst /cygdrive/c/%,c:/%,${filter-out %.a,$^}) \ @@ -243,7 +243,7 @@ ifneq ($(wildcard $(SDK_BASE_DIR)/Components/Library/*),) $(OBJCOPY) -S -O binary $@ $@.bin else # The SDK does not include libraries, only build objects and libraries, skip linking -%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a +%.$(TARGET): %.o $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(CONTIKI_NG_TARGET_LIB) echo Creating empty $@ touch $@ endif From 1d3122750aec79dd080aa0e8813f6ffe25fe406e Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 30 Mar 2018 20:15:44 +0100 Subject: [PATCH 3/8] Define different mspsim-maptable per project The rule is changed such that it makes sure the .map file gets built first. We have separate map files per project, so we need separate mspsim-maptables --- arch/cpu/msp430/Makefile.msp430 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/cpu/msp430/Makefile.msp430 b/arch/cpu/msp430/Makefile.msp430 index 2f0b18d0e..3cc432ad5 100644 --- a/arch/cpu/msp430/Makefile.msp430 +++ b/arch/cpu/msp430/Makefile.msp430 @@ -220,7 +220,7 @@ $(COOJA_PATH)/mspsim/mspsim.jar: $(COOJA_PATH)/mspsim/build.xml %.mspsim: %.${TARGET} ${COOJA_PATH}/mspsim/mspsim.jar java -jar ${COOJA_PATH}/mspsim/mspsim.jar -platform=${TARGET} $< -mspsim-maptable: contiki-${TARGET}.map +%.mspsim-maptable: %.$(TARGET) java -classpath ${COOJA_PATH}/mspsim/mspsim.jar se.sics.mspsim.util.MapTable $(CONTIKI_NG_PROJECT_MAP) core-labels.o: core.${TARGET} From c7e36a3d55d9c3ba96f46963b10410c025e25dc0 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 30 Mar 2018 20:20:28 +0100 Subject: [PATCH 4/8] Change clean target to be more explicit Previously, the clean target would delete a number of file extensions, many of which currently unknown to our build system (old platforms?). This commit changes the target so that it only cleans what we know we are building. Platforms / CPUs can append to the target with platform-specific build artifacts. --- Makefile.include | 7 +++---- arch/cpu/arm/Makefile.arm | 2 +- arch/cpu/msp430/Makefile.msp430 | 3 +++ arch/platform/cc2538dk/Makefile.cc2538dk | 2 -- arch/platform/cooja/Makefile.cooja | 2 ++ arch/platform/jn516x/Makefile.jn516x | 1 - arch/platform/native/Makefile.native | 2 -- arch/platform/nrf52dk/Makefile.nrf52dk | 2 -- arch/platform/openmote-cc2538/Makefile.openmote-cc2538 | 2 -- arch/platform/sky/Makefile.sky | 2 -- arch/platform/srf06-cc26xx/Makefile.srf06-cc26xx | 2 -- arch/platform/zoul/Makefile.zoul | 2 -- 12 files changed, 9 insertions(+), 20 deletions(-) diff --git a/Makefile.include b/Makefile.include index d399b77f1..802be19d9 100644 --- a/Makefile.include +++ b/Makefile.include @@ -295,11 +295,10 @@ endef CONTIKI_NG_PROJECT_MAP = $(addsuffix -$(TARGET).map, $(basename $@)) clean: - -rm -f *~ *core core *.srec \ - *.lst *.map *.o \ - *.cprg *.bin *.data contiki*.a *.firmware core-labels.S *.ihex *.ini \ - rm -rf $(CLEAN) + -rm -f *.d *.e *.o $(CONTIKI_NG_TARGET_LIB) $(CLEAN) -rm -rf $(OBJECTDIR) + -rm -f $(addsuffix -$(TARGET).map, $(CONTIKI_PROJECT)) + -rm -f $(addsuffix .$(TARGET), $(CONTIKI_PROJECT)) distclean: clean -rm -f ${addsuffix .$(TARGET),$(CONTIKI_PROJECT)} diff --git a/arch/cpu/arm/Makefile.arm b/arch/cpu/arm/Makefile.arm index ba93b82a0..0b2662423 100644 --- a/arch/cpu/arm/Makefile.arm +++ b/arch/cpu/arm/Makefile.arm @@ -31,7 +31,7 @@ CONTIKI_ARM_DIRS += . common/dbg-io CONTIKI_CPU_DIRS += $(addprefix ../arm/, $(CONTIKI_ARM_DIRS)) ### CPU-dependent cleanup files -CLEAN += *.d *.elf *.hex +CLEAN += *.elf *.bin *.lst *.hex *.i16hex ### Don't treat the following files as intermediate .PRECIOUS: %.elf %.hex %.bin diff --git a/arch/cpu/msp430/Makefile.msp430 b/arch/cpu/msp430/Makefile.msp430 index 3cc432ad5..841e11285 100644 --- a/arch/cpu/msp430/Makefile.msp430 +++ b/arch/cpu/msp430/Makefile.msp430 @@ -184,6 +184,9 @@ CFLAGS += $(CFLAGSNO) PROJECT_OBJECTFILES += ${addprefix $(OBJECTDIR)/,$(CONTIKI_TARGET_MAIN:.c=.o)} +### CPU-dependent cleanup files +CLEAN += *.firmware *.ihex + ### Compilation rules %-stripped.o: %.c diff --git a/arch/platform/cc2538dk/Makefile.cc2538dk b/arch/platform/cc2538dk/Makefile.cc2538dk index 2b88479d2..c452ccfaf 100644 --- a/arch/platform/cc2538dk/Makefile.cc2538dk +++ b/arch/platform/cc2538dk/Makefile.cc2538dk @@ -13,8 +13,6 @@ CONTIKI_TARGET_SOURCEFILES += board-buttons.c als-sensor.c CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) -CLEAN += *.cc2538dk - ### Define the CPU directory CONTIKI_CPU=$(CONTIKI)/arch/cpu/cc2538 include $(CONTIKI_CPU)/Makefile.cc2538 diff --git a/arch/platform/cooja/Makefile.cooja b/arch/platform/cooja/Makefile.cooja index 541ae51f0..d06aa08d5 100644 --- a/arch/platform/cooja/Makefile.cooja +++ b/arch/platform/cooja/Makefile.cooja @@ -64,6 +64,8 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) .SUFFIXES: +CLEAN += COOJA.log + ### Define the CPU directory CONTIKI_CPU=$(CONTIKI)/arch/cpu/x86 diff --git a/arch/platform/jn516x/Makefile.jn516x b/arch/platform/jn516x/Makefile.jn516x index a70c4f3e6..fafadb831 100644 --- a/arch/platform/jn516x/Makefile.jn516x +++ b/arch/platform/jn516x/Makefile.jn516x @@ -140,7 +140,6 @@ ifdef nodemac CFLAGS += -DMACID=$(nodemac) endif -CLEAN += *.jn516x CLEAN += *.jn516x.bin CONTIKI_TARGET_SOURCEFILES += $(ARCH) diff --git a/arch/platform/native/Makefile.native b/arch/platform/native/Makefile.native index bee104a6c..24f433796 100644 --- a/arch/platform/native/Makefile.native +++ b/arch/platform/native/Makefile.native @@ -30,8 +30,6 @@ CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) # Enable nullmac by default MAKE_MAC ?= MAKE_MAC_NULLMAC -CLEAN += *.native - ### Define the CPU directory CONTIKI_CPU=$(CONTIKI)/arch/cpu/native include $(CONTIKI)/arch/cpu/native/Makefile.native diff --git a/arch/platform/nrf52dk/Makefile.nrf52dk b/arch/platform/nrf52dk/Makefile.nrf52dk index 6187fc532..ff6d54a44 100644 --- a/arch/platform/nrf52dk/Makefile.nrf52dk +++ b/arch/platform/nrf52dk/Makefile.nrf52dk @@ -19,8 +19,6 @@ CONTIKI_CPU_DIRS += ../arm/common/dbg-io CONTIKI_CPU_SOURCEFILES += dbg-printf.c dbg-putchar.c dbg-snprintf.c dbg-sprintf.c strformat.c endif -CLEAN += *.nrf52dk - ### Unless the example dictates otherwise, build with code size optimisations switched off SMALL ?= 0 diff --git a/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 b/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 index 14aa46f78..d3863fdbc 100644 --- a/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 +++ b/arch/platform/openmote-cc2538/Makefile.openmote-cc2538 @@ -20,8 +20,6 @@ CONTIKI_TARGET_SOURCEFILES += antenna.c adxl346.c max44009.c sht21.c tps62730.c CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) -CLEAN += *.openmote-cc2538 - ### Define the CPU directory CONTIKI_CPU=$(CONTIKI)/arch/cpu/cc2538 include $(CONTIKI_CPU)/Makefile.cc2538 diff --git a/arch/platform/sky/Makefile.sky b/arch/platform/sky/Makefile.sky index 9467603a4..0398486b0 100644 --- a/arch/platform/sky/Makefile.sky +++ b/arch/platform/sky/Makefile.sky @@ -4,8 +4,6 @@ CONTIKI_TARGET_SOURCEFILES += contiki-sky-platform.c \ sht11.c sht11-sensor.c light-sensor.c battery-sensor.c \ button-sensor.c -CLEAN += *.sky - include $(CONTIKI)/arch/platform/sky/Makefile.common MODULES += arch/dev/cc2420 arch/dev/sht11 arch/dev/ds2411 os/storage/cfs diff --git a/arch/platform/srf06-cc26xx/Makefile.srf06-cc26xx b/arch/platform/srf06-cc26xx/Makefile.srf06-cc26xx index 7bead9fff..db4209adc 100644 --- a/arch/platform/srf06-cc26xx/Makefile.srf06-cc26xx +++ b/arch/platform/srf06-cc26xx/Makefile.srf06-cc26xx @@ -19,8 +19,6 @@ CONTIKI_TARGET_SOURCEFILES += $(BOARD_SOURCEFILES) CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) -CLEAN += *.srf06-cc26xx - ### Unless the example dictates otherwise, build without code size optimisations SMALL ?= 0 diff --git a/arch/platform/zoul/Makefile.zoul b/arch/platform/zoul/Makefile.zoul index 6bbcd675b..586a74ae2 100644 --- a/arch/platform/zoul/Makefile.zoul +++ b/arch/platform/zoul/Makefile.zoul @@ -38,8 +38,6 @@ CONTIKI_TARGET_SOURCEFILES += $(BOARD_SOURCEFILES) CONTIKI_SOURCEFILES += $(CONTIKI_TARGET_SOURCEFILES) -CLEAN += *.zoul - ### Define the CPU directory CONTIKI_CPU=$(CONTIKI)/arch/cpu/cc2538 include $(CONTIKI_CPU)/Makefile.cc2538 From 9a1d34e163aa630e506a08f5814711cad3ded3e3 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 30 Mar 2018 20:20:55 +0100 Subject: [PATCH 5/8] Change distclean to clean all platforms --- Makefile.include | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile.include b/Makefile.include index 802be19d9..a55bf0901 100644 --- a/Makefile.include +++ b/Makefile.include @@ -300,8 +300,11 @@ clean: -rm -f $(addsuffix -$(TARGET).map, $(CONTIKI_PROJECT)) -rm -f $(addsuffix .$(TARGET), $(CONTIKI_PROJECT)) -distclean: clean - -rm -f ${addsuffix .$(TARGET),$(CONTIKI_PROJECT)} +distclean: + @for TARG in `ls $(CONTIKI)/arch/platform $(TARGETDIRS)`; do \ + echo make $$TARG clean; \ + make TARGET=$$TARG clean; \ + done -include $(CONTIKI)/arch/platform/$(TARGET)/Makefile.customrules-$(TARGET) From a22324291f0d1ea1a816334e5c565d0b5a19bd06 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 30 Mar 2018 20:22:03 +0100 Subject: [PATCH 6/8] Specify a number of targets as .PHONY --- Makefile.include | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.include b/Makefile.include index a55bf0901..4a05b326a 100644 --- a/Makefile.include +++ b/Makefile.include @@ -294,6 +294,8 @@ endef ### to create one CONTIKI_NG_PROJECT_MAP = $(addsuffix -$(TARGET).map, $(basename $@)) +.PHONY: clean distclean usage help targets boards savetarget savedefines viewconf + clean: -rm -f *.d *.e *.o $(CONTIKI_NG_TARGET_LIB) $(CLEAN) -rm -rf $(OBJECTDIR) From 3f4a1f7c54104cb6da21d4ac1a76e45dddc1ae98 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 30 Mar 2018 20:22:20 +0100 Subject: [PATCH 7/8] Extend the usage target and add help target --- Makefile.include | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Makefile.include b/Makefile.include index 4a05b326a..75f016d42 100644 --- a/Makefile.include +++ b/Makefile.include @@ -384,7 +384,25 @@ endif $(NM) -S -td --size-sort $< | grep -i " [t] " | cut -d' ' -f2,4 usage: - @echo "make MAKETARGETS... [TARGET=(TARGET)] [BOARD=(BOARD)] [savetarget] [targets]" + @echo "Usage:" + @echo " make [TARGET=(TARGET)] [BOARD=(BOARD)] [DEFINES=(DEFINES)] [target]" + @echo "" + @echo "Typical usage:" + @echo " make [TARGET=(TARGET)] [BOARD=(BOARD)] [all]" + @echo "" + @echo " Will build Contiki-NG firmware(s) from the current example dir" + @echo " for platform TARGET, board BOARD." + @echo "" + @echo "Miscellaneous targets:" + @echo " targets Prints list of supported platforms" + @echo " boards Prints a list of supported boards for TARGET" + @echo " savegtarget Saves TARGET and BOARD for future invocations of make" + @echo " savedefines Saves DEFINES for future invocations of make" + @echo " clean Removes all compiled files for TARGET" + @echo " distclean Removes all compiled files for all TARGETs" + @echo " viewconf Prints Contiki-NG build configuration for TARGET" + +help: usage targets: @ls $(CONTIKI)/arch/platform $(TARGETDIRS) From be2a818eaa97c8922793c9900131037cf69ba2d6 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Fri, 30 Mar 2018 21:19:04 +0100 Subject: [PATCH 8/8] Adjust nrf52832 compile output --- arch/cpu/nrf52832/Makefile.nrf52832 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/cpu/nrf52832/Makefile.nrf52832 b/arch/cpu/nrf52832/Makefile.nrf52832 index 3eea82453..0200f2df4 100644 --- a/arch/cpu/nrf52832/Makefile.nrf52832 +++ b/arch/cpu/nrf52832/Makefile.nrf52832 @@ -182,7 +182,7 @@ nrf52832.a: $(OBJECTS) # Assemble files $(OBJECT_DIRECTORY)/%.o: %.s - @echo Compiling file: $(notdir $<) + $(TRACE_CC) $(Q)$(CC) $(ASMFLAGS) $(addprefix -I$(NRF52_SDK_ROOT)/, $(INC_PATHS)) -c -o $@ $< %.jlink: