summaryrefslogtreecommitdiffstats
path: root/patches/binutils-2.20.1a/atmel/0003-Add-new-memory-regions-to-the-AVR-linker-script-temp.patch
blob: dae2a00aa285a19bf6b4ac503ac89bed9afd98a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
From 4d26906081a15ebbd0961196721665241c499f54 Mon Sep 17 00:00:00 2001
From: Stephan Linz <linz@li-pro.net>
Date: Mon, 18 Apr 2011 21:08:29 +0200
Subject: [PATCH 3/9] Add new memory regions to the AVR linker script template

This adds support for fuse, lock and signature memory regions.
This patch has been used extensively in the field for a while
with no issues and allows this data to be added to the ELF output
file. The fuse and lock information is needed for programming the
AVR chip. So this allows the user to contain all information needed
for programming an AVR chip in one single ELF file.

Quote by Eric Weddington (2011-03-14):
http://old.nabble.com/-AVR--Add-new-memory-regions-to-script-template-td31144851.html

Original ATMEL patch from:
http://distribute.atmel.no/tools/opensource/avr-gcc/binutils-2.20.1/32-binutils-2.20.1-new-sections.patch

Signed-off-by: Stephan Linz <linz@li-pro.net>
---
 ld/scripttempl/avr.sc |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/ld/scripttempl/avr.sc b/ld/scripttempl/avr.sc
index 4545b72..c11de86 100644
--- a/ld/scripttempl/avr.sc
+++ b/ld/scripttempl/avr.sc
@@ -7,6 +7,9 @@ MEMORY
   text   (rx)   : ORIGIN = 0, LENGTH = $TEXT_LENGTH
   data   (rw!x) : ORIGIN = $DATA_ORIGIN, LENGTH = $DATA_LENGTH
   eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = 64K
+  fuse      (rw!x) : ORIGIN = 0x820000, LENGTH = 1K
+  lock      (rw!x) : ORIGIN = 0x830000, LENGTH = 1K
+  signature (rw!x) : ORIGIN = 0x840000, LENGTH = 1K
 }
 
 SECTIONS
@@ -196,6 +199,24 @@ SECTIONS
     ${RELOCATING+ __eeprom_end = . ; }
   } ${RELOCATING+ > eeprom}
 
+  .fuse ${RELOCATING-0}:
+  {
+    KEEP(*(.fuse))
+    KEEP(*(.lfuse))
+    KEEP(*(.hfuse))
+    KEEP(*(.efuse))
+  } ${RELOCATING+ > fuse}
+
+  .lock ${RELOCATING-0}:
+  {
+    KEEP(*(.lock*))
+  } ${RELOCATING+ > lock}
+
+  .signature ${RELOCATING-0}:
+  {
+    KEEP(*(.signature*))
+  } ${RELOCATING+ > signature}
+
   /* Stabs debugging sections.  */
   .stab 0 : { *(.stab) }
   .stabstr 0 : { *(.stabstr) }
-- 
1.6.0.4