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