diff --git a/src/samd21/Makefile b/src/samd21/Makefile index 2bcf91512..24ef1e495 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 a574b31c8..0864a4c50 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 // 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