-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinker_script_common.ld
146 lines (122 loc) · 2.95 KB
/
linker_script_common.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
/*!****************************************************************************
* @file
* linker_script_common.ld
*
* @brief
* Common section layout definitions across all controller types
*
* @date 18.08.2023
******************************************************************************/
/* Entry Point assignment */
ENTRY(_start)
/* Sections definition */
SECTIONS
{
/* Interrupt Vector Table at start of app memory */
.isr_vector :
{
. = ALIGN(4);
KEEP( *(.isr_vector))
KEEP( *(.isr_vector*))
. = ALIGN(64);
} >FLASH
/* Code and read-only constants in FLASH memory */
.text :
{
. = ALIGN(4);
*(.text)
*(.text*)
*(.glue_7)
*(.glue_7t)
*(.eh_frame)
KEEP (*(.init))
KEEP (*(.fini))
. = ALIGN(4);
*(.rodata)
*(.rodata*)
. = ALIGN(4);
} >FLASH
/* LibC init, constructors and destructors */
.preinit_array :
{
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
} >FLASH
.init_array :
{
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
} >FLASH
.fini_array :
{
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
} >FLASH
/* Stack unwinding information */
.ARM.extab :
{
KEEP(*(.ARM.extab*))
KEEP(*(.gnu.linkonce.armextab.*))
} >FLASH
.ARM :
{
__exidx_start = .;
KEEP(*(.ARM.exidx*))
__exidx_end = .;
} >FLASH
/* Initialised data section */
.data :
{
. = ALIGN(4);
_sdata = .;
*(.data)
*(.data*)
_edata = .;
} >RAM AT>FLASH
/* Initialisation data location in FLASH */
_sidata = LOADADDR(.data);
/* Zero-initialised data section */
.bss (NOLOAD) :
{
. = ALIGN(4);
_sbss = .;
*(.bss)
*(.bss*)
*(COMMON*)
. = ALIGN(4);
_ebss = .;
PROVIDE( end = . );
} >RAM
/* Stack/Heap collision detection */
.heap (NOLOAD) :
{
. = ALIGN(4);
_sheap = .;
/* Calculate available heap size */
__avail_heap_size = LENGTH(RAM) - __stack_size - (_sheap - ORIGIN(RAM));
. = . + MAX(__min_heap_size, __avail_heap_size);
. = ALIGN(4);
_eheap = .;
} >RAM
/* Stack at the end of RAM */
.stack (NOLOAD) :
{
. = ALIGN(4);
_sstack = .;
. = . + __stack_size;
_estack = .;
} >RAM
/* Remove standard libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}
.ARM.attributes 0 : { *(.ARM.attributes) }
}