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