Skip to content

Commit ce5405f

Browse files
committed
Add method to automatically retrieve sketch start
The exported variable is used by banzai() to avoid erasing any bootloader part
1 parent d2b2ff9 commit ce5405f

File tree

11 files changed

+30
-6
lines changed

11 files changed

+30
-6
lines changed

VARIANT_COMPLIANCE_CHANGELOG

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
SAMD CORE 1.6.10
2+
3+
* the linker script is use should define __text_start__ symbol at the beginning of .text section
4+
15
SAMD CORE 1.6.6
26

37
* digitalPinToInterrupt #define moved to Arduino.h, variant.h must no longer define it

cores/arduino/Reset.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@ extern "C" {
2424
#endif
2525

2626
#define NVM_MEMORY ((volatile uint16_t *)0x000000)
27+
28+
#if (ARDUINO_SAMD_VARIANT_COMPLIANCE >= 10610)
29+
30+
extern const uint32_t __text_start__;
31+
#define APP_START ((volatile uint32_t)(&__text_start__) + 4)
32+
33+
#else
2734
#define APP_START 0x00002004
35+
#endif
2836

2937
static inline bool nvmReady(void) {
3038
return NVMCTRL->INTFLAG.reg & NVMCTRL_INTFLAG_READY;

variants/arduino_zero/linker_scripts/gcc/flash_with_bootloader.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ SECTIONS
6565
{
6666
.text :
6767
{
68+
__text_start__ = .;
69+
6870
KEEP(*(.isr_vector))
6971
*(.text*)
7072

variants/arduino_zero/linker_scripts/gcc/flash_without_bootloader.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ SECTIONS
6666
{
6767
.text :
6868
{
69+
__text_start__ = .;
70+
6971
KEEP(*(.isr_vector))
7072
*(.text*)
7173

variants/arduino_zero/variant.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
#ifndef _VARIANT_ARDUINO_ZERO_
2020
#define _VARIANT_ARDUINO_ZERO_
2121

22-
// The definitions here needs a SAMD core >=1.6.6
23-
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10606
22+
// The definitions here needs a SAMD core >=1.6.10
23+
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10610
2424

2525
/*----------------------------------------------------------------------------
2626
* Definitions

variants/mkr1000/linker_scripts/gcc/flash_with_bootloader.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ SECTIONS
6565
{
6666
.text :
6767
{
68+
__text_start__ = .;
69+
6870
KEEP(*(.isr_vector))
6971
*(.text*)
7072

variants/mkr1000/linker_scripts/gcc/flash_without_bootloader.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ SECTIONS
6666
{
6767
.text :
6868
{
69+
__text_start__ = .;
70+
6971
KEEP(*(.isr_vector))
7072
*(.text*)
7173

variants/mkr1000/variant.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
#pragma once
2020

21-
// The definitions here needs a SAMD core >=1.6.6
22-
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10606
21+
// The definitions here needs a SAMD core >=1.6.10
22+
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10610
2323

2424
#include <WVariant.h>
2525

variants/mkrzero/linker_scripts/gcc/flash_with_bootloader.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ SECTIONS
6565
{
6666
.text :
6767
{
68+
__text_start__ = .;
69+
6870
KEEP(*(.isr_vector))
6971
*(.text*)
7072

variants/mkrzero/linker_scripts/gcc/flash_without_bootloader.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ SECTIONS
6666
{
6767
.text :
6868
{
69+
__text_start__ = .;
70+
6971
KEEP(*(.isr_vector))
7072
*(.text*)
7173

variants/mkrzero/variant.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818

1919
#pragma once
2020

21-
// The definitions here needs a SAMD core >=1.6.3
22-
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10603
21+
// The definitions here needs a SAMD core >=1.6.10
22+
#define ARDUINO_SAMD_VARIANT_COMPLIANCE 10610
2323

2424
#include <WVariant.h>
2525

0 commit comments

Comments
 (0)