annotate f103c8/STM32F103C8_FLASH.ld @ 2:0c59e7a7782a

Working on GPIO and RCC
author cin
date Mon, 16 Jan 2017 11:04:47 +0300
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
1 /*
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
2 *****************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
3 **
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
4
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
5 ** File : stm32_flash.ld
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
6 **
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
7 ** Abstract : Linker script for STM32F103C8 Device with
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
8 ** 64KByte FLASH, 20KByte RAM
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
9 **
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
10 ** Set heap size, stack size and stack location according
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
11 ** to application requirements.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
12 **
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
13 ** Set memory bank area and size if external memory is used.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
14 **
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
15 ** Target : STMicroelectronics STM32
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
16 **
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
17 ** Environment : Atollic TrueSTUDIO(R)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
18 **
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
19 ** Distribution: The file is distributed as is, without any warranty
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
20 ** of any kind.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
21 **
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
22 ** (c)Copyright Atollic AB.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
23 ** You may use this file as-is or modify it according to the needs of your
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
24 ** project. This file may only be built (assembled or compiled and linked)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
25 ** using the Atollic TrueSTUDIO(R) product. The use of this file together
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
26 ** with other tools than Atollic TrueSTUDIO(R) is not permitted.
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
27 **
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
28 *****************************************************************************
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
29 */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
30
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
31 /* Entry Point */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
32 ENTRY(Reset_Handler)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
33
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
34 /* Highest address of the user mode stack */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
35 _estack = 0x20005000; /* end of RAM */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
36 /* Generate a link error if heap and stack don't fit into RAM */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
37 _Min_Heap_Size = 0x200; /* required amount of heap */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
38 _Min_Stack_Size = 0x400; /* required amount of stack */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
39
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
40 /* Specify the memory areas */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
41 MEMORY
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
42 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
43 RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
44 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
45 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
46
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
47 /* Define output sections */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
48 SECTIONS
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
49 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
50 /* The startup code goes first into FLASH */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
51 .isr_vector :
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
52 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
53 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
54 KEEP(*(.isr_vector)) /* Startup code */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
55 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
56 } >FLASH
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
57
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
58 /* The program code and other data goes into FLASH */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
59 .text :
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
60 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
61 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
62 *(.text) /* .text sections (code) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
63 *(.text*) /* .text* sections (code) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
64 *(.glue_7) /* glue arm to thumb code */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
65 *(.glue_7t) /* glue thumb to arm code */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
66 *(.eh_frame)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
67
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
68 KEEP (*(.init))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
69 KEEP (*(.fini))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
70
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
71 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
72 _etext = .; /* define a global symbols at end of code */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
73 } >FLASH
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
74
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
75 /* Constant data goes into FLASH */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
76 .rodata :
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
77 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
78 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
79 *(.rodata) /* .rodata sections (constants, strings, etc.) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
80 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
81 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
82 } >FLASH
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
83
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
84 .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
85 .ARM : {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
86 __exidx_start = .;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
87 *(.ARM.exidx*)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
88 __exidx_end = .;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
89 } >FLASH
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
90
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
91 .preinit_array :
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
92 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
93 PROVIDE_HIDDEN (__preinit_array_start = .);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
94 KEEP (*(.preinit_array*))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
95 PROVIDE_HIDDEN (__preinit_array_end = .);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
96 } >FLASH
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
97 .init_array :
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
98 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
99 PROVIDE_HIDDEN (__init_array_start = .);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
100 KEEP (*(SORT(.init_array.*)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
101 KEEP (*(.init_array*))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
102 PROVIDE_HIDDEN (__init_array_end = .);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
103 } >FLASH
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
104 .fini_array :
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
105 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
106 PROVIDE_HIDDEN (__fini_array_start = .);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
107 KEEP (*(SORT(.fini_array.*)))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
108 KEEP (*(.fini_array*))
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
109 PROVIDE_HIDDEN (__fini_array_end = .);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
110 } >FLASH
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
111
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
112 /* used by the startup to initialize data */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
113 _sidata = LOADADDR(.data);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
114
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
115 /* Initialized data sections goes into RAM, load LMA copy after code */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
116 .data :
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
117 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
118 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
119 _sdata = .; /* create a global symbol at data start */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
120 *(.data) /* .data sections */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
121 *(.data*) /* .data* sections */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
122
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
123 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
124 _edata = .; /* define a global symbol at data end */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
125 } >RAM AT> FLASH
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
126
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
127
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
128 /* Uninitialized data section */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
129 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
130 .bss :
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
131 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
132 /* This is used by the startup in order to initialize the .bss secion */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
133 _sbss = .; /* define a global symbol at bss start */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
134 __bss_start__ = _sbss;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
135 *(.bss)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
136 *(.bss*)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
137 *(COMMON)
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
138
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
139 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
140 _ebss = .; /* define a global symbol at bss end */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
141 __bss_end__ = _ebss;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
142 } >RAM
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
143
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
144 /* User_heap_stack section, used to check that there is enough RAM left */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
145 ._user_heap_stack :
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
146 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
147 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
148 PROVIDE ( end = . );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
149 PROVIDE ( _end = . );
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
150 . = . + _Min_Heap_Size;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
151 . = . + _Min_Stack_Size;
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
152 . = ALIGN(4);
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
153 } >RAM
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
154
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
155
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
156
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
157 /* Remove information from the standard libraries */
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
158 /DISCARD/ :
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
159 {
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
160 libc.a ( * )
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
161 libm.a ( * )
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
162 libgcc.a ( * )
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
163 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
164
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
165 .ARM.attributes 0 : { *(.ARM.attributes) }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
166 }
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
167
0c59e7a7782a Working on GPIO and RCC
cin
parents:
diff changeset
168