From 7d481c179faa35c9b2d53774a2d13f923cd50591 Mon Sep 17 00:00:00 2001 From: Ron Evans Date: Tue, 10 Sep 2019 16:00:59 +0200 Subject: [PATCH] machine/atsamd21: uses different required magic values for BOSSA and UF2 bootloaders Signed-off-by: Ron Evans --- src/machine/board_arduino_nano33.go | 3 +++ src/machine/board_circuitplay_express.go | 3 +++ src/machine/board_feather-m0.go | 3 +++ src/machine/board_itsybitsy-m0.go | 3 +++ src/machine/board_trinket.go | 3 +++ src/machine/machine_atsamd21.go | 2 +- 6 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/machine/board_arduino_nano33.go b/src/machine/board_arduino_nano33.go index 9e90915c..24f62638 100644 --- a/src/machine/board_arduino_nano33.go +++ b/src/machine/board_arduino_nano33.go @@ -8,6 +8,9 @@ package machine import "device/sam" +// used to reset into bootloader +const RESET_MAGIC_VALUE = 0x07738135 + // GPIO Pins const ( RX0 Pin = PB23 // UART2 RX diff --git a/src/machine/board_circuitplay_express.go b/src/machine/board_circuitplay_express.go index 01d7c20a..6b196351 100644 --- a/src/machine/board_circuitplay_express.go +++ b/src/machine/board_circuitplay_express.go @@ -4,6 +4,9 @@ package machine import "device/sam" +// used to reset into bootloader +const RESET_MAGIC_VALUE = 0xf01669ef + // GPIO Pins const ( D0 = PB09 diff --git a/src/machine/board_feather-m0.go b/src/machine/board_feather-m0.go index 3f5e87e4..9f6e2285 100644 --- a/src/machine/board_feather-m0.go +++ b/src/machine/board_feather-m0.go @@ -4,6 +4,9 @@ package machine import "device/sam" +// used to reset into bootloader +const RESET_MAGIC_VALUE = 0xf01669ef + // GPIO Pins const ( D0 = PA11 // UART0 RX diff --git a/src/machine/board_itsybitsy-m0.go b/src/machine/board_itsybitsy-m0.go index dc934982..9631b46f 100644 --- a/src/machine/board_itsybitsy-m0.go +++ b/src/machine/board_itsybitsy-m0.go @@ -6,6 +6,9 @@ import ( "device/sam" ) +// used to reset into bootloader +const RESET_MAGIC_VALUE = 0xf01669ef + // GPIO Pins const ( D0 = PA11 // UART0 RX diff --git a/src/machine/board_trinket.go b/src/machine/board_trinket.go index 0bfb3c55..e95004bb 100644 --- a/src/machine/board_trinket.go +++ b/src/machine/board_trinket.go @@ -4,6 +4,9 @@ package machine import "device/sam" +// used to reset into bootloader +const RESET_MAGIC_VALUE = 0xf01669ef + // GPIO Pins const ( D0 = PA08 // PWM available diff --git a/src/machine/machine_atsamd21.go b/src/machine/machine_atsamd21.go index 0e76b9c5..a81af866 100644 --- a/src/machine/machine_atsamd21.go +++ b/src/machine/machine_atsamd21.go @@ -2081,7 +2081,7 @@ func ResetProcessor() { // Perform magic reset into bootloader, as mentioned in // https://github.com/arduino/ArduinoCore-samd/issues/197 - *(*uint32)(unsafe.Pointer(uintptr(0x20007FFC))) = 0x07738135 + *(*uint32)(unsafe.Pointer(uintptr(0x20007FFC))) = RESET_MAGIC_VALUE arm.SystemReset() }