Skip to content

Commit

Permalink
lib: Update samd21 code with local changes
Browse files Browse the repository at this point in the history
A minor change is necessary to work with GCC's -flto and to work with
common bootloaders.

Signed-off-by: Kevin O'Connor <[email protected]>
  • Loading branch information
KevinOConnor committed Aug 7, 2018
1 parent 5633e6c commit 71db5fb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/README
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ compile with gcc's LTO feature. See sam3x.patch for the modifications.
The samd21 directory contains code from the
Atmel.SAMD21_DFP.1.3.304.atpack zip file found at:
http://packs.download.atmel.com/
version 1.3.304 (extracted on 20180725).
version 1.3.304 (extracted on 20180725). It has been modified to
compile with gcc's LTO feature and to work with chips that have a
bootloader. See samd21.patch for the modifications.

The lpc176x directory contains code from the mbed project:
https://github.com/ARMmbed/mbed-os
Expand Down
26 changes: 26 additions & 0 deletions lib/samd21/samd21.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git a/lib/samd21/samd21a/gcc/gcc/samd21g18a_flash.ld b/lib/samd21/samd21a/gcc/gcc/samd21g18a_flash.ld
index c6f289e7..34dfb6ba 100644
--- a/lib/samd21/samd21a/gcc/gcc/samd21g18a_flash.ld
+++ b/lib/samd21/samd21a/gcc/gcc/samd21g18a_flash.ld
@@ -35,7 +35,7 @@ SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
- rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000
+ rom (rx) : ORIGIN = 0x00000000 + FLASH_START , LENGTH = 0x00040000 - FLASH_START
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}

diff --git a/lib/samd21/samd21a/gcc/gcc/startup_samd21.c b/lib/samd21/samd21a/gcc/gcc/startup_samd21.c
index 3dce0edd..a480077f 100644
--- a/lib/samd21/samd21a/gcc/gcc/startup_samd21.c
+++ b/lib/samd21/samd21a/gcc/gcc/startup_samd21.c
@@ -105,7 +105,7 @@ void PTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler
void I2S_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));

/* Exception Table */
-__attribute__ ((section(".vectors")))
+__attribute__ ((section(".vectors"))) __attribute__((externally_visible))
const DeviceVectors exception_table = {

/* Configure Initial Stack Pointer, using linker-generated symbols */
2 changes: 1 addition & 1 deletion lib/samd21/samd21a/gcc/gcc/samd21g18a_flash.ld
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SEARCH_DIR(.)
/* Memory Spaces Definitions */
MEMORY
{
rom (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000
rom (rx) : ORIGIN = 0x00000000 + FLASH_START , LENGTH = 0x00040000 - FLASH_START
ram (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
}

Expand Down
2 changes: 1 addition & 1 deletion lib/samd21/samd21a/gcc/gcc/startup_samd21.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void PTC_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler
void I2S_Handler ( void ) __attribute__ ((weak, alias("Dummy_Handler")));

/* Exception Table */
__attribute__ ((section(".vectors")))
__attribute__ ((section(".vectors"))) __attribute__((externally_visible))
const DeviceVectors exception_table = {

/* Configure Initial Stack Pointer, using linker-generated symbols */
Expand Down

0 comments on commit 71db5fb

Please sign in to comment.