Subversion Repositories DashDisplay

Rev

Rev 61 | Rev 77 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
58 mjames 1
/*
61 mjames 2
******************************************************************************
58 mjames 3
**
4
 
61 mjames 5
**  File        : LinkerScript.ld
58 mjames 6
**
61 mjames 7
**  Author		: STM32CubeMX
58 mjames 8
**
61 mjames 9
**  Abstract    : Linker script for STM32L152RETx series
10
**                512Kbytes FLASH and 80Kbytes RAM
11
**
58 mjames 12
**                Set heap size, stack size and stack location according
13
**                to application requirements.
14
**
15
**                Set memory bank area and size if external memory is used.
16
**
17
**  Target      : STMicroelectronics STM32
18
**
61 mjames 19
**  Distribution: The file is distributed “as is,” without any warranty
58 mjames 20
**                of any kind.
21
**
61 mjames 22
*****************************************************************************
23
** @attention
58 mjames 24
**
61 mjames 25
** <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
26
**
27
** Redistribution and use in source and binary forms, with or without modification,
28
** are permitted provided that the following conditions are met:
29
**   1. Redistributions of source code must retain the above copyright notice,
30
**      this list of conditions and the following disclaimer.
31
**   2. Redistributions in binary form must reproduce the above copyright notice,
32
**      this list of conditions and the following disclaimer in the documentation
33
**      and/or other materials provided with the distribution.
34
**   3. Neither the name of STMicroelectronics nor the names of its contributors
35
**      may be used to endorse or promote products derived from this software
36
**      without specific prior written permission.
37
**
38
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
39
** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
40
** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
41
** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
42
** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
43
** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
44
** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
45
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46
** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
47
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
48
**
58 mjames 49
*****************************************************************************
50
*/
51
 
52
/* Entry Point */
53
ENTRY(Reset_Handler)
54
 
55
/* Highest address of the user mode stack */
61 mjames 56
_estack = ORIGIN(RAM) + LENGTH(RAM);    /* end of RAM */
58 mjames 57
/* Generate a link error if heap and stack don't fit into RAM */
58
_Min_Heap_Size = 0x200;      /* required amount of heap  */
59
_Min_Stack_Size = 0x400; /* required amount of stack */
60
 
61
/* Specify the memory areas */
62
MEMORY
63
{
65 mjames 64
RAM (xrw)     : ORIGIN = 0x20000000, LENGTH = 80K
65
FLASH (rx)    : ORIGIN = 0x08000000, LENGTH = 512K
66
NVRAM (rx)    : ORIGIN = 0x08080000, LENGTH = 4K
58 mjames 67
}
68
 
69
/* Define output sections */
70
SECTIONS
71
{
72
  /* The startup code goes first into FLASH */
73
  .isr_vector :
74
  {
75
    . = ALIGN(4);
76
    KEEP(*(.isr_vector)) /* Startup code */
77
    . = ALIGN(4);
78
  } >FLASH
79
 
80
  /* The program code and other data goes into FLASH */
81
  .text :
82
  {
83
    . = ALIGN(4);
84
    *(.text)           /* .text sections (code) */
85
    *(.text*)          /* .text* sections (code) */
86
    *(.glue_7)         /* glue arm to thumb code */
87
    *(.glue_7t)        /* glue thumb to arm code */
88
    *(.eh_frame)
89
 
90
    KEEP (*(.init))
91
    KEEP (*(.fini))
92
 
93
    . = ALIGN(4);
94
    _etext = .;        /* define a global symbols at end of code */
95
  } >FLASH
96
 
97
  /* Constant data goes into FLASH */
98
  .rodata :
99
  {
100
    . = ALIGN(4);
101
    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
102
    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
103
    . = ALIGN(4);
104
  } >FLASH
105
 
106
  .ARM.extab   : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
107
  .ARM : {
108
    __exidx_start = .;
109
    *(.ARM.exidx*)
110
    __exidx_end = .;
111
  } >FLASH
112
 
113
  .preinit_array     :
114
  {
115
    PROVIDE_HIDDEN (__preinit_array_start = .);
116
    KEEP (*(.preinit_array*))
117
    PROVIDE_HIDDEN (__preinit_array_end = .);
118
  } >FLASH
119
  .init_array :
120
  {
121
    PROVIDE_HIDDEN (__init_array_start = .);
122
    KEEP (*(SORT(.init_array.*)))
123
    KEEP (*(.init_array*))
124
    PROVIDE_HIDDEN (__init_array_end = .);
125
  } >FLASH
126
  .fini_array :
127
  {
128
    PROVIDE_HIDDEN (__fini_array_start = .);
129
    KEEP (*(SORT(.fini_array.*)))
130
    KEEP (*(.fini_array*))
131
    PROVIDE_HIDDEN (__fini_array_end = .);
132
  } >FLASH
133
 
134
  /* used by the startup to initialize data */
135
  _sidata = LOADADDR(.data);
136
 
137
  /* Initialized data sections goes into RAM, load LMA copy after code */
138
  .data : 
139
  {
140
    . = ALIGN(4);
141
    _sdata = .;        /* create a global symbol at data start */
142
    *(.data)           /* .data sections */
143
    *(.data*)          /* .data* sections */
144
 
145
    . = ALIGN(4);
146
    _edata = .;        /* define a global symbol at data end */
147
  } >RAM AT> FLASH
148
 
149
 
150
  /* Uninitialized data section */
151
  . = ALIGN(4);
152
  .bss :
153
  {
154
    /* This is used by the startup in order to initialize the .bss secion */
155
    _sbss = .;         /* define a global symbol at bss start */
156
    __bss_start__ = _sbss;
157
    *(.bss)
158
    *(.bss*)
159
    *(COMMON)
160
 
161
    . = ALIGN(4);
162
    _ebss = .;         /* define a global symbol at bss end */
163
    __bss_end__ = _ebss;
164
  } >RAM
165
 
166
  /* User_heap_stack section, used to check that there is enough RAM left */
167
  ._user_heap_stack :
168
  {
61 mjames 169
    . = ALIGN(8);
58 mjames 170
    PROVIDE ( end = . );
171
    PROVIDE ( _end = . );
172
    . = . + _Min_Heap_Size;
173
    . = . + _Min_Stack_Size;
61 mjames 174
    . = ALIGN(8);
58 mjames 175
  } >RAM
176
 
65 mjames 177
 /* NVRAM image section : nothing gets stored here but the addresses are set up */
178
 /* any __attribute__((section(".NVRAM_Data"))) section info to be put in here  */
179
 .nvram_data (NOLOAD) :  
180
   {
181
   _nvr_base = .;
182
    KEEP ( *(.NVRAM_Data)) 
183
   } >NVRAM 
184
   PROVIDE ( NVRAM_Base  = _nvr_base ); 
185
 
186
 
58 mjames 187
 
188
 
189
  /* Remove information from the standard libraries */
190
  /DISCARD/ :
191
  {
192
    libc.a ( * )
193
    libm.a ( * )
194
    libgcc.a ( * )
195
  }
196
 
197
  .ARM.attributes 0 : { *(.ARM.attributes) }
198
}
199
 
200