1/*!
2 * @file       gcc_APM32F09xxB.ld
3 *
4 * @brief      Linker script for APM32F09xxB Device with
5 *             128KByte FLASH, 32KByte RAM
6 *
7 * @version    V1.0.0
8 *
9 * @date       2022-08-30
10 *
11 * @attention
12 *
13 *  Copyright (C) 2022 Geehy Semiconductor
14 *
15 *  You may not use this file except in compliance with the
16 *  GEEHY COPYRIGHT NOTICE (GEEHY SOFTWARE PACKAGE LICENSE).
17 *
18 *  The program is only for reference, which is distributed in the hope
19 *  that it will be useful and instructional for customers to develop
20 *  their software. Unless required by applicable law or agreed to in
21 *  writing, the program is distributed on an "AS IS" BASIS, WITHOUT
22 *  ANY WARRANTY OR CONDITIONS OF ANY KIND, either express or implied.
23 *  See the GEEHY SOFTWARE PACKAGE LICENSE for the governing permissions
24 *  and limitations under the License.
25 */
26
27/* Entry Point */
28ENTRY(Reset_Handler)
29
30/* Flash Configuration*/
31/* Flash Base Address */
32_rom_base = 0x8000000;
33/*Flash Size (in Bytes) */
34_rom_size = 0x0020000;
35
36/* Embedded RAM Configuration */
37/* RAM Base Address           */
38_ram_base = 0x20000000;
39/* RAM Size (in Bytes) */
40_ram_size = 0x00008000;
41
42/* Stack / Heap Configuration */
43_end_stack = 0x20008000;
44/* Heap Size (in Bytes) */
45_heap_size = 0x200;
46/* Stack Size (in Bytes) */
47_stack_size = 0x400;
48
49MEMORY
50{
51FLASH (rx)      : ORIGIN = _rom_base, LENGTH = _rom_size
52    RAM (xrw)       : ORIGIN = _ram_base, LENGTH = _ram_size
53}
54
55SECTIONS
56{
57  .apm32_isr_vector :
58  {
59    . = ALIGN(4);
60    KEEP(*(.apm32_isr_vector))
61    . = ALIGN(4);
62  } >FLASH
63
64  .text :
65  {
66    . = ALIGN(4);
67    *(.text)
68    *(.text*)
69    *(.glue_7)
70    *(.glue_7t)
71    *(.eh_frame)
72
73    KEEP (*(.init))
74    KEEP (*(.fini))
75
76    . = ALIGN(4);
77    _etext = .;
78  } >FLASH
79
80  .rodata :
81  {
82    . = ALIGN(4);
83    *(.rodata)
84    *(.rodata*)
85    . = ALIGN(4);
86  } >FLASH
87
88  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
89  .ARM : {
90    __exidx_start = .;
91    *(.ARM.exidx*)
92    __exidx_end = .;
93  } >FLASH
94
95  .preinit_array :
96  {
97    PROVIDE_HIDDEN (__preinit_array_start = .);
98    KEEP (*(.preinit_array*))
99    PROVIDE_HIDDEN (__preinit_array_end = .);
100  } >FLASH
101  .init_array :
102  {
103    PROVIDE_HIDDEN (__init_array_start = .);
104    KEEP (*(SORT(.init_array.*)))
105    KEEP (*(.init_array*))
106    PROVIDE_HIDDEN (__init_array_end = .);
107  } >FLASH
108  .fini_array :
109  {
110    PROVIDE_HIDDEN (__fini_array_start = .);
111    KEEP (*(SORT(.fini_array.*)))
112    KEEP (*(.fini_array*))
113    PROVIDE_HIDDEN (__fini_array_end = .);
114  } >FLASH
115
116  _start_address_init_data = LOADADDR(.data);
117
118  .data :
119  {
120    . = ALIGN(4);
121    _start_address_data = .;
122    *(.data)
123    *(.data*)
124
125    . = ALIGN(4);
126    _end_address_data = .;
127  } >RAM AT> FLASH
128
129  . = ALIGN(4);
130  .bss :
131  {
132
133    _start_address_bss = .;
134    __bss_start__ = _start_address_bss;
135    *(.bss)
136    *(.bss*)
137    *(COMMON)
138
139    . = ALIGN(4);
140    _end_address_bss = .;
141    __bss_end__ = _end_address_bss;
142  } >RAM
143
144  ._user_heap_stack :
145  {
146    . = ALIGN(8);
147    PROVIDE ( end = . );
148    PROVIDE ( _end = . );
149    . = . + _heap_size;
150    . = . + _stack_size;
151    . = ALIGN(8);
152  } >RAM
153
154  /DISCARD/ :
155  {
156    libc.a ( * )
157    libm.a ( * )
158    libgcc.a ( * )
159  }
160
161  .ARM.attributes 0 : { *(.ARM.attributes) }
162}
163