Skip to content

Commit 8cb4161

Browse files
add application linker script
1 parent a55bab0 commit 8cb4161

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

src/linker_script_app.ld

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
MEMORY
2+
{
3+
prgm : ORIGIN = LOAD_ADDR, LENGTH = 0x400000
4+
bss : ORIGIN = BSSHEAP_LOW, LENGTH = BSSHEAP_HIGH - BSSHEAP_LOW
5+
}
6+
7+
SECTIONS
8+
{
9+
. = LOAD_ADDR;
10+
11+
.header :
12+
{
13+
KEEP (*(.header))
14+
KEEP (*(.header.icon))
15+
} >prgm
16+
17+
.init :
18+
{
19+
*(.init)
20+
} >prgm
21+
22+
.text :
23+
{
24+
*(.text.unlikely .text.*_unlikely .text.unlikely.*)
25+
*(.text.exit .text.exit.*)
26+
*(.text.startup .text.startup.*)
27+
*(.text.hot .text.hot.*)
28+
*(SORT(.text.sorted.*))
29+
*(.text .stub .text.* .gnu.linkonce.t.*)
30+
*(.gnu.warning)
31+
} >prgm
32+
33+
.rodata :
34+
{
35+
*(.rodata .rodata.* .gnu.linkonce.r.*)
36+
} >prgm
37+
38+
.init_array :
39+
{
40+
PROVIDE_HIDDEN (__init_array_start = .);
41+
KEEP (*(.preinit_array))
42+
KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*)))
43+
KEEP (*(.init_array))
44+
PROVIDE_HIDDEN (__init_array_end = .);
45+
} >prgm
46+
47+
.fini_array :
48+
{
49+
PROVIDE_HIDDEN (__fini_array_start = .);
50+
KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*)))
51+
KEEP (*(.fini_array))
52+
PROVIDE_HIDDEN (__fini_array_end = .);
53+
} >prgm
54+
55+
.data :
56+
{
57+
___data_vma = .;
58+
*(.data .data.* .gnu.linkonce.d.*)
59+
SORT(CONSTRUCTORS)
60+
*(.data1)
61+
___data_vma_end = .;
62+
} >bss AT>prgm
63+
___data_lma = LOADADDR(.data);
64+
___data_len = ___data_vma_end - ___data_vma;
65+
66+
.bss (NOLOAD) :
67+
{
68+
___bss_low = .;
69+
*(.dynbss)
70+
*(.bss .bss.* .gnu.linkonce.b.*)
71+
*(COMMON)
72+
___bss_high = .;
73+
} >bss
74+
___bss_len = ___bss_high - ___bss_low;
75+
76+
ASSERT(. <= BSSHEAP_HIGH, "Error: BSS exceed BSSHEAP_HIGH limit")
77+
78+
___heap_low = .;
79+
. = BSSHEAP_HIGH;
80+
___heap_high = .;
81+
82+
/DISCARD/ :
83+
{
84+
*(.runprgm.reloc)
85+
*(.comment)
86+
*(.note*)
87+
}
88+
}

0 commit comments

Comments
 (0)