-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathloader_mpu.ld
More file actions
181 lines (148 loc) · 4.97 KB
/
Copy pathloader_mpu.ld
File metadata and controls
181 lines (148 loc) · 4.97 KB
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
MEMORY
{
/* Define each memory region */
FLASH (rx) : ORIGIN = 64k, LENGTH = 448k
/* 32k (Heap starts here) */
SRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 0x8000
/* 32k (Globals at bottom, stack on top), heap continues from here */
SRAM_AHB (rwx) : ORIGIN = 0x2007c000, LENGTH = 0x8000
/* Heap starts at SRAM because if heap starts from higher memory, then
* malloc tracking routines get confused when sbrk() system function
* returns higher heap memory first, and then lower heap memory.
* So we start heap from SRAM, and then move it up to SRAM_AHB if SRAM
* portion runs out completely.
*/
}
/* Entry point of the program */
ENTRY(isr_reset)
/* Linker must put FreeRTOS data and functions at the beginning of RAM/ROM */
_Privileged_Functions_Region_Size = 16K;
_Privileged_Data_Region_Size = 256;
/* Symbols for the FreeRTOS FLASH MPU initialization */
__FLASH_segment_start__ = ORIGIN( FLASH );
__FLASH_segment_end__ = __FLASH_segment_start__ + LENGTH( FLASH );
__privileged_functions_start__ = ORIGIN( FLASH );
__privileged_functions_end__ = __privileged_functions_start__ + _Privileged_Functions_Region_Size;
/* Symbols for the FreeRTOS RAM MPU initialization */
__SRAM_segment_start__ = ORIGIN( SRAM_AHB );
__SRAM_segment_end__ = __SRAM_segment_start__ + LENGTH( SRAM_AHB );
__privileged_data_start__ = ORIGIN( SRAM_AHB );
__privileged_data_end__ = ORIGIN( SRAM_AHB ) + _Privileged_Data_Region_Size;
SECTIONS
{
/* Privileged section at the start of the flash - vectors must be first */
.privileged_functions : ALIGN(4)
{
FILL(0xff)
KEEP(*(.isr_vector))
*(privileged_functions)
} > FLASH
/* MAIN TEXT SECTION */
.text : ALIGN(4)
{
/* Pad the flash memory up until the end of the priveleged region end */
. = ORIGIN(FLASH) + _Privileged_Functions_Region_Size;
/* Global Section Table */
. = ALIGN(4) ;
__section_table_start = .;
__data_section_table = .;
LONG(LOADADDR(.data));
LONG( ADDR(.data)) ;
LONG( SIZEOF(.data));
__data_section_table_end = .;
__bss_section_table = .;
LONG( ADDR(.bss));
LONG( SIZEOF(.bss));
__bss_section_table_end = .;
__section_table_end = . ;
/* End of Global Section Table */
/* Functions that are placed after the interrupt vector */
*(.after_vectors*)
*(.text*)
*(.rodata .rodata.*)
. = ALIGN(4);
/* C++ constructors etc */
. = ALIGN(4);
KEEP(*(.init))
. = ALIGN(4);
__preinit_array_start = .;
KEEP (*(.preinit_array))
__preinit_array_end = .;
. = ALIGN(4);
__init_array_start = .;
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array))
__init_array_end = .;
KEEP(*(.fini));
. = ALIGN(0x4);
KEEP (*crtbegin.o(.ctors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
KEEP (*(SORT(.ctors.*)))
KEEP (*crtend.o(.ctors))
. = ALIGN(0x4);
KEEP (*crtbegin.o(.dtors))
KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
KEEP (*(SORT(.dtors.*)))
KEEP (*crtend.o(.dtors))
/* End C++ */
} > FLASH
/*
* for exception handling/unwind - some Newlib functions (in common
* with C++ and STDC++) use this.
*/
.ARM.extab : ALIGN(4)
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > FLASH
__exidx_start = .;
.ARM.exidx : ALIGN(4)
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > FLASH
__exidx_end = .;
/*
.debug : ALIGN(4)
{
*(.debug* *debug.*)
} > FLASH
.stabs : ALIGN(4)
{
*(.stabs* *stabs.*)
} > FLASH
*/
/* TODO: What is this for? */
_etext = .;
/* MAIN DATA SECTION */
.uninit_RESERVED : ALIGN(4)
{
KEEP(*(.bss.$RESERVED*))
} > SRAM_AHB
.data : ALIGN(4)
{
/* Place the FreeRTOS privileged data at the beginning of the RAM */
*(privileged_data)
. = ORIGIN( SRAM_AHB ) + _Privileged_Data_Region_Size;
FILL(0xff)
_data = .;
*(vtable)
*(.data*)
. = ALIGN(4) ;
_edata = .;
} > SRAM_AHB AT>FLASH
/* MAIN BSS SECTION */
.bss : ALIGN(4)
{
_bss = .;
*(.bss*)
*(COMMON)
. = ALIGN(4) ;
_ebss = .;
PROVIDE(end = .);
} > SRAM_AHB
/* Provide a symbol of the heap pointer to C/C++ code */
PROVIDE(_pvHeapStart = .);
/* Provide the start of the initial stack pointer
* Debugger and ISP may use 32-bytes of space?
*/
PROVIDE(_vStackTop = ORIGIN(SRAM_AHB) + LENGTH(SRAM_AHB) - 32);
}