CMSIS2000  0.0.7
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
gcc_arm_generic_flash.ld
Go to the documentation of this file.
1 /*
2 Common part of the linker scripts for STM32 devices
3 Copyright RAISONANCE S.A.S. 2008
4 
5 Modifed by Dimirtos
6 */
7 
8 /* include the common STM32F10x sub-script */
10 /* Sections Definitions */
11 SECTIONS
12 {
13  /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */
14  .isr_vector :
15  {
16  . = ALIGN(4);
17  KEEP(*(.isr_vector)) /* Startup code */
18  . = ALIGN(4);
19  } >FLASH
20 
21  /* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */
22  .flashtext :
23  {
24  . = ALIGN(4);
25  *(.flashtext) /* Startup code */
26  . = ALIGN(4);
27  } >FLASH
28 
29 
30  /* the program code is stored in the .text section, which goes to Flash */
31  .text :
32  {
33  . = ALIGN(4);
34 
35  *(.text) /* remaining code */
36  *(.text.*) /* remaining code */
37  *(.rodata) /* read-only data (constants) */
38  *(.rodata*)
39  *(.glue_7)
40  *(.glue_7t)
41 
42  . = ALIGN(4);
43  _etext = .;
44  /* This is used by the startup in order to initialize the .data secion */
45  _sidata = _etext;
46  } >FLASH
47 
48 
49 
50  /* This is the initialized data section
51  The program executes knowing that the data is in the RAM
52  but the loader puts the initial values in the FLASH (inidata).
53  It is one task of the startup to copy the initial values from FLASH to RAM. */
54  .data : AT ( _sidata )
55  {
56  . = ALIGN(4);
57  /* This is used by the startup in order to initialize the .data secion */
58  _sdata = . ;
59 
60  *(.data)
61  *(.data.*)
62 
63  . = ALIGN(4);
64  /* This is used by the startup in order to initialize the .data secion */
65  _edata = . ;
66  } >RAM
67 
68 
69 
70  /* This is the uninitialized data section */
71  .bss :
72  {
73  . = ALIGN(4);
74  /* This is used by the startup in order to initialize the .bss secion */
75  _sbss = .;
76 
77  *(.bss)
78  *(.bss.*)
79  *(COMMON)
80 
81  . = ALIGN(4);
82  /* This is used by the startup in order to initialize the .bss secion */
83  _ebss = . ;
84  } >RAM
85 
86  PROVIDE ( end = _ebss );
87  PROVIDE ( _end = _ebss );
88 
89 
90  /* .stack_dummy section doesn't contains any symbols. It is only
91  * used for linker to calculate size of stack sections, and assign
92  * values to stack symbols later */
93  .stack_dummy :
94  {
95  *(.stack)
96  } > RAM
97 
98  /* Set stack top to end of RAM, and stack limit move down by
99  * size of stack_dummy section */
100  _estack = ORIGIN(RAM) + LENGTH(RAM);
101  _sstack = _estack - SIZEOF(.stack_dummy);
102  PROVIDE(__stack = _estack);
103 
104 
105  /* after that it's only debugging information. */
106 
107  /* remove the debugging information from the standard libraries */
108  DISCARD :
109  {
110  libc.a ( * )
111  libm.a ( * )
112  libgcc.a ( * )
113  }
114 
115  /* Stabs debugging sections. */
116  .stab 0 : { *(.stab) }
117  .stabstr 0 : { *(.stabstr) }
118  .stab.excl 0 : { *(.stab.excl) }
119  .stab.exclstr 0 : { *(.stab.exclstr) }
120  .stab.index 0 : { *(.stab.index) }
121  .stab.indexstr 0 : { *(.stab.indexstr) }
122  .comment 0 : { *(.comment) }
123  /* DWARF debug sections.
124  Symbols in the DWARF debugging sections are relative to the beginning
125  of the section so we begin them at 0. */
126  /* DWARF 1 */
127  .debug 0 : { *(.debug) }
128  .line 0 : { *(.line) }
129  /* GNU DWARF 1 extensions */
130  .debug_srcinfo 0 : { *(.debug_srcinfo) }
131  .debug_sfnames 0 : { *(.debug_sfnames) }
132  /* DWARF 1.1 and DWARF 2 */
133  .debug_aranges 0 : { *(.debug_aranges) }
134  .debug_pubnames 0 : { *(.debug_pubnames) }
135  /* DWARF 2 */
136  .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
137  .debug_abbrev 0 : { *(.debug_abbrev) }
138  .debug_line 0 : { *(.debug_line) }
139  .debug_frame 0 : { *(.debug_frame) }
140  .debug_str 0 : { *(.debug_str) }
141  .debug_loc 0 : { *(.debug_loc) }
142  .debug_macinfo 0 : { *(.debug_macinfo) }
143  /* SGI/MIPS DWARF 2 extensions */
144  .debug_weaknames 0 : { *(.debug_weaknames) }
145  .debug_funcnames 0 : { *(.debug_funcnames) }
146  .debug_typenames 0 : { *(.debug_typenames) }
147  .debug_varnames 0 : { *(.debug_varnames) }
148 }