diff --git a/boards/adafruit-grand-central-m4-express/Makefile.include b/boards/adafruit-grand-central-m4-express/Makefile.include index d3e7a2b17f..7e84470068 100644 --- a/boards/adafruit-grand-central-m4-express/Makefile.include +++ b/boards/adafruit-grand-central-m4-express/Makefile.include @@ -1,5 +1,3 @@ -CFLAGS += -DBOOTLOADER_UF2 - PROG_TTY_BOARD_FILTER := --vendor 'Adafruit Industries' --model 'Grand Central M4 Express' # Include all definitions for flashing with bossa other USB diff --git a/boards/adafruit-grand-central-m4-express/include/board.h b/boards/adafruit-grand-central-m4-express/include/board.h index deb2284168..041ddd9789 100644 --- a/boards/adafruit-grand-central-m4-express/include/board.h +++ b/boards/adafruit-grand-central-m4-express/include/board.h @@ -85,6 +85,8 @@ extern "C" { #endif /** @} */ +#define BOOTLOADER_UF2 1 /**< This board uses the UF2 bootloader */ + #ifdef __cplusplus } #endif diff --git a/boards/adafruit-itsybitsy-m4/Makefile.include b/boards/adafruit-itsybitsy-m4/Makefile.include index d9b879af10..a51f35fa36 100644 --- a/boards/adafruit-itsybitsy-m4/Makefile.include +++ b/boards/adafruit-itsybitsy-m4/Makefile.include @@ -1,5 +1,3 @@ -CFLAGS += -DBOOTLOADER_UF2 - # Include all definitions for flashing with bossa other USB include $(RIOTBOARD)/common/samdx1-arduino-bootloader/Makefile.include # Include handling of serial and non-bossa programmers (if selected by user) diff --git a/boards/adafruit-itsybitsy-m4/include/board.h b/boards/adafruit-itsybitsy-m4/include/board.h index f672518541..20f5f3a7f7 100644 --- a/boards/adafruit-itsybitsy-m4/include/board.h +++ b/boards/adafruit-itsybitsy-m4/include/board.h @@ -60,6 +60,8 @@ extern "C" { #define XTIMER_HZ (1000000ul) /** @} */ +#define BOOTLOADER_UF2 1 /**< This board uses the UF2 bootloader */ + #ifdef __cplusplus } #endif diff --git a/boards/adafruit-metro-m4-express/Makefile.include b/boards/adafruit-metro-m4-express/Makefile.include index bf9a2d4f0a..c768d54ae7 100644 --- a/boards/adafruit-metro-m4-express/Makefile.include +++ b/boards/adafruit-metro-m4-express/Makefile.include @@ -1,5 +1,3 @@ -CFLAGS += -DBOOTLOADER_UF2 - PROG_TTY_BOARD_FILTER := --vendor 'Adafruit Industries' --model 'Metro M4 Express' # Include all definitions for flashing with bossa other USB diff --git a/boards/adafruit-metro-m4-express/include/board.h b/boards/adafruit-metro-m4-express/include/board.h index cb1190e067..ab43b37348 100644 --- a/boards/adafruit-metro-m4-express/include/board.h +++ b/boards/adafruit-metro-m4-express/include/board.h @@ -66,6 +66,8 @@ extern "C" { #define MTD_0 mtd_dev_get(0) /**< MTD device for the 8 MiB QSPI Flash */ /** @} */ +#define BOOTLOADER_UF2 1 /**< This board uses the UF2 bootloader */ + #ifdef __cplusplus } #endif diff --git a/boards/adafruit-pybadge/Makefile.include b/boards/adafruit-pybadge/Makefile.include index c6786676d5..6fba1bcab3 100644 --- a/boards/adafruit-pybadge/Makefile.include +++ b/boards/adafruit-pybadge/Makefile.include @@ -1,5 +1,3 @@ -CFLAGS += -DBOOTLOADER_UF2 - # stdio over usb takes several seconds to be up after flashing TERM_DELAY ?= 4 diff --git a/boards/adafruit-pybadge/include/board.h b/boards/adafruit-pybadge/include/board.h index b1f9910bf4..ecb7c0b37a 100644 --- a/boards/adafruit-pybadge/include/board.h +++ b/boards/adafruit-pybadge/include/board.h @@ -107,6 +107,8 @@ extern "C" { #define XTIMER_HZ (1000000ul) /**< Default timer runs at 1MHz */ /** @} */ +#define BOOTLOADER_UF2 1 /**< This board uses the UF2 bootloader */ + #ifdef __cplusplus } #endif diff --git a/boards/common/samdx1-arduino-bootloader/reset.c b/boards/common/samdx1-arduino-bootloader/reset.c index 19ca1ef7fd..e1cd42f66f 100644 --- a/boards/common/samdx1-arduino-bootloader/reset.c +++ b/boards/common/samdx1-arduino-bootloader/reset.c @@ -20,21 +20,22 @@ #define USB_H_USER_IS_RIOT_INTERNAL +#include "board.h" #include "cpu.h" #include "usb_board_reset.h" #ifdef HMCRAMC0_ADDR -#define DBL_TAP_PTR ((volatile uint32_t *)(HMCRAMC0_ADDR + HMCRAMC0_SIZE - 4)) +# define DBL_TAP_PTR ((volatile uint32_t *)(HMCRAMC0_ADDR + HMCRAMC0_SIZE - 4)) #else -#define DBL_TAP_PTR ((volatile uint32_t *)(HSRAM_ADDR + HSRAM_SIZE - 4)) +# define DBL_TAP_PTR ((volatile uint32_t *)(HSRAM_ADDR + HSRAM_SIZE - 4)) #endif -#ifdef BOOTLOADER_UF2 -#define SAMD21_DOUBLE_TAP_ADDR DBL_TAP_PTR -#define SAMD21_DOUBLE_TAP_MAGIC_NUMBER (0xF01669EFUL) +#if BOOTLOADER_UF2 +# define SAMD21_DOUBLE_TAP_ADDR DBL_TAP_PTR +# define SAMD21_DOUBLE_TAP_MAGIC_NUMBER (0xF01669EFUL) #else -#define SAMD21_DOUBLE_TAP_ADDR (0x20007FFCUL) -#define SAMD21_DOUBLE_TAP_MAGIC_NUMBER (0x07738135UL) +# define SAMD21_DOUBLE_TAP_ADDR (0x20007FFCUL) +# define SAMD21_DOUBLE_TAP_MAGIC_NUMBER (0x07738135UL) #endif void usb_board_reset_in_bootloader(void) diff --git a/boards/feather-m0/Makefile.include b/boards/feather-m0/Makefile.include index 036fdb4188..df048f40b4 100644 --- a/boards/feather-m0/Makefile.include +++ b/boards/feather-m0/Makefile.include @@ -1,8 +1,3 @@ -# Boards after around 2018 use the more modern UF2 bootloader. -# Comment out for the old BOSSA bootloader or upgrade to -# the UF2 bootloader. -CFLAGS += -DBOOTLOADER_UF2 - # setup the flash tool used ifeq ($(PROGRAMMER),jlink) # in case J-Link is attached to SWD pins, use a plain CPU memory model diff --git a/boards/feather-m0/include/board.h b/boards/feather-m0/include/board.h index 19339a17b5..aca0bd9bbc 100644 --- a/boards/feather-m0/include/board.h +++ b/boards/feather-m0/include/board.h @@ -67,6 +67,15 @@ extern "C" { #define SX127X_PARAM_PASELECT (SX127X_PA_BOOST) /** @} */ +/** + * @brief This board uses the UF2 bootloader + * + * @details Boards after around 2018 use the more modern UF2 bootloader. + * Comment out for the old BOSSA bootloader or upgrade to + * the UF2 bootloader. + */ +#define BOOTLOADER_UF2 1 + #ifdef __cplusplus } #endif diff --git a/boards/seeeduino_xiao/Makefile.include b/boards/seeeduino_xiao/Makefile.include index d9b879af10..a51f35fa36 100644 --- a/boards/seeeduino_xiao/Makefile.include +++ b/boards/seeeduino_xiao/Makefile.include @@ -1,5 +1,3 @@ -CFLAGS += -DBOOTLOADER_UF2 - # Include all definitions for flashing with bossa other USB include $(RIOTBOARD)/common/samdx1-arduino-bootloader/Makefile.include # Include handling of serial and non-bossa programmers (if selected by user) diff --git a/boards/seeeduino_xiao/include/board.h b/boards/seeeduino_xiao/include/board.h index 8575ac4523..6704444af2 100644 --- a/boards/seeeduino_xiao/include/board.h +++ b/boards/seeeduino_xiao/include/board.h @@ -65,6 +65,8 @@ extern "C" { #define INTERNAL_PERIPHERAL_PID (0x0057) /** @} */ +#define BOOTLOADER_UF2 1 /**< This board uses the UF2 bootloader */ + #ifdef __cplusplus } #endif diff --git a/boards/serpente/Makefile.include b/boards/serpente/Makefile.include index d9b879af10..a51f35fa36 100644 --- a/boards/serpente/Makefile.include +++ b/boards/serpente/Makefile.include @@ -1,5 +1,3 @@ -CFLAGS += -DBOOTLOADER_UF2 - # Include all definitions for flashing with bossa other USB include $(RIOTBOARD)/common/samdx1-arduino-bootloader/Makefile.include # Include handling of serial and non-bossa programmers (if selected by user) diff --git a/boards/serpente/include/board.h b/boards/serpente/include/board.h index 8e9625cbe8..3d8398bd94 100644 --- a/boards/serpente/include/board.h +++ b/boards/serpente/include/board.h @@ -85,6 +85,8 @@ extern "C" { #define INTERNAL_PERIPHERAL_PID (0x0057) /** @} */ +#define BOOTLOADER_UF2 1 /**< This board uses the UF2 bootloader */ + #ifdef __cplusplus } #endif