aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/samd21/Makefile2
-rw-r--r--src/samd21/usbserial.c8
2 files changed, 9 insertions, 1 deletions
diff --git a/src/samd21/Makefile b/src/samd21/Makefile
index 2bcf9151..24ef1e49 100644
--- a/src/samd21/Makefile
+++ b/src/samd21/Makefile
@@ -51,4 +51,4 @@ lib/bossac/bin/bossac:
flash: $(OUT)klipper.bin lib/bossac/bin/bossac
@echo " Flashing $^ to $(FLASH_DEVICE) via bossac"
$(Q)if [ -z $(FLASH_DEVICE) ]; then echo "Please specify FLASH_DEVICE"; exit 1; fi
- $(Q)lib/bossac/bin/bossac -U -p "$(FLASH_DEVICE)" --offset=0x2000 -w $(OUT)klipper.bin -v -b -R
+ $(Q)lib/bossac/bin/bossac -U -p "$(FLASH_DEVICE)" -a --offset=0x2000 -w $(OUT)klipper.bin -v -b -R
diff --git a/src/samd21/usbserial.c b/src/samd21/usbserial.c
index a574b31c..0864a4c5 100644
--- a/src/samd21/usbserial.c
+++ b/src/samd21/usbserial.c
@@ -5,7 +5,9 @@
// This file may be distributed under the terms of the GNU GPLv3 license.
#include <string.h> // memcpy
+#include "autoconf.h" // CONFIG_FLASH_START
#include "board/io.h" // readl
+#include "board/irq.h" // irq_disable
#include "board/usb_cdc.h" // usb_notify_ep0
#include "board/usb_cdc_ep.h" // USB_CDC_EP_BULK_IN
#include "internal.h" // enable_pclock
@@ -171,6 +173,12 @@ usb_set_configure(void)
void
usb_request_bootloader(void)
{
+ if (CONFIG_FLASH_START) {
+ // Arduino Zero bootloader hack
+ irq_disable();
+ writel((void*)0x20007FFC, 0x07738135);
+ NVIC_SystemReset();
+ }
}
void