diff --git a/boards/common/arduino-mkr/Makefile b/boards/common/arduino-mkr/Makefile index 7c64bc0598..b4202bae82 100644 --- a/boards/common/arduino-mkr/Makefile +++ b/boards/common/arduino-mkr/Makefile @@ -1,3 +1,8 @@ MODULE = boards_common_arduino-mkr +ifneq (,$(filter boards_common_samd21-arduino-bootloader,$(USEMODULE))) + # Add the samd21-arduino-bootloader directory to the build + DIRS += $(RIOTBOARD)/common/samd21-arduino-bootloader +endif + include $(RIOTBASE)/Makefile.base diff --git a/boards/common/arduino-mkr/Makefile.dep b/boards/common/arduino-mkr/Makefile.dep index c15f2eaf26..e33b5e122e 100644 --- a/boards/common/arduino-mkr/Makefile.dep +++ b/boards/common/arduino-mkr/Makefile.dep @@ -2,5 +2,13 @@ ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += saul_gpio endif -# setup the samd21 arduino bootloader related dependencies -include $(RIOTBOARD)/common/samd21-arduino-bootloader/Makefile.dep +# use arduino-bootloader only if no other stdio_% other than stdio_cdc_acm +# is requested +ifeq (,$(filter-out stdio_cdc_acm,$(filter stdio_%,$(USEMODULE)))) + USEMODULE += boards_common_samd21-arduino-bootloader +endif + +ifneq (,$(filter boards_common_samd21-arduino-bootloader,$(USEMODULE))) + # setup the samd21 arduino bootloader related dependencies + include $(RIOTBOARD)/common/samd21-arduino-bootloader/Makefile.dep +endif diff --git a/boards/common/samd21-arduino-bootloader/Makefile.dep b/boards/common/samd21-arduino-bootloader/Makefile.dep index 4edaa81458..d1c9d54246 100644 --- a/boards/common/samd21-arduino-bootloader/Makefile.dep +++ b/boards/common/samd21-arduino-bootloader/Makefile.dep @@ -1,10 +1,5 @@ -# Provide stdio over USB by default -# This is a temporary solution until management of stdio is correctly -# handled by the build system -DEFAULT_MODULE += stdio_cdc_acm - # This boards requires support for Arduino bootloader. USEMODULE += usb_board_reset -USEMODULE += boards_common_samd21-arduino-bootloader +USEMODULE += stdio_cdc_acm FEATURES_REQUIRED += bootloader_arduino diff --git a/boards/common/samd21-arduino-bootloader/Makefile.include b/boards/common/samd21-arduino-bootloader/Makefile.include index cbc6d0fba0..a0ada4f21a 100644 --- a/boards/common/samd21-arduino-bootloader/Makefile.include +++ b/boards/common/samd21-arduino-bootloader/Makefile.include @@ -26,6 +26,3 @@ term-delay: TESTRUNNER_CONNECT_DELAY ?= $(TERM_DELAY) $(call target-export-variables,test,TESTRUNNER_CONNECT_DELAY) - -# Add the samd21-arduino-bootloader directory to the build -DIRS += $(RIOTBOARD)/common/samd21-arduino-bootloader diff --git a/boards/common/samd21-arduino-bootloader/reset.c b/boards/common/samd21-arduino-bootloader/reset.c index ced63c7953..620f5fbee6 100644 --- a/boards/common/samd21-arduino-bootloader/reset.c +++ b/boards/common/samd21-arduino-bootloader/reset.c @@ -19,6 +19,8 @@ * @} */ +#ifdef MODULE_BOARDS_COMMON_SAMD21_ARDUINO_BOOTLOADER + #define USB_H_USER_IS_RIOT_INTERNAL #include "usb_board_reset.h" @@ -41,3 +43,6 @@ void usb_board_reset_in_bootloader(void) usb_board_reset_in_application(); } +#else +typedef int dont_be_pedantic; +#endif /* MODULE_BOARDS_COMMON_SAMD21_ARDUINO_BOOTLOADER */ diff --git a/boards/common/sodaq/Makefile b/boards/common/sodaq/Makefile index 6792d1f556..8d1038131b 100644 --- a/boards/common/sodaq/Makefile +++ b/boards/common/sodaq/Makefile @@ -1,3 +1,8 @@ MODULE = boards_common_sodaq +ifneq (,$(filter boards_common_samd21-arduino-bootloader,$(USEMODULE))) + # Add the samd21-arduino-bootloader directory to the build + DIRS += $(RIOTBOARD)/common/samd21-arduino-bootloader +endif + include $(RIOTBASE)/Makefile.base diff --git a/boards/common/sodaq/Makefile.dep b/boards/common/sodaq/Makefile.dep index c15f2eaf26..e33b5e122e 100644 --- a/boards/common/sodaq/Makefile.dep +++ b/boards/common/sodaq/Makefile.dep @@ -2,5 +2,13 @@ ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += saul_gpio endif -# setup the samd21 arduino bootloader related dependencies -include $(RIOTBOARD)/common/samd21-arduino-bootloader/Makefile.dep +# use arduino-bootloader only if no other stdio_% other than stdio_cdc_acm +# is requested +ifeq (,$(filter-out stdio_cdc_acm,$(filter stdio_%,$(USEMODULE)))) + USEMODULE += boards_common_samd21-arduino-bootloader +endif + +ifneq (,$(filter boards_common_samd21-arduino-bootloader,$(USEMODULE))) + # setup the samd21 arduino bootloader related dependencies + include $(RIOTBOARD)/common/samd21-arduino-bootloader/Makefile.dep +endif diff --git a/boards/feather-m0/Makefile b/boards/feather-m0/Makefile index f8fcbb53a0..c43a63297c 100644 --- a/boards/feather-m0/Makefile +++ b/boards/feather-m0/Makefile @@ -1,3 +1,8 @@ MODULE = board +ifneq (,$(filter boards_common_samd21-arduino-bootloader,$(USEMODULE))) + # Add the samd21-arduino-bootloader directory to the build + DIRS += $(RIOTBOARD)/common/samd21-arduino-bootloader +endif + include $(RIOTBASE)/Makefile.base diff --git a/boards/feather-m0/Makefile.dep b/boards/feather-m0/Makefile.dep index c15f2eaf26..e33b5e122e 100644 --- a/boards/feather-m0/Makefile.dep +++ b/boards/feather-m0/Makefile.dep @@ -2,5 +2,13 @@ ifneq (,$(filter saul_default,$(USEMODULE))) USEMODULE += saul_gpio endif -# setup the samd21 arduino bootloader related dependencies -include $(RIOTBOARD)/common/samd21-arduino-bootloader/Makefile.dep +# use arduino-bootloader only if no other stdio_% other than stdio_cdc_acm +# is requested +ifeq (,$(filter-out stdio_cdc_acm,$(filter stdio_%,$(USEMODULE)))) + USEMODULE += boards_common_samd21-arduino-bootloader +endif + +ifneq (,$(filter boards_common_samd21-arduino-bootloader,$(USEMODULE))) + # setup the samd21 arduino bootloader related dependencies + include $(RIOTBOARD)/common/samd21-arduino-bootloader/Makefile.dep +endif diff --git a/boards/sodaq-one/Makefile b/boards/sodaq-one/Makefile index f8fcbb53a0..c43a63297c 100644 --- a/boards/sodaq-one/Makefile +++ b/boards/sodaq-one/Makefile @@ -1,3 +1,8 @@ MODULE = board +ifneq (,$(filter boards_common_samd21-arduino-bootloader,$(USEMODULE))) + # Add the samd21-arduino-bootloader directory to the build + DIRS += $(RIOTBOARD)/common/samd21-arduino-bootloader +endif + include $(RIOTBASE)/Makefile.base diff --git a/boards/sodaq-sara-aff/Makefile b/boards/sodaq-sara-aff/Makefile index f8fcbb53a0..c43a63297c 100644 --- a/boards/sodaq-sara-aff/Makefile +++ b/boards/sodaq-sara-aff/Makefile @@ -1,3 +1,8 @@ MODULE = board +ifneq (,$(filter boards_common_samd21-arduino-bootloader,$(USEMODULE))) + # Add the samd21-arduino-bootloader directory to the build + DIRS += $(RIOTBOARD)/common/samd21-arduino-bootloader +endif + include $(RIOTBASE)/Makefile.base