2525/* Program Entry, set to mark it as "used" and avoid gc */
2626MEMORY
2727{
28- FLASH (rx) : ORIGIN = 0x00000000 , LENGTH = 0x00040000
29- SRAM ( rwx ) : ORIGIN = 0x20000000 , LENGTH = 0x00008000
28+ CODE (rx) : ORIGIN = 0x00000000 , LENGTH = 0x00040000
29+ DATA ( rw ) : ORIGIN = 0x10000000 , LENGTH = 0x00008000
3030}
31+ ENTRY (Reset_Handler)
32+ _system_stack_size = 0x200;
3133
3234SECTIONS
3335{
3436 .text :
3537 {
36- _text = .;
37- KEEP (*(.isr_vector ))
38- *(.text *)
38+ . = ALIGN (4 );
39+ KEEP (*(.isr_vector )) /* Startup code */
40+ . = ALIGN (4 );
41+ *(.text ) /* remaining code */
42+ *(.text .*) /* remaining code */
43+ *(.rodata ) /* read-only data (constants) */
3944 *(.rodata *)
40- _etext = .;
45+ *(.glue_7 )
46+ *(.glue_7t )
47+ *(.gnu .linkonce .t *)
4148
4249 /* section information for finsh shell */
4350 . = ALIGN (4 );
@@ -56,24 +63,108 @@ SECTIONS
5663 __rt_init_end = .;
5764 . = ALIGN (4 );
5865
59- } > FLASH
66+ PROVIDE (__ctors_start__ = .);
67+ /* old GCC version uses .ctors */
68+ KEEP (*(SORT (.ctors .*)))
69+ KEEP (*(.ctors ))
70+ /* new GCC version uses .init_array */
71+ KEEP (*(SORT (.init_array .*)))
72+ KEEP (*(.init_array ))
73+ PROVIDE (__ctors_end__ = .);
74+
75+ . = ALIGN (4 );
76+ _etext = .;
77+ } > CODE = 0
78+
79+ .ARM.extab :
80+ {
81+ *(.ARM .extab *)
82+
83+ . = ALIGN (4 );
84+ /* This is used by the startup in order to initialize the .data secion */
85+ _sidata = .;
86+ } > CODE
87+
88+ /* .data section which is used for initialized data */
89+ .data : AT (_sidata)
90+ {
91+ . = ALIGN (4 );
92+ PROVIDE (__dtors_start__ = .);
93+ KEEP (*(SORT (.dtors .*)))
94+ KEEP (*(.dtors ))
95+ PROVIDE (__dtors_end__ = .);
96+
97+ . = ALIGN (4 );
98+ /* This is used by the startup in order to initialize the .data secion */
99+ _sdata = . ;
100+
101+ *(.data )
102+ *(.data .*)
103+ *(.gnu .linkonce .d *)
104+
105+ . = ALIGN (4 );
106+ /* This is used by the startup in order to initialize the .data secion */
107+ _edata = . ;
108+ } > DATA
60109
61- .data : AT(ADDR(.text) + SIZEOF (. text ))
110+ .stack :
62111 {
63- _data = .;
64- *(vtable)
65- *(.data *)
66- _edata = .;
67- } > SRAM
112+ . = . + _system_stack_size;
113+ . = ALIGN (4 );
114+ _estack = .;
115+ } >DATA
68116
117+ __bss_start = .;
69118 .bss :
70119 {
71- _bss = .;
72- *(.bss *)
120+ . = ALIGN (4 );
121+ /* This is used by the startup in order to initialize the .bss secion */
122+ _sbss = .;
123+
124+ *(.bss )
125+ *(.bss .*)
73126 *(COMMON)
74- _ebss = .;
75- } > SRAM
76127
128+ . = ALIGN (4 );
129+ /* This is used by the startup in order to initialize the .bss secion */
130+ _ebss = . ;
131+ *(.bss .init )
132+ } > DATA
77133 __bss_end = .;
78134
135+ _end = .;
136+
137+ /* Stabs debugging sections. */
138+ .stab 0 : { *(.stab ) }
139+ .stabstr 0 : { *(.stabstr ) }
140+ .stab .excl 0 : { *(.stab .excl ) }
141+ .stab .exclstr 0 : { *(.stab .exclstr ) }
142+ .stab .index 0 : { *(.stab .index ) }
143+ .stab .indexstr 0 : { *(.stab .indexstr ) }
144+ .comment 0 : { *(.comment ) }
145+ /* DWARF debug sections.
146+ * Symbols in the DWARF debugging sections are relative to the beginning
147+ * of the section so we begin them at 0. */
148+ /* DWARF 1 */
149+ .debug 0 : { *(.debug ) }
150+ .line 0 : { *(.line ) }
151+ /* GNU DWARF 1 extensions */
152+ .debug_srcinfo 0 : { *(.debug_srcinfo ) }
153+ .debug_sfnames 0 : { *(.debug_sfnames ) }
154+ /* DWARF 1.1 and DWARF 2 */
155+ .debug_aranges 0 : { *(.debug_aranges ) }
156+ .debug_pubnames 0 : { *(.debug_pubnames ) }
157+ /* DWARF 2 */
158+ .debug_info 0 : { *(.debug_info .gnu .linkonce .wi .*) }
159+ .debug_abbrev 0 : { *(.debug_abbrev ) }
160+ .debug_line 0 : { *(.debug_line ) }
161+ .debug_frame 0 : { *(.debug_frame ) }
162+ .debug_str 0 : { *(.debug_str ) }
163+ .debug_loc 0 : { *(.debug_loc ) }
164+ .debug_macinfo 0 : { *(.debug_macinfo ) }
165+ /* SGI/MIPS DWARF 2 extensions */
166+ .debug_weaknames 0 : { *(.debug_weaknames ) }
167+ .debug_funcnames 0 : { *(.debug_funcnames ) }
168+ .debug_typenames 0 : { *(.debug_typenames ) }
169+ .debug_varnames 0 : { *(.debug_varnames ) }
79170}
0 commit comments