Skip to content

Commit 5be14e9

Browse files
committed
config/linker: add sam3u family linkers
Signed-off-by: perigoso <perigoso@riseup.net>
1 parent 5bc2aaf commit 5be14e9

File tree

4 files changed

+161
-0
lines changed

4 files changed

+161
-0
lines changed

config/linker/sam3u/common.ld

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
ENTRY(_reset_isr)
2+
3+
_min_heap_size = 0x800;
4+
_min_stack_size = 0x400;
5+
6+
/* Initial stack pointer (must be 8 byte aligned) */
7+
_estack = (ORIGIN(ram) + LENGTH(ram)) & ~7;
8+
9+
/* Internal device memory */
10+
PROVIDE(_system_unique_id = 0x1FFFF7E8);
11+
PROVIDE(_system_memory = 0x1FFFF000);
12+
13+
SECTIONS
14+
{
15+
/* ISR Vectors */
16+
.isr_vector :
17+
{
18+
. = ALIGN(4);
19+
_svect = .;
20+
21+
KEEP(*(.isr_vector))
22+
23+
. = ALIGN(4);
24+
_evect = .;
25+
} > rom
26+
27+
/* Flash Code */
28+
.text :
29+
{
30+
. = ALIGN(4);
31+
_stext = .;
32+
33+
*(.text) /* .text sections (code) */
34+
*(.text*) /* .text* sections (code) */
35+
*(.rodata) /* .rodata sections (constants, strings, etc.) */
36+
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
37+
*(.glue_7) /* glue arm to thumb code */
38+
*(.glue_7t) /* glue thumb to arm code */
39+
40+
KEEP(*(.init))
41+
KEEP(*(.fini))
42+
43+
. = ALIGN(4);
44+
_etext = .;
45+
} > rom
46+
47+
/* ARM */
48+
.ARM.extab :
49+
{
50+
*(.ARM.extab* .gnu.linkonce.armextab.*)
51+
} > rom
52+
.ARM :
53+
{
54+
__exidx_start = .;
55+
56+
*(.ARM.exidx*)
57+
58+
__exidx_end = .;
59+
} > rom
60+
.ARM.attributes :
61+
{
62+
*(.ARM.attributes)
63+
} > rom
64+
65+
/* C Array init/fini */
66+
.preinit_array :
67+
{
68+
PROVIDE_HIDDEN(__preinit_array_start = .);
69+
KEEP(*(.preinit_array*))
70+
PROVIDE_HIDDEN(__preinit_array_end = .);
71+
} > rom
72+
.init_array :
73+
{
74+
PROVIDE_HIDDEN(__init_array_start = .);
75+
KEEP(*(SORT(.init_array.*)))
76+
KEEP(*(.init_array*))
77+
PROVIDE_HIDDEN(__init_array_end = .);
78+
} > rom
79+
.fini_array :
80+
{
81+
PROVIDE_HIDDEN(__fini_array_start = .);
82+
KEEP(*(.fini_array*))
83+
KEEP(*(SORT(.fini_array.*)))
84+
PROVIDE_HIDDEN(__fini_array_end = .);
85+
} > rom
86+
87+
/* RAM Data */
88+
_sidata = LOADADDR(.data);
89+
90+
.data :
91+
{
92+
. = ALIGN(4);
93+
_sdata = .; /* create a global symbol at data start */
94+
95+
*(.data) /* .data sections */
96+
*(.data*) /* .data* sections */
97+
98+
. = ALIGN(4);
99+
_edata = .; /* define a global symbol at data end */
100+
} > ram AT > rom
101+
102+
/* BSS */
103+
.bss :
104+
{
105+
. = ALIGN(4);
106+
_sbss = .; /* define a global symbol at bss start */
107+
__bss_start__ = _sbss;
108+
109+
*(.bss)
110+
*(.bss*)
111+
*(COMMON)
112+
113+
. = ALIGN(4);
114+
_ebss = .; /* define a global symbol at bss end */
115+
__bss_end__ = _ebss;
116+
} > ram
117+
118+
PROVIDE(end = _ebss);
119+
PROVIDE(_end = _ebss);
120+
121+
/* Ensure minimum stack & heap */
122+
.min_heap_stack :
123+
{
124+
. = ALIGN(4);
125+
126+
. = . + _min_heap_size;
127+
. = . + _min_stack_size;
128+
129+
. = ALIGN(4);
130+
} > ram
131+
132+
/* Remove unused code from libs */
133+
/DISCARD/ :
134+
{
135+
libc.a(*)
136+
libm.a(*)
137+
libgcc.a(*)
138+
libnosys.a(*)
139+
}
140+
}

config/linker/sam3u/sam3u1.ld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
MEMORY
2+
{
3+
rom (rx) : ORIGIN = 0x00080000, LENGTH = 0x00010000
4+
ram (rw) : ORIGIN = 0x20000000, LENGTH = 0x00004000
5+
}
6+
7+
INCLUDE sam3u/common.ld

config/linker/sam3u/sam3u2.ld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
MEMORY
2+
{
3+
rom (rx) : ORIGIN = 0x00080000, LENGTH = 0x00020000
4+
ram (rw) : ORIGIN = 0x20000000, LENGTH = 0x00008000
5+
}
6+
7+
INCLUDE sam3u/common.ld

config/linker/sam3u/sam3u4.ld

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
MEMORY
2+
{
3+
rom (rx) : ORIGIN = 0x00080000, LENGTH = 0x00040000
4+
ram (rw) : ORIGIN = 0x20000000, LENGTH = 0x0000C000
5+
}
6+
7+
INCLUDE sam3u/common.ld

0 commit comments

Comments
 (0)