1 /* 2 ****************************************************************************** 3 ** 4 ** @file : LinkerScript.ld 5 ** 6 ** @author : Auto-generated by STM32CubeIDE 7 ** 8 ** Abstract : Linker script for NUCLEO-F103RB Board embedding STM32F103RBTx Device from stm32f1 series 9 ** 128KBytes FLASH 10 ** 20KBytes 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) 2025 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 = 20K 48 FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 128K 49 } 50 51 /* Sections */ 52 SECTIONS 53 { 54 55 /* The startup code into "FLASH" Rom type memory */ 56 .isr_vector : 57 { 58 . = ALIGN(4); 59 KEEP(*(.isr_vector)) /* Startup code */ 60 . = ALIGN(4); 61 } >FLASH 62 63 /* The program code and other data into "FLASH" Rom type memory */ 64 .text : 65 { 66 . = ALIGN(4); 67 *(.text) /* .text sections (code) */ 68 *(.text*) /* .text* sections (code) */ 69 *(.glue_7) /* glue arm to thumb code */ 70 *(.glue_7t) /* glue thumb to arm code */ 71 *(.eh_frame) 72 73 KEEP (*(.init)) 74 KEEP (*(.fini)) 75 76 . = ALIGN(4); 77 _etext = .; /* define a global symbols at end of code */ 78 } >FLASH 79 80 /* Constant data into "FLASH" Rom type memory */ 81 .rodata : 82 { 83 . = ALIGN(4); 84 *(.rodata) /* .rodata sections (constants, strings, etc.) */ 85 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ 86 . = ALIGN(4); 87 } >FLASH 88 89 .ARM.extab (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */ 90 { 91 . = ALIGN(4); 92 *(.ARM.extab* .gnu.linkonce.armextab.*) 93 . = ALIGN(4); 94 } >FLASH 95 96 .ARM (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */ 97 { 98 . = ALIGN(4); 99 __exidx_start = .; 100 *(.ARM.exidx*) 101 __exidx_end = .; 102 . = ALIGN(4); 103 } >FLASH 104 105 .preinit_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */ 106 { 107 . = ALIGN(4); 108 PROVIDE_HIDDEN (__preinit_array_start = .); 109 KEEP (*(.preinit_array*)) 110 PROVIDE_HIDDEN (__preinit_array_end = .); 111 . = ALIGN(4); 112 } >FLASH 113 114 .init_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */ 115 { 116 . = ALIGN(4); 117 PROVIDE_HIDDEN (__init_array_start = .); 118 KEEP (*(SORT(.init_array.*))) 119 KEEP (*(.init_array*)) 120 PROVIDE_HIDDEN (__init_array_end = .); 121 . = ALIGN(4); 122 } >FLASH 123 124 .fini_array (READONLY) : /* The "READONLY" keyword is only supported in GCC11 and later, remove it if using GCC10 or earlier. */ 125 { 126 . = ALIGN(4); 127 PROVIDE_HIDDEN (__fini_array_start = .); 128 KEEP (*(SORT(.fini_array.*))) 129 KEEP (*(.fini_array*)) 130 PROVIDE_HIDDEN (__fini_array_end = .); 131 . = ALIGN(4); 132 } >FLASH 133 134 /* Used by the startup to initialize data */ 135 _sidata = LOADADDR(.data); 136 137 /* Initialized data sections into "RAM" Ram type memory */ 138 .data : 139 { 140 . = ALIGN(4); 141 _sdata = .; /* create a global symbol at data start */ 142 *(.data) /* .data sections */ 143 *(.data*) /* .data* sections */ 144 *(.RamFunc) /* .RamFunc sections */ 145 *(.RamFunc*) /* .RamFunc* sections */ 146 147 . = ALIGN(4); 148 _edata = .; /* define a global symbol at data end */ 149 150 } >RAM AT> FLASH 151 152 /* Uninitialized data section into "RAM" Ram type memory */ 153 . = ALIGN(4); 154 .bss : 155 { 156 /* This is used by the startup in order to initialize the .bss section */ 157 _sbss = .; /* define a global symbol at bss start */ 158 __bss_start__ = _sbss; 159 *(.bss) 160 *(.bss*) 161 *(COMMON) 162 163 . = ALIGN(4); 164 _ebss = .; /* define a global symbol at bss end */ 165 __bss_end__ = _ebss; 166 } >RAM 167 168 /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */ 169 ._user_heap_stack : 170 { 171 . = ALIGN(8); 172 PROVIDE ( end = . ); 173 PROVIDE ( _end = . ); 174 . = . + _Min_Heap_Size; 175 . = . + _Min_Stack_Size; 176 . = ALIGN(8); 177 } >RAM 178 179 /* Remove information from the compiler libraries */ 180 /DISCARD/ : 181 { 182 libc.a ( * ) 183 libm.a ( * ) 184 libgcc.a ( * ) 185 } 186 187 .ARM.attributes 0 : { *(.ARM.attributes) } 188 }
