diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2018-12-05 21:26:51 -0500 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2018-12-24 11:43:11 -0500 |
commit | 62fc5dc2884c41eb45880b0e9c988cabb025d1c1 (patch) | |
tree | f26b8421f22c102634edb1a3fba69f26ab56f553 | |
parent | b84ecebf8f005175549297f1a818cf65822c3106 (diff) | |
download | kutter-62fc5dc2884c41eb45880b0e9c988cabb025d1c1.tar.gz kutter-62fc5dc2884c41eb45880b0e9c988cabb025d1c1.tar.xz kutter-62fc5dc2884c41eb45880b0e9c988cabb025d1c1.zip |
samd21: Add support for entering Arduino bootloader via USB
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/samd21/Makefile | 2 | ||||
-rw-r--r-- | src/samd21/usbserial.c | 8 |
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 |