From 59f3c1b48bf03c44139e1d94f733b524e3792de2 Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Tue, 25 Feb 2020 23:38:34 +0100 Subject: [PATCH] boards/samd21-arduino-bootloader: add support for UF2 bootloader --- boards/common/samd21-arduino-bootloader/reset.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/boards/common/samd21-arduino-bootloader/reset.c b/boards/common/samd21-arduino-bootloader/reset.c index 1078e2769e..8ea026e6dd 100644 --- a/boards/common/samd21-arduino-bootloader/reset.c +++ b/boards/common/samd21-arduino-bootloader/reset.c @@ -25,9 +25,19 @@ #include "usb_board_reset.h" +#ifdef HMCRAMC0_ADDR +#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)) +#endif +#ifdef 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) +#endif void usb_board_reset_in_bootloader(void) {