From 5eb9f9d06074bf532683b268bc5370cfa33ce8ba Mon Sep 17 00:00:00 2001 From: Jeff Epler Date: Tue, 3 Apr 2018 21:20:42 -0500 Subject: [PATCH] atmel-samd: Fix rebooting to bootloader Commit efbf08266b6 moved _estack in order to ensure 8-byte alignment of the stack, but the address of _bootloader_dbl_tap must remain right at the end of SRAM. I verified by reading the source that the 4-byte-aligned address is used for all samd21 / samd51 boards in adafruit/circuitpython@efbf08266b. However, I only tested on trinket_m0. Closes: #739 --- ports/atmel-samd/boards/samd21x18-bootloader-crystalless.ld | 2 +- .../boards/samd21x18-bootloader-external-flash-crystalless.ld | 2 +- ports/atmel-samd/boards/samd21x18-bootloader-external-flash.ld | 2 +- ports/atmel-samd/boards/samd21x18-bootloader.ld | 2 +- ports/atmel-samd/boards/samd51x18-bootloader-external-flash.ld | 2 +- ports/atmel-samd/boards/samd51x19-bootloader-external-flash.ld | 2 +- ports/atmel-samd/boards/samd51x19-bootloader.ld | 2 +- ports/atmel-samd/boards/samd51x20-bootloader-external-flash.ld | 2 +- ports/atmel-samd/boards/samd51x20-bootloader.ld | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ports/atmel-samd/boards/samd21x18-bootloader-crystalless.ld b/ports/atmel-samd/boards/samd21x18-bootloader-crystalless.ld index 3b3c58ad2b..2adf4fa909 100644 --- a/ports/atmel-samd/boards/samd21x18-bootloader-crystalless.ld +++ b/ports/atmel-samd/boards/samd21x18-bootloader-crystalless.ld @@ -13,7 +13,7 @@ MEMORY /* top end of the stack */ /* stack must be double-word (8 byte) aligned */ _estack = ORIGIN(RAM) + LENGTH(RAM) - 8; -_bootloader_dbl_tap = _estack; +_bootloader_dbl_tap = ORIGIN(RAM) + LENGTH(RAM) - 4; /* define output sections */ SECTIONS diff --git a/ports/atmel-samd/boards/samd21x18-bootloader-external-flash-crystalless.ld b/ports/atmel-samd/boards/samd21x18-bootloader-external-flash-crystalless.ld index 7d86dea1f8..bddaae99da 100644 --- a/ports/atmel-samd/boards/samd21x18-bootloader-external-flash-crystalless.ld +++ b/ports/atmel-samd/boards/samd21x18-bootloader-external-flash-crystalless.ld @@ -13,7 +13,7 @@ MEMORY /* top end of the stack */ /* stack must be double-word (8 byte) aligned */ _estack = ORIGIN(RAM) + LENGTH(RAM) - 8; -_bootloader_dbl_tap = _estack; +_bootloader_dbl_tap = ORIGIN(RAM) + LENGTH(RAM) - 4; /* define output sections */ SECTIONS diff --git a/ports/atmel-samd/boards/samd21x18-bootloader-external-flash.ld b/ports/atmel-samd/boards/samd21x18-bootloader-external-flash.ld index 66bceee000..4e677a079f 100644 --- a/ports/atmel-samd/boards/samd21x18-bootloader-external-flash.ld +++ b/ports/atmel-samd/boards/samd21x18-bootloader-external-flash.ld @@ -13,7 +13,7 @@ MEMORY /* top end of the stack */ /* stack must be double-word (8 byte) aligned */ _estack = ORIGIN(RAM) + LENGTH(RAM) - 8; -_bootloader_dbl_tap = _estack; +_bootloader_dbl_tap = ORIGIN(RAM) + LENGTH(RAM) - 4; /* define output sections */ SECTIONS diff --git a/ports/atmel-samd/boards/samd21x18-bootloader.ld b/ports/atmel-samd/boards/samd21x18-bootloader.ld index 7e33ed007f..3eb97ee026 100644 --- a/ports/atmel-samd/boards/samd21x18-bootloader.ld +++ b/ports/atmel-samd/boards/samd21x18-bootloader.ld @@ -13,7 +13,7 @@ MEMORY /* top end of the stack */ /* stack must be double-word (8 byte) aligned */ _estack = ORIGIN(RAM) + LENGTH(RAM) - 8; -_bootloader_dbl_tap = _estack; +_bootloader_dbl_tap = ORIGIN(RAM) + LENGTH(RAM) - 4; /* define output sections */ SECTIONS diff --git a/ports/atmel-samd/boards/samd51x18-bootloader-external-flash.ld b/ports/atmel-samd/boards/samd51x18-bootloader-external-flash.ld index 0fc476889a..0bd2a8297c 100644 --- a/ports/atmel-samd/boards/samd51x18-bootloader-external-flash.ld +++ b/ports/atmel-samd/boards/samd51x18-bootloader-external-flash.ld @@ -13,7 +13,7 @@ MEMORY /* top end of the stack */ /* stack must be double-word (8 byte) aligned */ _estack = ORIGIN(RAM) + LENGTH(RAM) - 8; -_bootloader_dbl_tap = _estack; +_bootloader_dbl_tap = ORIGIN(RAM) + LENGTH(RAM) - 4; /* define output sections */ SECTIONS diff --git a/ports/atmel-samd/boards/samd51x19-bootloader-external-flash.ld b/ports/atmel-samd/boards/samd51x19-bootloader-external-flash.ld index cd65e965d3..b6b4f32650 100644 --- a/ports/atmel-samd/boards/samd51x19-bootloader-external-flash.ld +++ b/ports/atmel-samd/boards/samd51x19-bootloader-external-flash.ld @@ -13,7 +13,7 @@ MEMORY /* top end of the stack */ /* stack must be double-word (8 byte) aligned */ _estack = ORIGIN(RAM) + LENGTH(RAM) - 8; -_bootloader_dbl_tap = _estack; +_bootloader_dbl_tap = ORIGIN(RAM) + LENGTH(RAM) - 4; /* define output sections */ SECTIONS diff --git a/ports/atmel-samd/boards/samd51x19-bootloader.ld b/ports/atmel-samd/boards/samd51x19-bootloader.ld index 54e16a8f5c..4876e82277 100644 --- a/ports/atmel-samd/boards/samd51x19-bootloader.ld +++ b/ports/atmel-samd/boards/samd51x19-bootloader.ld @@ -13,7 +13,7 @@ MEMORY /* top end of the stack */ /* stack must be double-word (8 byte) aligned */ _estack = ORIGIN(RAM) + LENGTH(RAM) - 8; -_bootloader_dbl_tap = _estack; +_bootloader_dbl_tap = ORIGIN(RAM) + LENGTH(RAM) - 4; /* define output sections */ SECTIONS diff --git a/ports/atmel-samd/boards/samd51x20-bootloader-external-flash.ld b/ports/atmel-samd/boards/samd51x20-bootloader-external-flash.ld index 148f4dd9f2..3a1611279c 100644 --- a/ports/atmel-samd/boards/samd51x20-bootloader-external-flash.ld +++ b/ports/atmel-samd/boards/samd51x20-bootloader-external-flash.ld @@ -13,7 +13,7 @@ MEMORY /* top end of the stack */ /* stack must be double-word (8 byte) aligned */ _estack = ORIGIN(RAM) + LENGTH(RAM) - 8; -_bootloader_dbl_tap = _estack; +_bootloader_dbl_tap = ORIGIN(RAM) + LENGTH(RAM) - 4; /* define output sections */ SECTIONS diff --git a/ports/atmel-samd/boards/samd51x20-bootloader.ld b/ports/atmel-samd/boards/samd51x20-bootloader.ld index c8a43e7248..d3d37de3b2 100644 --- a/ports/atmel-samd/boards/samd51x20-bootloader.ld +++ b/ports/atmel-samd/boards/samd51x20-bootloader.ld @@ -13,7 +13,7 @@ MEMORY /* top end of the stack */ /* stack must be double-word (8 byte) aligned */ _estack = ORIGIN(RAM) + LENGTH(RAM) - 8; -_bootloader_dbl_tap = _estack; +_bootloader_dbl_tap = ORIGIN(RAM) + LENGTH(RAM) - 4; /* define output sections */ SECTIONS