-
Notifications
You must be signed in to change notification settings - Fork 31
/
link.ld
147 lines (123 loc) · 3.74 KB
/
link.ld
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
PHDRS
{
flash0 PT_LOAD ;
data PT_LOAD ;
flash2 PT_LOAD ;
sram PT_LOAD ;
headers PT_PHDR PHDRS ;
}
SECTIONS
{
/* Code, read only, no relocations needed. */
.text :
{
_text = .;
/* Here begins flash. This symbol is used by the ideompotent `pic`
function as the lower bound of addressed to relocate. */
_nvram_start = .;
*(.boot*)
*(.text*)
/* .rodata is moved out so we can update it */
. = ALIGN(PAGE_SIZE);
_etext = .;
} > FLASH :flash0
/* Relocations, read only, no relocations aginst the relocations themselves
needed! */
_reloc_size = SIZEOF(.rel.rodata) + SIZEOF(.rel.data) + SIZEOF(.rel.nvm_data);
.rel_flash : ALIGN(PAGE_SIZE)
{
_relocs = .;
. += _reloc_size;
. = ALIGN(PAGE_SIZE);
_erelocs = .;
. = ALIGN(PAGE_SIZE);
/* After this section we have mutable flash. Must be a multiple of PAGE_SIZE from _nvram_start. */
_nvram_data = .;
} > FLASH :flash0
/* Immutable globals, read only during app running proper, but
relocations are needed. (So not read-only completely.) */
.rodata : ALIGN(PAGE_SIZE)
{
/* Moved here from .text so we can permantly apply relocations to it with
nvm_write() */
. = ALIGN(PAGE_SIZE);
_rodata = .;
_rodata_src = .;
*(.rodata*)
. = ALIGN(PAGE_SIZE);
_erodata = .;
} > FLASH :flash0
_rodata_len = _erodata - _rodata;
/* Mutable Globals, writable, relocations are needed. */
.data : ALIGN(4)
{
_data = .;
*(vtable)
*(.data*)
. = ALIGN(PAGE_SIZE);
_edata = .;
} > SRAM AT> FLASH :data =0xa4a4
_data_len = SIZEOF(.data);
ASSERT( (_edata - _data) <= 0, ".data section must be empty" )
/* Persistent data, read and written during app running proper,
relocations are also needed. */
.nvm_data : ALIGN(PAGE_SIZE)
{
_nvm_data_start = .;
*(.nvm_data*)
/* Store _nvram value during link_pass and use this to detect movement of
_nvram as compared to the previous app execution, and redo the relocations
if necessary */
. = ALIGN(4);
_nvram_prev_run = .;
LONG(ABSOLUTE(_nvram_start))
. = ALIGN(PAGE_SIZE);
/* After this section we no longer have Flash memory at all. */
/* This symbol is used by the mutable portion of flash calculations. */
_envram_data = .;
_install_parameters = .;
/* This symbol is used by the ideompotent `pic` function as the upper
bound of addressed to relocate. */
_nvram_end = .;
} > FLASH :flash2
_sidata_src = LOADADDR(.data);
.bss :
{
_bss = .;
*(.bss*)
_ebss = .;
_bss_len = ABSOLUTE(_ebss) - ABSOLUTE(_bss);
. = ALIGN(4);
app_stack_canary = .;
. += 4;
_stack_validation = .;
. = _stack_validation + STACK_SIZE;
_stack = ABSOLUTE(END_STACK) - STACK_SIZE;
_estack = ABSOLUTE(END_STACK);
} > SRAM :sram
.stack_sizes (INFO):
{
KEEP(*(.stack_sizes));
}
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
*(.debug_info)
}
ledger.target (INFO): { KEEP(*(ledger.target)) }
ledger.target_id (INFO): { KEEP(*(ledger.target_id)) }
ledger.target_name (INFO): { KEEP(*(ledger.target_name)) }
ledger.app_name (INFO): { KEEP(*(ledger.app_name)) }
ledger.app_version (INFO): { KEEP(*(ledger.app_version)) }
ledger.api_level (INFO): { KEEP(*(ledger.api_level)) }
ledger.sdk_version (INFO): { KEEP(*(ledger.sdk_version)) }
ledger.rust_sdk_version (INFO): { KEEP(*(ledger.rust_sdk_version)) }
ledger.rust_sdk_name (INFO): { KEEP(*(ledger.rust_sdk_name)) }
ledger.sdk_name (INFO): { KEEP(*(ledger.sdk_name)) }
ledger.sdk_hash (INFO): { KEEP(*(ledger.sdk_hash)) }
}
PROVIDE(_nvram = ABSOLUTE(_nvram_start));
PROVIDE(_envram = ABSOLUTE(_nvram_end));