From 8ac4f3332dc5834422401a6dbd3da615bd5ef601 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Mon, 3 Feb 2014 15:58:18 +0100 Subject: [PATCH 1/5] core cpu: add defaulttransceiver pseudomodule update examples/default --- Makefile.modules | 7 ++++++- boards/avsextrem/Makefile.include | 13 +++++++++++++ boards/chronos/Makefile.dep | 8 ++++++++ boards/chronos/Makefile.include | 2 ++ boards/msb-430h/Makefile.dep | 9 +++++++++ boards/msba2/Makefile.include | 9 +++++++++ boards/native/Makefile.dep | 8 ++++++++ boards/native/Makefile.include | 2 ++ boards/pttu/Makefile.include | 10 ++++++++++ boards/redbee-econotag/Makefile.include | 10 ++++++++++ boards/telosb/Makefile.include | 9 +++++++++ boards/wsn430-v1_3b/Makefile.dep | 9 +++++++++ boards/wsn430-v1_4/Makefile.dep | 9 +++++++++ examples/default/Makefile | 15 ++------------- examples/default/main.c | 20 +------------------- sys/include/transceiver.h | 25 +++++++++++++++++++++++++ 16 files changed, 132 insertions(+), 33 deletions(-) create mode 100644 boards/chronos/Makefile.dep create mode 100644 boards/native/Makefile.dep diff --git a/Makefile.modules b/Makefile.modules index 89418ecb3a..a61df5f6bc 100644 --- a/Makefile.modules +++ b/Makefile.modules @@ -6,7 +6,12 @@ INCLUDES += -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBAS ED = $(USEMODULE:%=-DMODULE_%) ED += $(USEPKG:%=-DMODULE_%) EXTDEFINES = $(shell echo $(ED)|tr 'a-z' 'A-Z') -export BASELIBS = $(USEMODULE:%= $(BINDIR)%.a) +BL=$(USEMODULE:%= $(BINDIR)%.a) + +# Exclude defaulttransceiver, it is only a pseudomodule that adds other +# modules depending on the current board. +export BASELIBS = $(shell echo $(BL)|sed \ + -e 's/[^ ]*defaulttransceiver.a//') CFLAGS += $(EXTDEFINES) diff --git a/boards/avsextrem/Makefile.include b/boards/avsextrem/Makefile.include index ae4227e388..28df46718f 100644 --- a/boards/avsextrem/Makefile.include +++ b/boards/avsextrem/Makefile.include @@ -1,3 +1,16 @@ export INCLUDES += -I$(RIOTBOARD)/avsextrem/include +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc110x,$(USEMODULE))) + USEMODULE += cc110x + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif + +ifneq (,$(filter cc110x,$(USEMODULE))) + INCLUDES += -I$(RIOTBASE)/sys/net/include +endif + include $(RIOTBOARD)/msba2-common/Makefile.include diff --git a/boards/chronos/Makefile.dep b/boards/chronos/Makefile.dep new file mode 100644 index 0000000000..5fdf00ff8b --- /dev/null +++ b/boards/chronos/Makefile.dep @@ -0,0 +1,8 @@ +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc110x_ng,$(USEMODULE))) + USEMODULE += cc110x_ng + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif diff --git a/boards/chronos/Makefile.include b/boards/chronos/Makefile.include index 5dfe7e4607..3125887563 100644 --- a/boards/chronos/Makefile.include +++ b/boards/chronos/Makefile.include @@ -20,3 +20,5 @@ export HEXFILE = $(BINDIR)$(PROJECT).hex export USEMODULE += msp430_common export FFLAGS = rf2500 "prog $(HEXFILE)" export OFLAGS = -O ihex + +include $(RIOTBOARD)/$(BOARD)/Makefile.dep diff --git a/boards/msb-430h/Makefile.dep b/boards/msb-430h/Makefile.dep index a4578de2ab..c20de5e788 100644 --- a/boards/msb-430h/Makefile.dep +++ b/boards/msb-430h/Makefile.dep @@ -1,3 +1,12 @@ +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc110x_ng,$(USEMODULE))) + USEMODULE += cc110x_ng + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif + ifneq (,$(filter cc110x_ng,$(USEMODULE))) ifeq (,$(filter cc110x_spi,$(USEMODULE))) USEMODULE += cc110x_spi diff --git a/boards/msba2/Makefile.include b/boards/msba2/Makefile.include index 214f4602c3..750e92254f 100644 --- a/boards/msba2/Makefile.include +++ b/boards/msba2/Makefile.include @@ -1,3 +1,12 @@ export INCLUDES += -I$(RIOTBOARD)/msba2/include +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc110x_ng,$(USEMODULE))) + USEMODULE += cc110x_ng + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif + include $(RIOTBOARD)/msba2-common/Makefile.include diff --git a/boards/native/Makefile.dep b/boards/native/Makefile.dep new file mode 100644 index 0000000000..444440b754 --- /dev/null +++ b/boards/native/Makefile.dep @@ -0,0 +1,8 @@ +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter nativenet,$(USEMODULE))) + USEMODULE += nativenet + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif diff --git a/boards/native/Makefile.include b/boards/native/Makefile.include index 753b118b24..18e234acca 100644 --- a/boards/native/Makefile.include +++ b/boards/native/Makefile.include @@ -1,3 +1,5 @@ +include $(RIOTBOARD)/$(BOARD)/Makefile.dep + export NATIVEINCLUDES = -I$(RIOTBOARD)/$(BOARD)/include/ export NATIVEINCLUDES += -I$(RIOTBASE)/core/include/ export NATIVEINCLUDES += -I$(RIOTBASE)/drivers/include/ diff --git a/boards/pttu/Makefile.include b/boards/pttu/Makefile.include index cb34c2c317..289e0e92a1 100644 --- a/boards/pttu/Makefile.include +++ b/boards/pttu/Makefile.include @@ -1,3 +1,13 @@ export INCLUDES += -I$(RIOTBOARD)/pttu/include +# Enable this after fixing https://github.com/RIOT-OS/RIOT/issues/659 +#ifneq (,$(filter defaulttransceiver,$(USEMODULE))) +# ifeq (,$(filter cc110x,$(USEMODULE))) +# USEMODULE += cc110x +# endif +# ifeq (,$(filter transceiver,$(USEMODULE))) +# USEMODULE += transceiver +# endif +#endif + include $(RIOTBOARD)/msba2-common/Makefile.include diff --git a/boards/redbee-econotag/Makefile.include b/boards/redbee-econotag/Makefile.include index a94a9e1b36..687457634b 100644 --- a/boards/redbee-econotag/Makefile.include +++ b/boards/redbee-econotag/Makefile.include @@ -29,3 +29,13 @@ export FFLAGS = -t $(PORT) -f $(HEXFILE) -c 'bbmc -l redbee-econotag reset' export OFLAGS = -O binary --gap-fill=0xff export INCLUDES += -I$(RIOTCPU)/$(CPU)/include/ -I$(RIOTBOARD)/$(BOARD)/include + +# un-comment once https://github.com/RIOT-OS/RIOT/issues/676 is fixed +#ifneq (,$(filter defaulttransceiver,$(USEMODULE))) +# ifeq (,$(filter mc1322x,$(USEMODULE))) +# USEMODULE += mc1322x +# endif +# ifeq (,$(filter transceiver,$(USEMODULE))) +# USEMODULE += transceiver +# endif +#endif diff --git a/boards/telosb/Makefile.include b/boards/telosb/Makefile.include index 219cced126..8a86c618f5 100644 --- a/boards/telosb/Makefile.include +++ b/boards/telosb/Makefile.include @@ -24,3 +24,12 @@ export FFLAGS = --telosb -c $(PORT) -r -e -I -p $(HEXFILE) export INCLUDES += -I$(RIOTCPU)/msp430-common/include -I$(RIOTBOARD)/$(BOARD)/include -I$(RIOTBASE)/drivers/cc2420/include -I$(RIOTBASE)/sys/net/include export OFLAGS = -O ihex + +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc2240,$(USEMODULE))) + USEMODULE += cc2420 + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif diff --git a/boards/wsn430-v1_3b/Makefile.dep b/boards/wsn430-v1_3b/Makefile.dep index ef9279fd5e..ec40a19435 100644 --- a/boards/wsn430-v1_3b/Makefile.dep +++ b/boards/wsn430-v1_3b/Makefile.dep @@ -1,3 +1,12 @@ +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc110x_ng,$(USEMODULE))) + USEMODULE += cc110x_ng + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif + ifneq (,$(filter cc110x_ng,$(USEMODULE))) ifeq (,$(filter cc110x_spi,$(USEMODULE))) USEMODULE += cc110x_spi diff --git a/boards/wsn430-v1_4/Makefile.dep b/boards/wsn430-v1_4/Makefile.dep index 4e36d0ff56..b2a12a0e67 100644 --- a/boards/wsn430-v1_4/Makefile.dep +++ b/boards/wsn430-v1_4/Makefile.dep @@ -1 +1,10 @@ USEMODULE += msp430_common + +ifneq (,$(filter defaulttransceiver,$(USEMODULE))) + ifeq (,$(filter cc2420,$(USEMODULE))) + USEMODULE += cc2420 + endif + ifeq (,$(filter transceiver,$(USEMODULE))) + USEMODULE += transceiver + endif +endif diff --git a/examples/default/Makefile b/examples/default/Makefile index 2070303e64..55f92b0c61 100644 --- a/examples/default/Makefile +++ b/examples/default/Makefile @@ -35,33 +35,22 @@ USEMODULE += shell_commands USEMODULE += ps USEMODULE += vtimer USEMODULE += auto_init +USEMODULE += defaulttransceiver + ifneq (,$(filter msb-430,$(BOARD))) USEMODULE += sht11 endif -ifneq (,$(filter msb-430h,$(BOARD))) - USEMODULE += sht11 - USEMODULE += cc110x_ng -endif -ifneq (,$(filter chronos,$(BOARD))) - USEMODULE += cc110x_ng -endif -ifneq (,$(filter wsn430-v1_3b,$(BOARD))) - USEMODULE += cc110x_ng -endif ifneq (,$(filter msba2,$(BOARD))) USEMODULE += sht11 USEMODULE += ltc4150 USEMODULE += rtc USEMODULE += mci - USEMODULE += cc110x_ng USEMODULE += config USEMODULE += random endif ifneq (,$(filter native,$(BOARD))) USEMODULE += ltc4150 USEMODULE += rtc - USEMODULE += nativenet - USEMODULE += transceiver USEMODULE += config USEMODULE += random endif diff --git a/examples/default/main.c b/examples/default/main.c index 0d8e5a23fe..a291896c77 100644 --- a/examples/default/main.c +++ b/examples/default/main.c @@ -94,25 +94,7 @@ void init_transceiver(void) radio, "radio"); - uint16_t transceivers = 0; -#ifdef MODULE_CC110X - transceivers |= TRANSCEIVER_CC1100; -#endif -#ifdef MODULE_CC110X_NG - transceivers |= TRANSCEIVER_CC1100; -#endif -#ifdef MODULE_CC2420 - transceivers |= TRANSCEIVER_CC2420; -#endif -#ifdef MODULE_NATIVENET - transceivers |= TRANSCEIVER_NATIVE; -#endif -#ifdef MODULE_AT86RF231 - transceivers |= TRANSCEIVER_AT86RF231; -#endif -#ifdef MODULE_MC1322X - transceivers |= TRANSCEIVER_MC1322X; -#endif + uint16_t transceivers = TRANSCEIVER_DEFAULT; transceiver_init(transceivers); (void) transceiver_start(); diff --git a/sys/include/transceiver.h b/sys/include/transceiver.h index 79553216fd..437e72c962 100644 --- a/sys/include/transceiver.h +++ b/sys/include/transceiver.h @@ -15,29 +15,54 @@ * https://github.com/RIOT-OS/RIOT/issues/117 */ #ifdef MODULE_CC110X #include "cc110x.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_CC1100 +#endif #endif #ifdef MODULE_CC110X_NG #include "cc110x_ng.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_CC1100 +#endif +#endif + +#ifdef MODULE_CC11020 +#include "cc1020.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_CC1020 +#endif #endif #ifdef MODULE_CC2420 #include "cc2420.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_CC2420 +#endif #endif #ifdef MODULE_MC1322X #include "mc1322x.h" #include "maca.h" #include "maca_packet.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_MC1322X +#endif #endif #ifdef MODULE_NATIVENET #include "nativenet.h" #include "nativenet_internal.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_NATIVE +#endif #endif #ifdef MODULE_AT86RF231 #include "at86rf231.h" +#ifndef TRANSCEIVER_DEFAULT +#define TRANSCEIVER_DEFAULT TRANSCEIVER_AT86RF231 +#endif #endif /* Stack size for transceiver thread */ From d58da976c64414c6b2ae0e7dde174bb375bb60c4 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Mon, 3 Mar 2014 10:05:36 +0100 Subject: [PATCH 2/5] make: add Makefile.pseudomodules and use it BASELIBS now defines targets for anything in USEMODULE that is not in PSEUDOMODULES move defaulttransceiver to Makefile.pseudomodules --- Makefile.modules | 10 ++++------ Makefile.pseudomodules | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) create mode 100644 Makefile.pseudomodules diff --git a/Makefile.modules b/Makefile.modules index a61df5f6bc..fa32697488 100644 --- a/Makefile.modules +++ b/Makefile.modules @@ -1,17 +1,15 @@ export MAKEBASE =$(RIOTBASE) UNDEF += $(BINDIR)startup.o +include $(RIOTBASE)/Makefile.pseudomodules + USEMODULE += cpu core sys INCLUDES += -I$(RIOTBASE)/core/include -I$(RIOTBASE)/drivers/include -I$(RIOTBASE)/sys/include ED = $(USEMODULE:%=-DMODULE_%) ED += $(USEPKG:%=-DMODULE_%) EXTDEFINES = $(shell echo $(ED)|tr 'a-z' 'A-Z') -BL=$(USEMODULE:%= $(BINDIR)%.a) - -# Exclude defaulttransceiver, it is only a pseudomodule that adds other -# modules depending on the current board. -export BASELIBS = $(shell echo $(BL)|sed \ - -e 's/[^ ]*defaulttransceiver.a//') +REALMODULES = $(filter-out $(PSEUDOMODULES), $(USEMODULE)) +export BASELIBS = $(REALMODULES:%= $(BINDIR)%.a) CFLAGS += $(EXTDEFINES) diff --git a/Makefile.pseudomodules b/Makefile.pseudomodules new file mode 100644 index 0000000000..b0414da39d --- /dev/null +++ b/Makefile.pseudomodules @@ -0,0 +1 @@ +PSEUDOMODULES += defaulttransceiver From ad0e3385119c0cf21296cebbec0c4f651c18f1fc Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Sat, 1 Mar 2014 16:59:33 +0100 Subject: [PATCH 3/5] tests/test_net_if: use defaulttransceiver --- tests/test_net_if/Makefile | 12 +----------- tests/test_net_if/main.c | 16 ++-------------- 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/tests/test_net_if/Makefile b/tests/test_net_if/Makefile index 1291891129..dbefb1829a 100644 --- a/tests/test_net_if/Makefile +++ b/tests/test_net_if/Makefile @@ -10,17 +10,7 @@ endif USEMODULE += auto_init USEMODULE += net_if -ifeq ($(BOARD),native) - USEMODULE += nativenet -else ifeq ($(BOARD),msba2) - USEMODULE += cc110x_ng -else ifeq ($(BOARD),telosb) - USEMODULE += cc2420 -else ifeq ($(BOARD),wsn430-v1_4) - USEMODULE += cc2420 -else ifeq ($(BOARD),iot-lab_M3) - USEMODULE += at86rf231 -endif +USEMODULE += defaulttransceiver export INCLUDES += -I$(RIOTBASE)/sys/net/include diff --git a/tests/test_net_if/main.c b/tests/test_net_if/main.c index bc4cbf71d6..956af77882 100644 --- a/tests/test_net_if/main.c +++ b/tests/test_net_if/main.c @@ -14,18 +14,6 @@ #include "net_help.h" #include "transceiver.h" -#ifndef TRANSCEIVER -#ifdef MODULE_AT86RF231 -#define TRANSCEIVER (TRANSCEIVER_AT86RF231) -#elif MODULE_CC110X_NG -#define TRANSCEIVER (TRANSCEIVER_CC1100) -#elif MODULE_NATIVENET -#define TRANSCEIVER (TRANSCEIVER_NATIVE) -#elif MODULE_CC2420 -#define TRANSCEIVER (TRANSCEIVER_CC2420) -#endif -#endif - int initialize_tests(void); int test_net_if_initialization(int iface); int test_net_if_get_add_l3p_types(int iface); @@ -110,10 +98,10 @@ int initialize_tests(void) int iface; #ifndef MODULE_AUTO_INIT - transceiver_init(TRANSCEIVER); + transceiver_init(TRANSCEIVER_DEFAULT); transceiver_start(); net_if_init(); - iface = net_if_init_interface(0, TRANSCEIVER); + iface = net_if_init_interface(0, TRANSCEIVER_DEFAULT); return iface; #else iface = -1; From 044bfb055aa1d5738f2316b74c2a59637d27a1a1 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Tue, 18 Mar 2014 10:17:43 +0100 Subject: [PATCH 4/5] tests/test_net_if: update BLACKLIST/WHITELIST --- tests/test_net_if/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_net_if/Makefile b/tests/test_net_if/Makefile index dbefb1829a..028d6ac58c 100644 --- a/tests/test_net_if/Makefile +++ b/tests/test_net_if/Makefile @@ -1,6 +1,6 @@ export PROJECT = test_net_if -BOARD_WHITELIST = native msba2 telosb +BOARD_BLACKLIST = mbed_lpc1768 include ../Makefile.tests_common From 619e94167e2582acb3e26b6b6176a60591dc6b17 Mon Sep 17 00:00:00 2001 From: Ludwig Ortmann Date: Sat, 1 Mar 2014 17:38:51 +0100 Subject: [PATCH 5/5] tests/test_pnet: use defaulttransceiver --- tests/test_pnet/Makefile | 11 +---------- tests/test_pnet/main.c | 6 ------ 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/tests/test_pnet/Makefile b/tests/test_pnet/Makefile index 01aa33b902..ef5a45b08a 100644 --- a/tests/test_pnet/Makefile +++ b/tests/test_pnet/Makefile @@ -1,20 +1,11 @@ export PROJECT =test_pnet include ../Makefile.tests_common -ifeq ($(BOARD),stm32f4discovery) - include Makefile.$(BOARD) -endif - USEMODULE += auto_init USEMODULE += posix USEMODULE += pnet USEMODULE += vtimer - -ifeq ($(strip $(BOARD)),native) - USEMODULE += nativenet -else ifeq ($(strip $(BOARD)),msba2) - USEMODULE += cc110x_ng -endif +USEMODULE += defaulttransceiver ifeq ($(BOARD),native) CFLAGS += -isystem $(RIOTBASE)/sys/net/include \ diff --git a/tests/test_pnet/main.c b/tests/test_pnet/main.c index 8cf8fcd630..eef717b896 100644 --- a/tests/test_pnet/main.c +++ b/tests/test_pnet/main.c @@ -30,12 +30,6 @@ #include "net_if.h" #include "ipv6.h" -#ifdef MODULE_NATIVENET -#define TRANSCEIVER TRANSCEIVER_NATIVE -#else -#define TRANSCEIVER TRANSCEIVER_CC1100 -#endif - #ifndef R_ADDR #define R_ADDR (1) #endif