]> rtime.felk.cvut.cz Git - arc.git/blob - arch/arm/arm_cm3/scripts/linkscript_gcc.ldf
Initial ARM port
[arc.git] / arch / arm / arm_cm3 / scripts / linkscript_gcc.ldf
1 /*\r
2 Default linker script for STM32F10x_512K_64K\r
3 Copyright RAISONANCE S.A.S. 2008\r
4 */\r
5 \r
6 /* include the common STM32F10x sub-script */\r
7 \r
8 /* Common part of the linker scripts for STM32 devices*/\r
9 \r
10 \r
11 /* default stack sizes. \r
12 \r
13 These are used by the startup in order to allocate stacks for the different modes.\r
14 */\r
15 \r
16 __Stack_Size = 1024 ;\r
17 \r
18 PROVIDE ( _Stack_Size = __Stack_Size ) ;\r
19 \r
20 __Stack_Init = _estack  - __Stack_Size ;\r
21 \r
22 /*"PROVIDE" allows to easily override these values from an object file or the commmand line.*/\r
23 PROVIDE ( _Stack_Init = __Stack_Init ) ;\r
24 \r
25 /*\r
26 There will be a link error if there is not this amount of RAM free at the end.\r
27 */\r
28 _Minimum_Stack_Size = 0x100 ;\r
29 \r
30 \r
31 /* include the memory spaces definitions sub-script */\r
32 /*\r
33 Linker subscript for STM32F10x definitions with 512K Flash and 1024K RAM */\r
34 \r
35 ENTRY(Reset_Handler)\r
36 \r
37 /* Memory Spaces Definitions */\r
38 \r
39 MEMORY\r
40 {\r
41         /* ST32F103, 128K flash, 20K RAM */\r
42 \r
43   RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K\r
44   FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K\r
45   FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0\r
46   EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0\r
47   EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0\r
48   EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0\r
49   EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0\r
50 }\r
51 \r
52 /* higher address of the user mode stack */\r
53 _estack = 0x20005000;\r
54 \r
55 \r
56 /* include the sections management sub-script for FLASH mode */\r
57 \r
58 /* Sections Definitions */\r
59 \r
60 SECTIONS\r
61 {\r
62     /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */\r
63     .isr_vector :\r
64     {\r
65         . = ALIGN(4);\r
66         KEEP(*(.isr_vector))            /* Startup code */\r
67         . = ALIGN(4);\r
68     } >FLASH\r
69  \r
70     /* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */\r
71     .flashtext :\r
72     {\r
73         . = ALIGN(4);\r
74         *(.flashtext)            /* Startup code */\r
75         . = ALIGN(4);\r
76     } >FLASH\r
77  \r
78     \r
79     /* the program code is stored in the .text section, which goes to Flash */\r
80     .text :\r
81     {\r
82             . = ALIGN(4);\r
83             \r
84         *(.text)                   /* remaining code */\r
85         *(.text.*)                   /* remaining code */        \r
86         *(.rodata)                 /* read-only data (constants) */\r
87         *(.rodata*)\r
88         *(.glue_7)\r
89         *(.glue_7t)\r
90         \r
91             . = ALIGN(4);\r
92          _etext = .;\r
93             /* This is used by the startup in order to initialize the .data secion */\r
94 /*\r
95          _sidata = _etext;\r
96 */       \r
97     } >FLASH\r
98 \r
99     /* Special sucky exception section */\r
100     .ARM.exidx   : { \r
101         *(.ARM.exidx* .gnu.linkonce.armexidx.*)\r
102         _sidata = .; \r
103         } >FLASH\r
104     __exidx_start = .;\r
105 \r
106     /* This is the initialized data section\r
107     The program executes knowing that the data is in the RAM\r
108     but the loader puts the initial values in the FLASH (inidata).\r
109     It is one task of the startup to copy the initial values from FLASH to RAM. */\r
110     .data  : AT ( _sidata )\r
111     {\r
112             . = ALIGN(4);\r
113         /* This is used by the startup in order to initialize the .data secion */\r
114         _sdata = . ;\r
115         \r
116         *(.data)\r
117         *(.data.*)\r
118         *(.ARM.extab* .gnu.linkonce.armextab.*)        \r
119             . = ALIGN(4);\r
120             /* This is used by the startup in order to initialize the .data secion */\r
121          _edata = . ;\r
122     } >RAM\r
123     \r
124     \r
125 \r
126     /* This is the uninitialized data section */\r
127     .bss :\r
128     {\r
129             . = ALIGN(4);\r
130         /* This is used by the startup in order to initialize the .bss secion */\r
131         _sbss = .;\r
132         \r
133         *(.bss)\r
134         *(.t32_outport)\r
135         *(COMMON)\r
136         \r
137             . = ALIGN(4);\r
138             /* This is used by the startup in order to initialize the .bss secion */\r
139          _ebss = . ;\r
140     } >RAM\r
141     \r
142     PROVIDE ( end = _ebss );\r
143     PROVIDE ( _end = _ebss );\r
144     \r
145     /* This is the user stack section \r
146     This is just to check that there is enough RAM left for the User mode stack\r
147     It should generate an error if it's full.\r
148      */\r
149     ._usrstack :\r
150     {\r
151             . = ALIGN(4);\r
152         _susrstack = . ;\r
153         \r
154         . = . + _Minimum_Stack_Size ;\r
155         \r
156             . = ALIGN(4);\r
157         _eusrstack = . ;\r
158     } >RAM\r
159     \r
160 \r
161    \r
162     /* this is the FLASH Bank1 */\r
163     /* the C or assembly source must explicitly place the code or data there\r
164     using the "section" attribute */\r
165     .b1text :\r
166     {\r
167         *(.b1text)                   /* remaining code */\r
168         *(.b1rodata)                 /* read-only data (constants) */\r
169         *(.b1rodata*)\r
170     } >FLASHB1\r
171     \r
172     /* this is the EXTMEM */\r
173     /* the C or assembly source must explicitly place the code or data there\r
174     using the "section" attribute */\r
175     \r
176     /* EXTMEM Bank0 */\r
177     .eb0text :\r
178     {\r
179         *(.eb0text)                   /* remaining code */\r
180         *(.eb0rodata)                 /* read-only data (constants) */\r
181         *(.eb0rodata*)\r
182     } >EXTMEMB0\r
183     \r
184     /* EXTMEM Bank1 */\r
185     .eb1text :\r
186     {\r
187         *(.eb1text)                   /* remaining code */\r
188         *(.eb1rodata)                 /* read-only data (constants) */\r
189         *(.eb1rodata*)\r
190     } >EXTMEMB1\r
191     \r
192     /* EXTMEM Bank2 */\r
193     .eb2text :\r
194     {\r
195         *(.eb2text)                   /* remaining code */\r
196         *(.eb2rodata)                 /* read-only data (constants) */\r
197         *(.eb2rodata*)\r
198     } >EXTMEMB2\r
199     \r
200     /* EXTMEM Bank0 */\r
201     .eb3text :\r
202     {\r
203         *(.eb3text)                   /* remaining code */\r
204         *(.eb3rodata)                 /* read-only data (constants) */\r
205         *(.eb3rodata*)\r
206     } >EXTMEMB3\r
207     \r
208     \r
209     \r
210     /* after that it's only debugging information. */\r
211     \r
212     /* remove the debugging information from the standard libraries */\r
213 \r
214     /DISCARD/ :\r
215     {\r
216      libc.a ( * )\r
217      libm.a ( * )\r
218      libgcc.a ( * )\r
219      }\r
220      \r
221     /* Stabs debugging sections.  */\r
222     .stab          0 : { *(.stab) }\r
223     .stabstr       0 : { *(.stabstr) }\r
224     .stab.excl     0 : { *(.stab.excl) }\r
225     .stab.exclstr  0 : { *(.stab.exclstr) }\r
226     .stab.index    0 : { *(.stab.index) }\r
227     .stab.indexstr 0 : { *(.stab.indexstr) }\r
228     .comment       0 : { *(.comment) }\r
229     /* DWARF debug sections.\r
230        Symbols in the DWARF debugging sections are relative to the beginning\r
231        of the section so we begin them at 0.  */\r
232     /* DWARF 1 */\r
233     .debug          0 : { *(.debug) }\r
234     .line           0 : { *(.line) }\r
235     /* GNU DWARF 1 extensions */\r
236     .debug_srcinfo  0 : { *(.debug_srcinfo) }\r
237     .debug_sfnames  0 : { *(.debug_sfnames) }\r
238     /* DWARF 1.1 and DWARF 2 */\r
239     .debug_aranges  0 : { *(.debug_aranges) }\r
240     .debug_pubnames 0 : { *(.debug_pubnames) }\r
241     /* DWARF 2 */\r
242     .debug_info     0 : { *(.debug_info .gnu.linkonce.wi.*) }\r
243     .debug_abbrev   0 : { *(.debug_abbrev) }\r
244     .debug_line     0 : { *(.debug_line) }\r
245     .debug_frame    0 : { *(.debug_frame) }\r
246     .debug_str      0 : { *(.debug_str) }\r
247     .debug_loc      0 : { *(.debug_loc) }\r
248     .debug_macinfo  0 : { *(.debug_macinfo) }\r
249     /* SGI/MIPS DWARF 2 extensions */\r
250     .debug_weaknames 0 : { *(.debug_weaknames) }\r
251     .debug_funcnames 0 : { *(.debug_funcnames) }\r
252     .debug_typenames 0 : { *(.debug_typenames) }\r
253     .debug_varnames  0 : { *(.debug_varnames) }\r
254 }\r