/ src / bsp / bootloader / STM32U575ZITXQ_FLASH.ld
STM32U575ZITXQ_FLASH.ld
  1  /*
  2  ******************************************************************************
  3  **
  4  **  File        : LinkerScript.ld
  5  **
  6  **  Author      : STM32CubeIDE
  7  **
  8  **  Abstract    : Linker script for STM32U575xI Device from STM32U5 series
  9  **                      2048Kbytes FLASH
 10  **                      784Kbytes RAM
 11  **
 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  **
 19  **  Distribution: The file is distributed as is without any warranty
 20  **                of any kind.
 21  **
 22  *****************************************************************************
 23  ** @attention
 24  **
 25  ** Copyright (c) 2022 STMicroelectronics.
 26  ** All rights reserved.
 27  **
 28  ** This software is licensed under terms that can be found in the LICENSE file
 29  ** in the root directory of this software component.
 30  ** If no LICENSE file comes with this software, it is provided AS-IS.
 31  **
 32  *****************************************************************************
 33  */
 34  
 35  /* Entry Point */
 36  ENTRY(Reset_Handler)
 37  
 38  /* Highest address of the user mode stack */
 39  _estack = ORIGIN(RAM) + LENGTH(RAM);	/* end of "RAM" Ram type memory */
 40  
 41  _Min_Heap_Size = 0x200 ;	/* required amount of heap  */
 42  _Min_Stack_Size = 0x400 ;	/* required amount of stack */
 43  
 44  /* Memories definition */
 45  MEMORY
 46  {
 47    RAM	(xrw)	: ORIGIN = 0x20000000,	LENGTH = 768K
 48    SRAM4	(xrw)	: ORIGIN = 0x28000000,	LENGTH = 16K
 49    FLASH	(rx)	: ORIGIN = 0x08000000,	LENGTH = 2048K
 50  }
 51  
 52  /* Sections */
 53  SECTIONS
 54  {
 55    /* The startup code into "FLASH" Rom type memory */
 56    .isr_vector :
 57    {
 58      KEEP(*(.isr_vector)) /* Startup code */
 59    } >FLASH
 60  
 61    /* The program code and other data into "FLASH" Rom type memory */
 62    .text :
 63    {
 64      *(.text)           /* .text sections (code) */
 65      *(.text*)          /* .text* sections (code) */
 66      *(.glue_7)         /* glue arm to thumb code */
 67      *(.glue_7t)        /* glue thumb to arm code */
 68      *(.eh_frame)
 69  
 70      KEEP (*(.init))
 71      KEEP (*(.fini))
 72  
 73      _etext = .;        /* define a global symbols at end of code */
 74    } >FLASH
 75  
 76    /* Constant data into "FLASH" Rom type memory */
 77    .rodata :
 78    {
 79      *(.rodata)         /* .rodata sections (constants, strings, etc.) */
 80      *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
 81    } >FLASH
 82  
 83    .ARM.extab :
 84    {
 85      *(.ARM.extab* .gnu.linkonce.armextab.*)
 86    } >FLASH
 87  
 88    .ARM :
 89    {
 90      __exidx_start = .;
 91      *(.ARM.exidx*)
 92      __exidx_end = .;
 93    } >FLASH
 94  
 95    .preinit_array :
 96    {
 97      PROVIDE_HIDDEN (__preinit_array_start = .);
 98      KEEP (*(.preinit_array*))
 99      PROVIDE_HIDDEN (__preinit_array_end = .);
100    } >FLASH
101  
102    .init_array :
103    {
104      PROVIDE_HIDDEN (__init_array_start = .);
105      KEEP (*(SORT(.init_array.*)))
106      KEEP (*(.init_array*))
107      PROVIDE_HIDDEN (__init_array_end = .);
108    } >FLASH
109  
110    .fini_array :
111    {
112      PROVIDE_HIDDEN (__fini_array_start = .);
113      KEEP (*(SORT(.fini_array.*)))
114      KEEP (*(.fini_array*))
115      PROVIDE_HIDDEN (__fini_array_end = .);
116    } >FLASH
117  
118    /* Used by the startup to initialize data */
119    _sidata = LOADADDR(.data);
120  
121    /* Initialized data sections into "RAM" Ram type memory */
122    .data :
123    {
124      _sdata = .;        /* create a global symbol at data start */
125      *(.data)           /* .data sections */
126      *(.data*)          /* .data* sections */
127      *(.RamFunc)        /* .RamFunc sections */
128      *(.RamFunc*)       /* .RamFunc* sections */
129  
130      _edata = .;        /* define a global symbol at data end */
131    } >RAM AT> FLASH
132  
133    /* Uninitialized data section into "RAM" Ram type memory */
134    .bss :
135    {
136      /* This is used by the startup in order to initialize the .bss section */
137      _sbss = .;         /* define a global symbol at bss start */
138      __bss_start__ = _sbss;
139      *(.bss)
140      *(.bss*)
141      *(COMMON)
142  
143      _ebss = .;         /* define a global symbol at bss end */
144      __bss_end__ = _ebss;
145    } >RAM
146  
147    /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
148    ._user_heap_stack :
149    {
150      . = ALIGN(8);
151      PROVIDE ( end = . );
152      PROVIDE ( _end = . );
153      . = . + _Min_Heap_Size;
154      . = . + _Min_Stack_Size;
155      . = ALIGN(8);
156    } >RAM
157  
158    /* Remove information from the compiler libraries */
159    /DISCARD/ :
160    {
161      libc.a ( * )
162      libm.a ( * )
163      libgcc.a ( * )
164    }
165  
166    .ARM.attributes 0 : { *(.ARM.attributes) }
167  }