1#define __ASSEMBLY__
2#include <target_mem_config.h>
3
4MEMORY
5{
6#if (REGION_ICCM_SIZE != 0)
7	REGION_ICCM :		ORIGIN = REGION_ICCM_START,	LENGTH = REGION_ICCM_SIZE
8#endif
9#if (REGION_DCCM_SIZE !=0)
10	REGION_DCCM :		ORIGIN = REGION_DCCM_START,	LENGTH = REGION_DCCM_SIZE
11#endif
12#if (REGION_XCCM_SIZE != 0)
13	REGION_XCCM :		ORIGIN = REGION_XCCM_START,	LENGTH = REGION_XCCM_SIZE
14#endif
15#if (REGION_YCCM_SIZE != 0)
16	REGION_YCCM :		ORIGIN = REGION_YCCM_START,	LENGTH = REGION_YCCM_SIZE
17#endif
18#if (REGION_EXT_ROM_SIZE != 0)
19	REGION_EXT_ROM :	ORIGIN = REGION_EXT_ROM_START,	LENGTH = REGION_EXT_ROM_SIZE
20#endif
21#if (REGION_EXT_RAM_SIZE != 0)
22	REGION_EXT_RAM :	ORIGIN = REGION_EXT_RAM_START,	LENGTH = REGION_EXT_RAM_SIZE
23#endif
24}
25
26ENTRY(_start)
27
28SECTIONS
29{
30	.init :
31	{
32		. = . + IMAGE_HEAD_SIZE;
33		_f_init = .;
34		KEEP (*(.init_vector .init_vector.*))
35		KEEP (*(.init_bootstrap .init_bootstrap.*))
36		_e_init = .;
37	} > REGION_ROM
38
39	.vector : ALIGN(1024)
40	{
41		_f_vector = .;
42		*(.vector .vector.*)
43		_e_vector = .;
44	} > REGION_ROM
45
46#if (REGION_XCCM_SIZE != 0)
47	.x_ccm (NOLOAD) : ALIGN(8)
48	{
49		_f_x_ccm = .;
50		*(.x_ccm .x_cmm.*)
51		_e_x_ccm = .;
52	} > REGION_XCCM
53#endif
54
55#if (REGION_YCCM_SIZE != 0)
56	.y_ccm (NOLOAD) : ALIGN(8)
57	{
58		_f_y_ccm = .;
59		*(.y_ccm .y_ccm.*)
60		_e_y_ccm = .;
61	} > REGION_YCCM
62#endif
63	.text : ALIGN(4)
64	{
65		_f_text = .;
66		*(.text .text.* .gnu.linkonce.t.*)
67		_e_text = .;
68	} > REGION_ROM
69
70	.rodata : ALIGN(4)
71	{
72		_f_rodata = .;
73
74		/* section information for finsh shell */
75		. = ALIGN(4);
76		__fsymtab_start = .;
77		KEEP(*(FSymTab))
78		__fsymtab_end = .;
79		. = ALIGN(4);
80		__vsymtab_start = .;
81		KEEP(*(VSymTab))
82		__vsymtab_end = .;
83
84		. = ALIGN(4);
85		__rt_init_start = .;
86		KEEP(*(SORT(.rti_fn*)))
87		__rt_init_end = .;
88		. = ALIGN(4);
89
90		. = ALIGN(4);
91		__CTOR_LIST__ = .;
92		LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
93		KEEP(*(SORT_BY_NAME(".ctors*")))
94		LONG(0)
95		__CTOR_END__ = .;
96
97		. = ALIGN(4);
98		__init_array_start = .;
99		KEEP(*(SORT_BY_NAME(".init_array*")))
100		__init_array_end = .;
101
102		. = ALIGN(4);
103		__DTOR_LIST__ = .;
104		LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
105		KEEP(*(SORT_BY_NAME(".dtors*")))
106		LONG(0)
107		__DTOR_END__ = .;
108
109		*(.rodata .rodata.* .gnu.linkonce.r.*)
110		_e_rodata = .;
111	} > REGION_ROM
112
113	.data : ALIGN(4)
114	{
115		_f_data = .;
116		*(.data .data.* .gnu.linkonce.d.*)
117		_f_sdata = .;
118		__SDATA_BEGIN__ = .;
119		*(.sdata .sdata.* .gnu.linkonce.s.*)
120		PROVIDE (__sbss_start = .);
121		PROVIDE (___sbss_start = .);
122		_f_sbss = .;
123		*(.dynsbss)
124		*(.sbss .sbss.* .gnu.linkonce.sb.*)
125		*(.scommon)
126		_e_sbss = .;
127		PROVIDE (__sbss_end = .);
128		PROVIDE (___sbss_end = .);
129#if defined(EMBARC_UNIT_TEST)
130		. = ALIGN(8);
131		_f_embarc_unittest = .;
132		KEEP(*(.embarc_unittest))
133		_e_embarc_unittest = .;
134#endif
135		_e_sdata = .;
136		_e_data = .;
137	} > REGION_RAM AT > REGION_ROM
138
139	.bss (NOLOAD) : ALIGN(8)
140	{
141		_f_bss = .;
142		*(.dynbss)
143		*(.bss .bss.* .gnu.linkonce.b.*)
144		*(COMMON)
145		_e_bss = .;
146	} > REGION_RAM
147
148	.stack (NOLOAD) :
149	{
150		. = ALIGN(4);
151		_f_stack = .;
152		. = . + _STACKSIZE;
153		_e_stack = .;
154	} > REGION_RAM
155
156	.heap (NOLOAD) :
157	{
158		. = ALIGN(4);
159		__start_heap = . ;
160		_f_heap = .;
161		. = . + _HEAPSIZE;
162		_e_heap = .;
163		__end_heap = . ;
164	} > REGION_RAM
165
166	_load_addr_text = LOADADDR(.text);
167	_load_addr_rodata = LOADADDR(.rodata);
168	_load_addr_data = LOADADDR(.data);
169}
170