Skip to content

Commit 9f8c0dc

Browse files
SpenceKondefacchinm
authored andcommitted
Materials for arduino#66, arduino#67, and another issue
See info.txt in alsoneeded directory for more information on this. These files need to replace the standard versions of them in order to fix arduino#66, arduino#67, and an issue with eeprom_is_ready() in eeprom.h that manifests on the newer parts. Unfortunately I'm not good enough at shell scripting to make the build scripts slip these fixes in
1 parent 93db899 commit 9f8c0dc

11 files changed

+4156
-0
lines changed

alsoneeded/Info.txt

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
These need to replace the normal versions of these files - there doesn't appear to already be a way to do this - or it wasn't readily apparent to me (I see another version of eeprom.h in the avrlibc patches - but it doesn't get included in the packages that the build scripts generate- and a good thing that is too too, because it would be incompatible with megaAVR 0-series, tinyAVR 0-series and 1-series too). I've made a set of packages for my own use by assembling from windows kit (I couldn't get cross compiling working) but would love to see these get rolled in.
2+
3+
4+
eeprom.h is from avr3.6.2.1759 (from microchip site) - it fixes the error when using eeprom_is_read() macro from this library.
5+
6+
power.h was from discussion on #66 and has been tested.
7+
8+
Have also included the modified linker scripts to fix #67. This uses the slightly safer approach that was posted in one of those threads of making sure the symbol is defined before trying to use it, though I'm not sure how that could end up happening.
9+
10+
It's not clear to me which of the linker scripts, potentially, could possible end up being used - so this includes the linker scripts for all the tinyAVR 0-series, tinyAVR 1-series, megaAVR 0-series (avrxmega3) and the DA series parts (avrxmega4)
11+

alsoneeded/avrxmega3.xbn

+268
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,268 @@
1+
/* Script for -N: mix text and data on same page; don't align data */
2+
/* Copyright (C) 2014-2015 Free Software Foundation, Inc.
3+
Copying and distribution of this script, with or without modification,
4+
are permitted in any medium without royalty provided the copyright
5+
notice and this notice are preserved. */
6+
OUTPUT_FORMAT("elf32-avr","elf32-avr","elf32-avr")
7+
OUTPUT_ARCH(avr:103)
8+
__TEXT_REGION_LENGTH__ = DEFINED(__TEXT_REGION_LENGTH__) ? __TEXT_REGION_LENGTH__ : 1024K;
9+
__DATA_REGION_LENGTH__ = DEFINED(__DATA_REGION_LENGTH__) ? __DATA_REGION_LENGTH__ : 0xffa0;
10+
__EEPROM_REGION_LENGTH__ = DEFINED(__EEPROM_REGION_LENGTH__) ? __EEPROM_REGION_LENGTH__ : 64K;
11+
__FUSE_REGION_LENGTH__ = DEFINED(__FUSE_REGION_LENGTH__) ? __FUSE_REGION_LENGTH__ : 1K;
12+
__LOCK_REGION_LENGTH__ = DEFINED(__LOCK_REGION_LENGTH__) ? __LOCK_REGION_LENGTH__ : 1K;
13+
__SIGNATURE_REGION_LENGTH__ = DEFINED(__SIGNATURE_REGION_LENGTH__) ? __SIGNATURE_REGION_LENGTH__ : 1K;
14+
__USER_SIGNATURE_REGION_LENGTH__ = DEFINED(__USER_SIGNATURE_REGION_LENGTH__) ? __USER_SIGNATURE_REGION_LENGTH__ : 1K;
15+
__RODATA_PM_OFFSET__ = DEFINED(__RODATA_PM_OFFSET__) ? __RODATA_PM_OFFSET__ : 0x8000;
16+
__DATA_REGION_ORIGIN__ = DEFINED(__DATA_REGION_ORIGIN__) ? __DATA_REGION_ORIGIN__ : 0x802000;
17+
MEMORY
18+
{
19+
text (rx) : ORIGIN = 0, LENGTH = __TEXT_REGION_LENGTH__
20+
data (rw!x) : ORIGIN = __DATA_REGION_ORIGIN__, LENGTH = __DATA_REGION_LENGTH__
21+
eeprom (rw!x) : ORIGIN = 0x810000, LENGTH = __EEPROM_REGION_LENGTH__
22+
fuse (rw!x) : ORIGIN = 0x820000, LENGTH = __FUSE_REGION_LENGTH__
23+
lock (rw!x) : ORIGIN = 0x830000, LENGTH = __LOCK_REGION_LENGTH__
24+
signature (rw!x) : ORIGIN = 0x840000, LENGTH = __SIGNATURE_REGION_LENGTH__
25+
user_signatures (rw!x) : ORIGIN = 0x850000, LENGTH = __USER_SIGNATURE_REGION_LENGTH__
26+
}
27+
SECTIONS
28+
{
29+
/* Read-only sections, merged into text segment: */
30+
.hash : { *(.hash) }
31+
.dynsym : { *(.dynsym) }
32+
.dynstr : { *(.dynstr) }
33+
.gnu.version : { *(.gnu.version) }
34+
.gnu.version_d : { *(.gnu.version_d) }
35+
.gnu.version_r : { *(.gnu.version_r) }
36+
.rel.init : { *(.rel.init) }
37+
.rela.init : { *(.rela.init) }
38+
.rel.text :
39+
{
40+
*(.rel.text)
41+
*(.rel.text.*)
42+
*(.rel.gnu.linkonce.t*)
43+
}
44+
.rela.text :
45+
{
46+
*(.rela.text)
47+
*(.rela.text.*)
48+
*(.rela.gnu.linkonce.t*)
49+
}
50+
.rel.fini : { *(.rel.fini) }
51+
.rela.fini : { *(.rela.fini) }
52+
.rel.rodata :
53+
{
54+
*(.rel.rodata)
55+
*(.rel.rodata.*)
56+
*(.rel.gnu.linkonce.r*)
57+
}
58+
.rela.rodata :
59+
{
60+
*(.rela.rodata)
61+
*(.rela.rodata.*)
62+
*(.rela.gnu.linkonce.r*)
63+
}
64+
.rel.data :
65+
{
66+
*(.rel.data)
67+
*(.rel.data.*)
68+
*(.rel.gnu.linkonce.d*)
69+
}
70+
.rela.data :
71+
{
72+
*(.rela.data)
73+
*(.rela.data.*)
74+
*(.rela.gnu.linkonce.d*)
75+
}
76+
.rel.ctors : { *(.rel.ctors) }
77+
.rela.ctors : { *(.rela.ctors) }
78+
.rel.dtors : { *(.rel.dtors) }
79+
.rela.dtors : { *(.rela.dtors) }
80+
.rel.got : { *(.rel.got) }
81+
.rela.got : { *(.rela.got) }
82+
.rel.bss : { *(.rel.bss) }
83+
.rela.bss : { *(.rela.bss) }
84+
.rel.plt : { *(.rel.plt) }
85+
.rela.plt : { *(.rela.plt) }
86+
/* Internal text space or external memory. */
87+
.text :
88+
{
89+
*(.vectors)
90+
KEEP(*(.vectors))
91+
/* For data that needs to reside in the lower 64k of progmem. */
92+
*(.progmem.gcc*)
93+
/* PR 13812: Placing the trampolines here gives a better chance
94+
that they will be in range of the code that uses them. */
95+
. = ALIGN(2);
96+
__trampolines_start = . ;
97+
/* The jump trampolines for the 16-bit limited relocs will reside here. */
98+
*(.trampolines)
99+
*(.trampolines*)
100+
__trampolines_end = . ;
101+
/* avr-libc expects these data to reside in lower 64K. */
102+
*libprintf_flt.a:*(.progmem.data)
103+
*libc.a:*(.progmem.data)
104+
*(.progmem*)
105+
. = ALIGN(2);
106+
/* For future tablejump instruction arrays for 3 byte pc devices.
107+
We don't relax jump/call instructions within these sections. */
108+
*(.jumptables)
109+
*(.jumptables*)
110+
/* For code that needs to reside in the lower 128k progmem. */
111+
*(.lowtext)
112+
*(.lowtext*)
113+
__ctors_start = . ;
114+
*(.ctors)
115+
__ctors_end = . ;
116+
__dtors_start = . ;
117+
*(.dtors)
118+
__dtors_end = . ;
119+
KEEP(SORT(*)(.ctors))
120+
KEEP(SORT(*)(.dtors))
121+
/* From this point on, we don't bother about wether the insns are
122+
below or above the 16 bits boundary. */
123+
*(.init0) /* Start here after reset. */
124+
KEEP (*(.init0))
125+
*(.init1)
126+
KEEP (*(.init1))
127+
*(.init2) /* Clear __zero_reg__, set up stack pointer. */
128+
KEEP (*(.init2))
129+
*(.init3)
130+
KEEP (*(.init3))
131+
*(.init4) /* Initialize data and BSS. */
132+
KEEP (*(.init4))
133+
*(.init5)
134+
KEEP (*(.init5))
135+
*(.init6) /* C++ constructors. */
136+
KEEP (*(.init6))
137+
*(.init7)
138+
KEEP (*(.init7))
139+
*(.init8)
140+
KEEP (*(.init8))
141+
*(.init9) /* Call main(). */
142+
KEEP (*(.init9))
143+
*(.text)
144+
. = ALIGN(2);
145+
*(.text.*)
146+
. = ALIGN(2);
147+
*(.fini9) /* _exit() starts here. */
148+
KEEP (*(.fini9))
149+
*(.fini8)
150+
KEEP (*(.fini8))
151+
*(.fini7)
152+
KEEP (*(.fini7))
153+
*(.fini6) /* C++ destructors. */
154+
KEEP (*(.fini6))
155+
*(.fini5)
156+
KEEP (*(.fini5))
157+
*(.fini4)
158+
KEEP (*(.fini4))
159+
*(.fini3)
160+
KEEP (*(.fini3))
161+
*(.fini2)
162+
KEEP (*(.fini2))
163+
*(.fini1)
164+
KEEP (*(.fini1))
165+
*(.fini0) /* Infinite loop after program termination. */
166+
KEEP (*(.fini0))
167+
_etext = . ;
168+
} > text
169+
.rodata ADDR(.text) + SIZEOF (.text) + __RODATA_PM_OFFSET__ :
170+
{
171+
*(.rodata)
172+
*(.rodata*)
173+
*(.gnu.linkonce.r*)
174+
} AT> text
175+
.data :
176+
{
177+
PROVIDE (__data_start = .) ;
178+
*(.data)
179+
*(.data*)
180+
*(.gnu.linkonce.d*)
181+
. = ALIGN(2);
182+
_edata = . ;
183+
PROVIDE (__data_end = .) ;
184+
} > data AT> text
185+
.bss ADDR(.data) + SIZEOF (.data) : AT (ADDR (.bss))
186+
{
187+
PROVIDE (__bss_start = .) ;
188+
*(.bss)
189+
*(.bss*)
190+
*(COMMON)
191+
PROVIDE (__bss_end = .) ;
192+
} > data
193+
__data_load_start = LOADADDR(.data);
194+
__data_load_end = __data_load_start + SIZEOF(.data);
195+
/* Global data not cleared after reset. */
196+
.noinit ADDR(.bss) + SIZEOF (.bss) : AT (ADDR (.noinit))
197+
{
198+
PROVIDE (__noinit_start = .) ;
199+
*(.noinit*)
200+
PROVIDE (__noinit_end = .) ;
201+
_end = . ;
202+
PROVIDE (__heap_start = .) ;
203+
} > data
204+
.eeprom :
205+
{
206+
/* See .data above... */
207+
KEEP(*(.eeprom*))
208+
__eeprom_end = . ;
209+
} > eeprom
210+
.fuse :
211+
{
212+
KEEP(*(.fuse))
213+
KEEP(*(.lfuse))
214+
KEEP(*(.hfuse))
215+
KEEP(*(.efuse))
216+
} > fuse
217+
.lock :
218+
{
219+
KEEP(*(.lock*))
220+
} > lock
221+
.signature :
222+
{
223+
KEEP(*(.signature*))
224+
} > signature
225+
.user_signatures :
226+
{
227+
KEEP(*(.user_signatures*))
228+
} > user_signatures
229+
/* Stabs debugging sections. */
230+
.stab 0 : { *(.stab) }
231+
.stabstr 0 : { *(.stabstr) }
232+
.stab.excl 0 : { *(.stab.excl) }
233+
.stab.exclstr 0 : { *(.stab.exclstr) }
234+
.stab.index 0 : { *(.stab.index) }
235+
.stab.indexstr 0 : { *(.stab.indexstr) }
236+
.comment 0 : { *(.comment) }
237+
.note.gnu.build-id : { *(.note.gnu.build-id) }
238+
/* DWARF debug sections.
239+
Symbols in the DWARF debugging sections are relative to the beginning
240+
of the section so we begin them at 0. */
241+
/* DWARF 1 */
242+
.debug 0 : { *(.debug) }
243+
.line 0 : { *(.line) }
244+
/* GNU DWARF 1 extensions */
245+
.debug_srcinfo 0 : { *(.debug_srcinfo) }
246+
.debug_sfnames 0 : { *(.debug_sfnames) }
247+
/* DWARF 1.1 and DWARF 2 */
248+
.debug_aranges 0 : { *(.debug_aranges) }
249+
.debug_pubnames 0 : { *(.debug_pubnames) }
250+
/* DWARF 2 */
251+
.debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
252+
.debug_abbrev 0 : { *(.debug_abbrev) }
253+
.debug_line 0 : { *(.debug_line .debug_line.* .debug_line_end ) }
254+
.debug_frame 0 : { *(.debug_frame) }
255+
.debug_str 0 : { *(.debug_str) }
256+
.debug_loc 0 : { *(.debug_loc) }
257+
.debug_macinfo 0 : { *(.debug_macinfo) }
258+
/* SGI/MIPS DWARF 2 extensions */
259+
.debug_weaknames 0 : { *(.debug_weaknames) }
260+
.debug_funcnames 0 : { *(.debug_funcnames) }
261+
.debug_typenames 0 : { *(.debug_typenames) }
262+
.debug_varnames 0 : { *(.debug_varnames) }
263+
/* DWARF 3 */
264+
.debug_pubtypes 0 : { *(.debug_pubtypes) }
265+
.debug_ranges 0 : { *(.debug_ranges) }
266+
/* DWARF Extension. */
267+
.debug_macro 0 : { *(.debug_macro) }
268+
}

0 commit comments

Comments
 (0)