forked from Cellivar/stellaris-enc28j60
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathLM4F.ld
152 lines (143 loc) · 5.6 KB
/
LM4F.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
148
149
150
151
152
/*
* Copyright (c) 2012, Mauro Scomparin
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Mauro Scomparin nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Mauro Scomparin ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL Mauro Scomparin BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* File: LM4F.ld.
* Author: Mauro Scomparin <http://scompoprojects.worpress.com>.
* Version: 1.0.0.
* Description: Linker description file for LM4FXXX microcontrollers.
*/
/*
* Memory definition:
* FLASH: start point 0x00, lenght 0x40000.
* SRAM: start point 0x20000000 length 0x8000.
* STACK: start point 0x20007FFF lenght 0x0.
*/
MEMORY
{
FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000
STACK (rwx) : ORIGIN = 0x20007FFF , LENGTH = 0x00000000
}
/*
* Sections definitions:
*
* .text - machine instructions.
* .data - initialized data defined in the program.
* .bss - un-initialized global and static variables (to be initialized to 0 before starting main).
* .stack - just contains the pointer to the stack end at the right place.
*/
SECTIONS
{
/* This section it's the code, containing the NVIC Vector table that must start at 0x0
* Look at the LM4F120H5QR datasheet for details. (Table 2-8. Exception Types)
*/
.text :
{
. = ALIGN(4);
_start_text = .; /* This is an index to the beginning of .text segment. */
PROVIDE(_text_start = _text_start);
. = ALIGN(4);
KEEP(*(.nvic_table)) /* I should keep the NVIC ISR Table because it's needed by the processor to start. */
*(.text.*) /* This contains the code after the ISR table. */
. = ALIGN(4);
*(.rodata.*) /* Read only data. */
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*); /* exception unwinding information */
. = ALIGN(4);
*(.gcc_except_table); /* information used fo
r stack unwinding during exception */
. = ALIGN(4);
*(.eh_frame_hdr); /* additional
information about .ex_frame section */
. = ALIGN(4);
*(.eh_frame); /* information used for stack unwinding during exception */
. = ALIGN(4);
KEEP(*(.init));
. = ALIGN(4);
__preinit_array_start = .;
KEEP(*(.preinit_array));
. = ALIGN(4);
__preinit_array_end = .;
__init_array_start = .;
KEEP(*(SORT(.init_array.*)));
. = ALIGN(4);
KEEP(*(.init_array));
. = ALIGN(4);
__init_array_end = .;
KEEP(*(.fini));
. = ALIGN(4);
__fini_array_start = .;
KEEP(*(.fini_array));
. = ALIGN(4);
KEEP(*(SORT(.fini_array.*)));
. = ALIGN(4);
__fini_array_end = .;
. = ALIGN(4);
_end_text = .; /* This is an index to the end of .text segment. */
PROVIDE(_text_end = _text_end);
}>FLASH
/*
* .data segment must be placed in RAM but it's originally stored in FLASH
* So I set the data segment in ram, but I specify the load address with the AT
* keyword to set that right after the .text section.
* (Look at the LD documentation. (Optional Section Attributes))
* Thanks https://github.com/utzig for the hints!
*/
.data :
{
. = ALIGN(4);
__data_init_start = LOADADDR (.data);
PROVIDE(__data_init_start = __data_init_start);
/*_start_data = .; /* An index to the beginning of .data segment. */
__data_start = .;
PROVIDE(__data_start = __data_start);
. = ALIGN(4);
*(.data.*) /* I should put there all my initialized data of my program. */
. = ALIGN(4);
*(vtable) /* vtable it's generated by stellarisware to store the NVIC table in ram*/
. = ALIGN(4);
__data_end = .; /* And another index to the end of .data segment. */
PROVIDE(__data_end = __data_end);
}>RAM AT >FLASH
/*
* .bss contains the unitialized variables and must be set as 0x0 during runtime.
* It should be loaded in RAM and particula care should be taken initializing them in the startup file.
*/
.bss :
{
_start_bss = .; /* This is an index to the beginning of .bss segment. */
*(.bss.*) /* The un-initialized data should go there. */
*(COMMON) /* All the other stuff should be put there */
_end_bss = .; /* End index for .bss segment */
}>RAM
/*
* .stack contains nothing, but I use it to set the first vector item (SP R13).
*/
.stack :
{
_stack_top = .; /* An index to the end of the stack */
}>STACK
}