Mercurial > public > ostc4
annotate BootLoader/CPU1-F429_boot.ld @ 1048:493a5903ec20 GasConsumption
Merge with 9d9d506a82d3162b6b2323819cc08652887d7dd4 (Bootloader)
| author | Ideenmodellierer |
|---|---|
| date | Sat, 15 Nov 2025 19:29:44 +0100 |
| parents | 0dd92e9b70a2 |
| children |
| rev | line source |
|---|---|
| 869 | 1 /***************************************************************************** |
| 2 * -*- coding: UTF-8 -*- | |
| 3 * | |
| 4 * \file Common/CPU1-F429.ld | |
| 5 * \brief Linker Script for CPU1 alias Discovery | |
| 6 * \author Ac6 workbench, Heinrichs Weikamp, and JD Gascuel | |
| 7 * \date 2018 | |
| 8 * | |
| 9 * \details | |
| 10 * Linker script for STM32F429IIT6 Device from STM32F4 series | |
| 11 * - 192Kbytes RAM | |
| 12 * - 2048Kbytes ROM | |
| 13 * | |
| 14 * Set heap size, stack size and stack location according | |
| 15 * to application requirements. | |
| 16 * | |
| 17 * Set memory bank area and size if external memory is used. | |
| 18 * | |
| 19 * $Id$ | |
| 20 ***************************************************************************** | |
| 21 * \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh | |
| 22 * | |
| 23 * This program is free software: you can redistribute it and/or modify | |
| 24 * it under the terms of the GNU General Public License as published by | |
| 25 * the Free Software Foundation, either version 3 of the License, or | |
| 26 * (at your option) any later version. | |
| 27 * | |
| 28 * This program is distributed in the hope that it will be useful, | |
| 29 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 30 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 31 * GNU General Public License for more details. | |
| 32 * | |
| 33 * You should have received a copy of the GNU General Public License | |
| 34 * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
| 35 ***************************************************************************** | |
| 36 * HISTORY | |
| 37 * 2017-12-18 jDG: Mix between std AC6 file and chw stm32f429zi_flash.ld settings. | |
| 38 */ | |
| 39 | |
| 40 /* Entry Point */ | |
| 41 ENTRY(Reset_Handler) | |
| 42 | |
| 43 OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") | |
| 44 OUTPUT_ARCH(arm) | |
| 45 SEARCH_DIR(.) | |
| 46 | |
| 47 /****************************************************************************/ | |
| 48 /***************************** Memory Definition ****************************/ | |
| 49 MEMORY | |
| 50 { | |
| 1016 | 51 ROM_BOOT (rx) : ORIGIN = 0x08000000, LENGTH = 0x00020000 /* 128K */ |
| 869 | 52 ROM (rx) : ORIGIN = 0x08040000, LENGTH = 0x00090000 /* 576K */ |
| 53 UPPER(rx) : ORIGIN = 0x08132000, LENGTH = 0xAE270 /* 713K */ | |
| 54 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 192K | |
| 55 CCRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K | |
| 56 } | |
| 57 | |
| 58 /* Linker file shall be shared between Bootloader, Font and Firmware projects. Not used memory areas to be cut during bin generation */ | |
| 59 | |
| 60 /* Make sure ROM and UPPER are contiguous, and map 2MB */ | |
| 61 /* TODO: At the moment the size of the defined memory will be directly reflected into the file size of resultion bin => Keep small until not used memory may be excluded from build */ | |
| 62 /*ASSERT( ORIGIN(UPPER) - ORIGIN(ROM) == LENGTH(ROM), "ROM lower and upper region shall be continuous" ) | |
| 63 /*ASSERT( LENGTH(ROM) + LENGTH(UPPER) == 2048K, "ROM lower + upper regions = 2MB" ) */ | |
| 64 | |
| 65 /* Highest address of the user mode stack */ | |
| 66 /*_estack = ORIGIN(RAM) + LENGTH(RAM);*/ | |
| 67 | |
| 68 | |
| 69 _Min_Heap_Size = 0; /* no required heap (malloc'ed space) */ | |
| 70 _Min_Stack_Size = 0x08000; /* required 32K of stack */ | |
| 71 | |
| 72 /* Linker script to place sections and symbol values. Should be used together | |
| 73 * with other linker script that defines memory regions FLASH and RAM. | |
| 74 * It references following symbols, which must be defined in code: | |
| 75 * Reset_Handler : Entry of reset handler | |
| 76 * | |
| 77 * It defines following symbols, which code can use without definition: | |
| 78 * __exidx_start | |
| 79 * __exidx_end | |
| 80 * __preinit_array_start | |
| 81 * __preinit_array_end | |
| 82 * __init_array_start | |
| 83 * __init_array_end | |
| 84 * __fini_array_start | |
| 85 * __fini_array_end | |
| 86 * _sbss | |
| 87 * __bss_start__ | |
| 88 * _ebss | |
| 89 * __bss_end__ | |
| 90 * _edata | |
| 91 * end | |
| 92 * _end | |
| 93 * _estack | |
| 94 */ | |
| 95 | |
| 96 /****************************************************************************/ | |
| 97 /*************************** Code and Data Sections *************************/ | |
| 98 SECTIONS | |
| 99 { | |
| 100 /******************* NVIC reset and interupt vectors **********************/ | |
| 101 | |
| 102 .isr_vector 0x08000000 : | |
| 103 { | |
| 104 . = ALIGN(4); | |
| 105 KEEP( *(.isr_vector) ) | |
| 106 KEEP(*(.init)) | |
| 107 } >ROM_BOOT | |
| 108 | |
| 109 | |
| 110 .StdLibs 0x08000200: | |
| 111 { | |
| 112 . = ALIGN(4); | |
| 113 *libm.a:*(*) | |
| 114 } >ROM_BOOT | |
| 115 | |
| 116 | |
| 117 /********************** Constant data into ROM memory *********************/ | |
| 118 | |
| 119 | |
| 120 .ARM.extab : { | |
| 121 . = ALIGN(4); | |
| 122 *(.ARM.extab* .gnu.linkonce.armextab.*) | |
| 123 . = ALIGN(4); | |
| 124 } >ROM_BOOT | |
| 125 | |
| 126 .ARM : { | |
| 127 . = ALIGN(4); | |
| 128 __exidx_start = .; | |
| 129 *(.ARM.exidx*) | |
| 130 __exidx_end = .; | |
| 131 . = ALIGN(4); | |
| 132 } >ROM_BOOT | |
| 133 | |
| 134 .preinit_array : | |
| 135 { | |
| 136 . = ALIGN(4); | |
| 137 PROVIDE_HIDDEN( __preinit_array_start = . ); | |
| 138 KEEP( *(.preinit_array*) ) | |
| 139 PROVIDE_HIDDEN( __preinit_array_end = . ); | |
| 140 . = ALIGN(4); | |
| 141 } >ROM_BOOT | |
| 142 | |
| 143 .init_array : | |
| 144 { | |
| 145 . = ALIGN(4); | |
| 146 PROVIDE_HIDDEN( __init_array_start = . ); | |
| 147 KEEP( *(SORT(.init_array.*)) ) | |
| 148 KEEP( *(.init_array*) ) | |
| 149 PROVIDE_HIDDEN( __init_array_end = . ); | |
| 150 . = ALIGN(4); | |
| 151 } >ROM_BOOT | |
| 152 | |
| 153 .fini_array : | |
| 154 { | |
| 155 . = ALIGN(4); | |
| 156 PROVIDE_HIDDEN( __fini_array_start = . ); | |
| 157 KEEP( *(SORT(.fini_array.*)) ) | |
| 158 KEEP( *(.fini_array*) ) | |
| 159 PROVIDE_HIDDEN( __fini_array_end = . ); | |
| 160 . = ALIGN(4); | |
| 161 } >ROM_BOOT | |
| 162 | |
| 163 /************* The program code and other data into ROM memory ************/ | |
| 164 | |
| 165 | |
| 166 /************* Data and Structures at absolute address in ROM *************/ | |
| 167 | |
| 168 /* FIXME: this sets the SFirmwareData structure, not the code ... */ | |
| 169 .bootloader_firmware_data 0x0800A000 : { | |
| 170 PROVIDE( bootloader_FirmwareData = . ); | |
| 171 KEEP( *(.bootloader_firmware_data) ) | |
| 172 } > ROM_BOOT | |
| 173 | |
|
961
2130d771c8db
Bootloader: Activate Hardware data defaults:
Ideenmodellierer
parents:
869
diff
changeset
|
174 .bootloader_hardware_data 0x0800A040 : { |
|
2130d771c8db
Bootloader: Activate Hardware data defaults:
Ideenmodellierer
parents:
869
diff
changeset
|
175 PROVIDE( bootloader_HardwareData = . ); |
|
2130d771c8db
Bootloader: Activate Hardware data defaults:
Ideenmodellierer
parents:
869
diff
changeset
|
176 KEEP( *(.bootloader_hardware_data) ) |
|
2130d771c8db
Bootloader: Activate Hardware data defaults:
Ideenmodellierer
parents:
869
diff
changeset
|
177 } > ROM_BOOT |
| 869 | 178 |
| 179 .text 0x08001000 : | |
| 180 { | |
| 181 . = ALIGN(4); | |
| 182 *(.text.HAL*) | |
| 183 . = ALIGN(4); | |
| 971 | 184 *(.text*sprint*) |
| 185 *(.text.MX*) | |
| 869 | 186 } >ROM_BOOT |
| 187 | |
| 188 | |
| 189 .text2 0x0800A100 : | |
| 190 { | |
| 191 . = ALIGN(4); | |
| 192 *(.text) /* .text sections (code) */ | |
| 193 *(.text*) /* .text* sections (code) */ | |
| 194 *(.glue_7) /* glue arm to thumb code */ | |
| 195 *(.glue_7t) /* glue thumb to arm code */ | |
| 196 *(.eh_frame) | |
| 197 . = ALIGN(4); | |
| 198 _etext = .; /* define a global symbols at end of code */ | |
| 199 } >ROM_BOOT | |
| 200 | |
| 1016 | 201 .rodata : |
| 202 { | |
| 203 . = ALIGN(4); | |
| 204 *(.rodata) /* .rodata sections (constants, strings, etc.) */ | |
| 205 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ | |
| 206 . = ALIGN(4); | |
| 207 } >ROM_BOOT | |
| 869 | 208 |
| 209 /* Define Known Address for Each Font */ | |
| 210 /* Flash Sector 23 is protected (bootloader font + image) => use end of sector 22 */ | |
| 211 | |
| 1016 | 212 .lower_fonts 0x0801F000 : { |
| 869 | 213 *(.lower_fonts.image_data_*) |
| 214 *(.lower_fonts.*) | |
| 215 *(.upper_fonts.image_data_FontT48*) | |
| 216 *(.upper_fonts.FontT48*) | |
| 217 *(.upper_fonts.image_data_FontT24*) | |
| 218 *(.upper_fonts.FontT24*) | |
| 219 } > ROM_BOOT | |
| 220 | |
| 971 | 221 .lower_directory 0x08004300 : { |
| 869 | 222 *(.lower_font_directory*) |
| 223 *(.upper_font_directory.FontT48*) | |
| 224 *(.upper_font_directory.FontT24*) | |
| 225 } > ROM_BOOT | |
| 226 | |
| 227 .lower_image 0x08009000 : { | |
| 228 *(.lower_image*) | |
| 229 | |
| 230 } > ROM_BOOT | |
| 231 | |
| 232 .lower_directory 0x08009500 : { | |
| 233 *(.lower_image_directory*) | |
| 234 } > ROM_BOOT | |
| 235 | |
| 236 /* Used by the startup to initialize data */ | |
| 237 _sidata = LOADADDR(.data); | |
| 238 | |
| 239 /************ Initialized Data Sections into RAM & ROM Memory **************/ | |
| 240 .data : | |
| 241 { | |
| 242 . = ALIGN(4); | |
| 243 | |
| 244 _sdata = .; /* create a global symbol at data start */ | |
| 245 *(.data) /* .data sections */ | |
| 246 *(.data*) /* .data* sections */ | |
| 247 *(vtable) | |
| 248 | |
| 249 . = ALIGN(4); | |
| 250 _edata = .; /* define a global symbol at data end */ | |
| 251 } >RAM AT>ROM_BOOT | |
| 252 | |
| 253 | |
| 254 | |
| 255 /*************** Uninitialized Data Section into RAM Memory ****************/ | |
| 256 .bss : | |
| 257 { | |
| 258 . = ALIGN(4); | |
| 259 | |
| 260 /* This is used by the startup in order to initialize the .bss secion */ | |
| 261 _sbss = .; /* define a global symbol at bss start */ | |
| 262 __bss_start__ = _sbss; | |
| 263 *(.bss) | |
| 264 *(.bss*) | |
| 265 *(COMMON) | |
| 266 | |
| 267 . = ALIGN(4); | |
| 268 _ebss = .; /* define a global symbol at bss end */ | |
| 269 __bss_end__ = _ebss; | |
| 270 } >RAM | |
| 271 | |
| 272 /********************** User_heap_stack section ****************************/ | |
| 273 /* just to check that there is enough RAM left */ | |
| 274 ._user_heap_stack : | |
| 275 { | |
| 276 . = ALIGN(8); | |
| 277 PROVIDE ( end = . ); | |
| 278 PROVIDE ( _end = . ); | |
| 279 PROVIDE ( __end__ = . ); | |
| 280 . = . + _Min_Heap_Size; | |
| 281 . = . + _Min_Stack_Size; | |
| 282 . = ALIGN(8); | |
| 283 _estack = .; | |
| 284 } >RAM | |
| 285 | |
| 286 /* Remove information from the compiler libraries */ | |
| 287 /DISCARD/ : | |
| 288 { | |
| 289 libc.a ( * ) | |
| 290 libm.a ( * ) | |
| 291 libgcc.a ( * ) | |
| 292 } | |
| 293 | |
| 294 .ARM.attributes 0 : { *(.ARM.attributes) } | |
| 295 } |
