-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmaster.ld
115 lines (86 loc) · 2.4 KB
/
master.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
/* Author, Copyright: Oleg Borodin <onborodin@gmail.com> 2018 */
MEMORY {
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
SRAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
}
/* Enforce emmition of the vector table. */
EXTERN(vector_table)
/* Define the entry point of the output file. */
ENTRY(main)
SECTIONS {
.text : {
KEEP(*(.vectors)) /* Vector table */
*(.text*) /* Program code */
. = ALIGN(4);
*(.rodata*) /* Read-only data */
. = ALIGN(4);
} >FLASH
/* C++ Static constructors/destructors, also used for __attribute__
* ((constructor)) and the likes */
.preinit_array : {
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
} >FLASH
.init_array : {
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
} >FLASH
.fini_array : {
. = ALIGN(4);
__fini_array_start = .;
KEEP (*(.fini_array))
KEEP (*(SORT(.fini_array.*)))
__fini_array_end = .;
} >FLASH
/*
* Another section used by C++ stuff, appears when using newlib with
* 64bit (long long) printf support
*/
.ARM.extab : {
*(.ARM.extab*)
} >FLASH
.ARM.exidx : {
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
} >FLASH
. = ALIGN(4);
__text_end = .;
.data : {
__data_start = .;
_sdata = .;
_data = .;
*(.data*) /* Read-write initialized data */
. = ALIGN(4);
__data_end = . ;
_edata = . ;
} >SRAM AT >FLASH
_data_loadaddr = LOADADDR(.data);
.bss : {
__bss_start = .;
__bss_start__ = .;
*(.bss*) /* Read-write zero initialized data */
*(COMMON)
. = ALIGN(4);
__bss_end = .;
__bss_end__ = .;
_ebss = .;
} >SRAM
/*
* The .eh_frame section appears to be used for C++ exception handling.
* You may need to fix this if you're using C++.
*/
/* /DISCARD/ : { *(.eh_frame) } */
. = ALIGN(4);
__end = .;
_heap = .;
}
PROVIDE(__rtos_heap_size = LENGTH(SRAM) - 2048);
PROVIDE(_eheap = ORIGIN(SRAM) + LENGTH(SRAM));
PROVIDE(_stack = ORIGIN(SRAM) + LENGTH(SRAM));
/* EOF */