1/*
2*****************************************************************************
3**
4**  File        : n32g4fr.ld
5**
6**  Target      : nationstech n32g4fr
7**
8**
9*****************************************************************************
10*/
11
12/* Entry Point */
13ENTRY(Reset_Handler)
14
15/* Highest address of the user mode stack */
16_estack = 0x20020000;    /* end of RAM */
17
18/* Generate a link error if heap and stack don't fit into RAM */
19_Min_Heap_Size = 0x300;      /* required amount of heap  */
20_Min_Stack_Size = 0x1000; /* required amount of stack */
21
22/* Specify the memory areas */
23MEMORY
24{
25FLASH (rx)      : ORIGIN = 0x800c000, LENGTH = 464K
26RAM (xrw)      : ORIGIN = 0x20004000, LENGTH = 128K
27}
28
29/* Define output sections */
30SECTIONS
31{
32  /* The startup code goes first into FLASH */
33  .isr_vector :
34  {
35    . = ALIGN(4);
36    KEEP(*(.isr_vector)) /* Startup code */
37    . = ALIGN(4);
38  } >FLASH
39
40  /* The program code and other data goes into FLASH */
41  .text :
42  {
43    . = ALIGN(4);
44    *(.text)           /* .text sections (code) */
45    *(.text*)          /* .text* sections (code) */
46    *(.glue_7)         /* glue arm to thumb code */
47    *(.glue_7t)        /* glue thumb to arm code */
48    *(.eh_frame)
49
50    KEEP (*(.init))
51    KEEP (*(.fini))
52
53	/* section information for finsh shell */
54	. = ALIGN(4);
55	__fsymtab_start = .;
56	KEEP(*(FSymTab))
57	__fsymtab_end = .;
58
59	. = ALIGN(4);
60	__vsymtab_start = .;
61	KEEP(*(VSymTab))
62	__vsymtab_end = .;
63
64	/* section information for initial. */
65	. = ALIGN(4);
66	__rt_init_start = .;
67	KEEP(*(SORT(.rti_fn*)))
68	__rt_init_end = .;
69
70    . = ALIGN(4);
71    _etext = .;        /* define a global symbols at end of code */
72  } >FLASH
73
74  /* Constant data goes into FLASH */
75  .rodata :
76  {
77    . = ALIGN(4);
78    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
79    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
80    . = ALIGN(4);
81  } >FLASH
82
83  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
84  .ARM : {
85    __exidx_start = .;
86    *(.ARM.exidx*)
87    __exidx_end = .;
88  } >FLASH
89
90  .preinit_array     :
91  {
92    PROVIDE_HIDDEN (__preinit_array_start = .);
93    KEEP (*(.preinit_array*))
94    PROVIDE_HIDDEN (__preinit_array_end = .);
95  } >FLASH
96  .init_array :
97  {
98    PROVIDE_HIDDEN (__init_array_start = .);
99    KEEP (*(SORT(.init_array.*)))
100    KEEP (*(.init_array*))
101    PROVIDE_HIDDEN (__init_array_end = .);
102  } >FLASH
103  .fini_array :
104  {
105    PROVIDE_HIDDEN (__fini_array_start = .);
106    KEEP (*(SORT(.fini_array.*)))
107    KEEP (*(.fini_array*))
108    PROVIDE_HIDDEN (__fini_array_end = .);
109  } >FLASH
110
111  /* used by the startup to initialize data */
112  _sidata = LOADADDR(.data);
113
114  /* Initialized data sections goes into RAM, load LMA copy after code */
115  .data :
116  {
117    . = ALIGN(4);
118    _sdata = .;        /* create a global symbol at data start */
119    *(.data)           /* .data sections */
120    *(.data*)          /* .data* sections */
121
122    . = ALIGN(4);
123    _edata = .;        /* define a global symbol at data end */
124  } >RAM AT> FLASH
125
126  /* Uninitialized data section */
127  . = ALIGN(4);
128  .bss :
129  {
130    /* This is used by the startup in order to initialize the .bss secion */
131    _sbss = .;         /* define a global symbol at bss start */
132    __bss_start__ = _sbss;
133    *(.bss)
134    *(.bss*)
135    *(COMMON)
136
137    . = ALIGN(4);
138    _ebss = .;         /* define a global symbol at bss end */
139    __bss_end__ = _ebss;
140  } >RAM
141
142  /* User_heap_stack section, used to check that there is enough RAM left */
143  ._user_heap_stack :
144  {
145    . = ALIGN(4);
146    PROVIDE ( end = . );
147    PROVIDE ( _end = . );
148    . = . + _Min_Heap_Size;
149    . = . + _Min_Stack_Size;
150    . = ALIGN(4);
151  } >RAM
152
153
154
155  /* Remove information from the standard libraries */
156  /DISCARD/ :
157  {
158    libc.a ( * )
159    libm.a ( * )
160    libgcc.a ( * )
161  }
162
163  .ARM.attributes 0 : { *(.ARM.attributes) }
164}
165