From b5fa28e2d497d1a726f009ef3c4621bec168a759 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 17 Dec 2017 21:31:39 +0000 Subject: [PATCH 1/2] Link without using an archive file For reasons discussed long ago and that have to do with how ld handles weak symbols, it was decided that it was preferable to link using an explicit list of object files, instead of adding object files to an archive first and then linking using this archive. This was applied for the CC2538, but not for CC13xx/CC26xx. This pull applies this link logic to all CM3s. For this to work with the Contiki-NG build system, we need `.SECONDEXPANSION:`, so this pull moves that to the common CM3 Makefile. --- arch/cpu/arm/cortex-m/cm3/Makefile.cm3 | 4 +++- arch/cpu/cc2538/Makefile.cc2538 | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 b/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 index 8baf1651d..a422d3080 100644 --- a/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 +++ b/arch/cpu/arm/cortex-m/cm3/Makefile.cm3 @@ -17,7 +17,9 @@ CPU_STARTFILES = ${addprefix $(OBJECTDIR)/,${call oname, $(CPU_START_SOURCEFILES ### Compilation rules CUSTOM_RULE_LINK = 1 -%.elf: $(CPU_STARTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a $(LDSCRIPT) +.SECONDEXPANSION: + +%.elf: $(CPU_STARTFILES) $$(CONTIKI_OBJECTFILES) %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) $(LDSCRIPT) $(TRACE_LD) $(Q)$(LD) $(LDFLAGS) ${filter-out $(LDSCRIPT) %.a,$^} ${filter %.a,$^} $(TARGET_LIBFILES) -lm -o $@ diff --git a/arch/cpu/cc2538/Makefile.cc2538 b/arch/cpu/cc2538/Makefile.cc2538 index 18213ca74..c0a2bb2f0 100644 --- a/arch/cpu/cc2538/Makefile.cc2538 +++ b/arch/cpu/cc2538/Makefile.cc2538 @@ -36,8 +36,6 @@ CPU_START_SOURCEFILES = startup-gcc.c CONTIKI_SOURCEFILES += $(CONTIKI_CPU_SOURCEFILES) $(DEBUG_IO_SOURCEFILES) CONTIKI_SOURCEFILES += $(USB_SOURCEFILES) -.SECONDEXPANSION: - ### Always re-build ieee-addr.o in case the command line passes a new NODEID FORCE: From 38987352c445d558db024ca62f327c7b0c978a57 Mon Sep 17 00:00:00 2001 From: George Oikonomou Date: Sun, 17 Dec 2017 22:24:48 +0000 Subject: [PATCH 2/2] Change variables to static --- arch/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c | 2 +- arch/cpu/cc26xx-cc13xx/rf-core/prop-mode.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c b/arch/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c index a354fdd4b..cf1676570 100644 --- a/arch/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c +++ b/arch/cpu/cc26xx-cc13xx/rf-core/ieee-mode.c @@ -209,7 +209,7 @@ static const output_config_t output_power[] = { #define OUTPUT_POWER_UNKNOWN 0xFFFF /* Default TX Power - position in output_power[] */ -const output_config_t *tx_power_current = &output_power[0]; +static const output_config_t *tx_power_current = &output_power[0]; /*---------------------------------------------------------------------------*/ static volatile int8_t last_rssi = 0; static volatile uint8_t last_corr_lqi = 0; diff --git a/arch/cpu/cc26xx-cc13xx/rf-core/prop-mode.c b/arch/cpu/cc26xx-cc13xx/rf-core/prop-mode.c index 61581f20a..f9f49e9a0 100644 --- a/arch/cpu/cc26xx-cc13xx/rf-core/prop-mode.c +++ b/arch/cpu/cc26xx-cc13xx/rf-core/prop-mode.c @@ -203,7 +203,7 @@ extern const prop_mode_tx_power_config_t TX_POWER_DRIVER[]; #define OUTPUT_POWER_UNKNOWN 0xFFFF /* Default TX Power - position in output_power[] */ -const prop_mode_tx_power_config_t *tx_power_current = &TX_POWER_DRIVER[1]; +static const prop_mode_tx_power_config_t *tx_power_current = &TX_POWER_DRIVER[1]; /*---------------------------------------------------------------------------*/ #ifdef PROP_MODE_CONF_LO_DIVIDER #define PROP_MODE_LO_DIVIDER PROP_MODE_CONF_LO_DIVIDER