-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathlayout.ld
118 lines (104 loc) · 2.86 KB
/
layout.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
/* Userland Generic Layout
*
* This linker script is designed for Tock apps where the end microcontroller
* is not known. Therefore, this script over provisions space on some platforms.
*/
/* Memory Spaces Definitions, 448K flash, 64K ram */
PROG_LENGTH = 0x00040000;
RAM_LENGTH = 0x00010000;
ENTRY(_start)
/* Note: Because apps are relocated, the FLASH address here acts as a sentinel
* value for relocation fixup routines. The application loader will select the
* actual location in flash where the app is placed.
*/
MEMORY {
FLASH (rx) : ORIGIN = 0x00030038, LENGTH = PROG_LENGTH
SRAM (RWX) : ORIGIN = 0x00000000, LENGTH = RAM_LENGTH
}
SECTIONS {
/* Text section, Code! */
.text :
{
_text = .;
KEEP (*(.text._start))
*(.text*)
*(.rodata*)
/* C++ exception unwinding information */
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > FLASH =0xFF
/* ARM Exception support
*
* This contains compiler-generated support for unwinding the stack,
* consisting of key-value pairs of function addresses and information on
* how to unwind stack frames.
* https://wiki.linaro.org/KenWerner/Sandbox/libunwind?action=AttachFile&do=get&target=libunwind-LDS.pdf
*
* .ARM.exidx is sorted, so has to go in its own output section.
*/
PROVIDE_HIDDEN (__exidx_start = .);
.ARM.exidx :
{
/* (C++) Index entries for section unwinding */
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > FLASH
PROVIDE_HIDDEN (__exidx_end = .);
/* Beginning of SRAM */
_sram_start = .;
/* Global Offset Table */
.got :
{
_got = .;
*(.got*)
_egot = .;
_plt = .;
*(.got.plt*)
_eplt = .;
} > SRAM AT > FLASH
/* Data section, static initialized variables
* Note: This is placed in Flash after the text section, but needs to be
* moved to SRAM at runtime
*/
.data :
{
_data = .;
KEEP(*(.data*))
_edata = .;
} > SRAM AT > FLASH
/* BSS section, static uninitialized variables */
.bss :
{
_bss = .;
KEEP(*(.bss*))
*(COMMON)
_ebss = .;
} > SRAM
/*
* __NOTE__: The following symbols are used only to pass information
* through the elf -> tbf -> Tock kernel.
*
* The kernel will place the stack at the beginning of the SRAM section so
* that stack overflows run off the end of the memory segment and trigger an
* MPU violation instead of overwriting data/got/bss information. This means
* the actual location of symbols in those sections in memory will be offset
* by STACK_SIZE.
*/
.stack :
{
_stack = .;
. += 1024;
_estack = .;
} > SRAM
.app_heap :
{
_app_heap = .;
. += 1024;
_eapp_heap = .;
} > SRAM
.kernel_heap :
{
_kernel_heap = .;
. += 1024;
_ekernel_heap = .;
} > SRAM
_sram_end = .;
}