samd21: Add support for entering Arduino bootloader via USB
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
b84ecebf8f
commit
62fc5dc288
|
@ -51,4 +51,4 @@ lib/bossac/bin/bossac:
|
||||||
flash: $(OUT)klipper.bin lib/bossac/bin/bossac
|
flash: $(OUT)klipper.bin lib/bossac/bin/bossac
|
||||||
@echo " Flashing $^ to $(FLASH_DEVICE) via bossac"
|
@echo " Flashing $^ to $(FLASH_DEVICE) via bossac"
|
||||||
$(Q)if [ -z $(FLASH_DEVICE) ]; then echo "Please specify FLASH_DEVICE"; exit 1; fi
|
$(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
|
||||||
|
|
|
@ -5,7 +5,9 @@
|
||||||
// This file may be distributed under the terms of the GNU GPLv3 license.
|
// This file may be distributed under the terms of the GNU GPLv3 license.
|
||||||
|
|
||||||
#include <string.h> // memcpy
|
#include <string.h> // memcpy
|
||||||
|
#include "autoconf.h" // CONFIG_FLASH_START
|
||||||
#include "board/io.h" // readl
|
#include "board/io.h" // readl
|
||||||
|
#include "board/irq.h" // irq_disable
|
||||||
#include "board/usb_cdc.h" // usb_notify_ep0
|
#include "board/usb_cdc.h" // usb_notify_ep0
|
||||||
#include "board/usb_cdc_ep.h" // USB_CDC_EP_BULK_IN
|
#include "board/usb_cdc_ep.h" // USB_CDC_EP_BULK_IN
|
||||||
#include "internal.h" // enable_pclock
|
#include "internal.h" // enable_pclock
|
||||||
|
@ -171,6 +173,12 @@ usb_set_configure(void)
|
||||||
void
|
void
|
||||||
usb_request_bootloader(void)
|
usb_request_bootloader(void)
|
||||||
{
|
{
|
||||||
|
if (CONFIG_FLASH_START) {
|
||||||
|
// Arduino Zero bootloader hack
|
||||||
|
irq_disable();
|
||||||
|
writel((void*)0x20007FFC, 0x07738135);
|
||||||
|
NVIC_SystemReset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue