Mercurial > public > ostc4
comparison Common/CPU1-F429.ld @ 38:5f11787b4f42
include in ostc4 repository
| author | heinrichsweikamp |
|---|---|
| date | Sat, 28 Apr 2018 11:52:34 +0200 |
| parents | |
| children | c42c82f73c96 |
comparison
equal
deleted
inserted
replaced
| 37:ccc45c0e1ea2 | 38:5f11787b4f42 |
|---|---|
| 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 { | |
| 51 ROM (rx) : ORIGIN = 0x08000000, LENGTH = 0x100000 /* 1024K */ | |
| 52 UPPER(rx) : ORIGIN = 0x08100000, LENGTH = 0x100000 /* 1024K */ | |
| 53 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 192K | |
| 54 CCRAM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K | |
| 55 } | |
| 56 | |
| 57 /* Make sure ROM and UPPER are contiguous, and map 2MB */ | |
| 58 ASSERT( ORIGIN(UPPER) - ORIGIN(ROM) == LENGTH(ROM), "ROM lower and upper region shall be continuous" ) | |
| 59 ASSERT( LENGTH(ROM) + LENGTH(UPPER) == 2048K, "ROM lower + upper regions = 2MB" ) | |
| 60 | |
| 61 /* Highest address of the user mode stack */ | |
| 62 _estack = ORIGIN(RAM) + LENGTH(RAM); | |
| 63 | |
| 64 /* Used by the startup to initialize data */ | |
| 65 _sidata = LOADADDR(.data); | |
| 66 | |
| 67 _Min_Heap_Size = 0; /* no required heap (malloc'ed space) */ | |
| 68 _Min_Stack_Size = 0x8000; /* required 32K of stack */ | |
| 69 | |
| 70 /* Linker script to place sections and symbol values. Should be used together | |
| 71 * with other linker script that defines memory regions FLASH and RAM. | |
| 72 * It references following symbols, which must be defined in code: | |
| 73 * Reset_Handler : Entry of reset handler | |
| 74 * | |
| 75 * It defines following symbols, which code can use without definition: | |
| 76 * __exidx_start | |
| 77 * __exidx_end | |
| 78 * __preinit_array_start | |
| 79 * __preinit_array_end | |
| 80 * __init_array_start | |
| 81 * __init_array_end | |
| 82 * __fini_array_start | |
| 83 * __fini_array_end | |
| 84 * _sbss | |
| 85 * __bss_start__ | |
| 86 * _ebss | |
| 87 * __bss_end__ | |
| 88 * _edata | |
| 89 * end | |
| 90 * _end | |
| 91 * _estack | |
| 92 */ | |
| 93 | |
| 94 /****************************************************************************/ | |
| 95 /*************************** Code and Data Sections *************************/ | |
| 96 SECTIONS | |
| 97 { | |
| 98 /******************* NVIC reset and interupt vectors **********************/ | |
| 99 .isr_vector 0x08000000 : | |
| 100 { | |
| 101 KEEP( *(.isr_vector) ) | |
| 102 } >ROM | |
| 103 | |
| 104 /************* The program code and other data into ROM memory ************/ | |
| 105 .text : | |
| 106 { | |
| 107 . = ALIGN(4); | |
| 108 *(.text) /* .text sections (code) */ | |
| 109 *(.text*) /* .text* sections (code) */ | |
| 110 *(.glue_7) /* glue arm to thumb code */ | |
| 111 *(.glue_7t) /* glue thumb to arm code */ | |
| 112 *(.eh_frame) | |
| 113 | |
| 114 . = ALIGN(4); | |
| 115 _etext = .; /* define a global symbols at end of code */ | |
| 116 } >ROM | |
| 117 | |
| 118 .preinit_array : | |
| 119 { | |
| 120 . = ALIGN(4); | |
| 121 PROVIDE_HIDDEN( __preinit_array_start = . ); | |
| 122 KEEP( *(.preinit_array*) ) | |
| 123 PROVIDE_HIDDEN( __preinit_array_end = . ); | |
| 124 . = ALIGN(4); | |
| 125 } >ROM | |
| 126 | |
| 127 .init_array : | |
| 128 { | |
| 129 . = ALIGN(4); | |
| 130 PROVIDE_HIDDEN( __init_array_start = . ); | |
| 131 KEEP( *(SORT(.init_array.*)) ) | |
| 132 KEEP( *(.init_array*) ) | |
| 133 PROVIDE_HIDDEN( __init_array_end = . ); | |
| 134 . = ALIGN(4); | |
| 135 } >ROM | |
| 136 | |
| 137 .fini_array : | |
| 138 { | |
| 139 . = ALIGN(4); | |
| 140 PROVIDE_HIDDEN( __fini_array_start = . ); | |
| 141 KEEP( *(SORT(.fini_array.*)) ) | |
| 142 KEEP( *(.fini_array*) ) | |
| 143 PROVIDE_HIDDEN( __fini_array_end = . ); | |
| 144 . = ALIGN(4); | |
| 145 } >ROM | |
| 146 | |
| 147 /********************** Constant data into ROM memory *********************/ | |
| 148 .rodata : | |
| 149 { | |
| 150 . = ALIGN(4); | |
| 151 *(.rodata) /* .rodata sections (constants, strings, etc.) */ | |
| 152 *(.rodata*) /* .rodata* sections (constants, strings, etc.) */ | |
| 153 . = ALIGN(4); | |
| 154 } >ROM | |
| 155 | |
| 156 .ARM.extab : { | |
| 157 . = ALIGN(4); | |
| 158 *(.ARM.extab* .gnu.linkonce.armextab.*) | |
| 159 . = ALIGN(4); | |
| 160 } >ROM | |
| 161 | |
| 162 .ARM : { | |
| 163 . = ALIGN(4); | |
| 164 __exidx_start = .; | |
| 165 *(.ARM.exidx*) | |
| 166 __exidx_end = .; | |
| 167 . = ALIGN(4); | |
| 168 } >ROM | |
| 169 | |
| 170 /************* Data and Structures at absolute address in ROM *************/ | |
| 171 | |
| 172 /* FIXME: this sets the SFirmwareData structure, not the code ... */ | |
| 173 .bootloader_firmware_data 0x0800A000 : { | |
| 174 PROVIDE( bootloader_FirmwareData = . ); | |
| 175 KEEP( *(.bootloader_firmware_data) ) | |
| 176 } > ROM | |
| 177 | |
| 178 /* FIMXE: original address was 0x08050000. But we have a collision */ | |
| 179 .firmware_FirmwareData 0x08060000 : { | |
| 180 PROVIDE( firmware_FirmwareData = . ); | |
| 181 KEEP( *(.firmware_firmware_data) ) | |
| 182 } >ROM | |
| 183 | |
| 184 .font_firmware_data 0x08132000 : { | |
| 185 PROVIDE( font_FirmwareData = . ); | |
| 186 KEEP( *(.font_firmware_data) ) | |
| 187 } >UPPER | |
| 188 | |
| 189 /* Put fonts and images in UPPER region */ | |
| 190 .upper_fonts : { | |
| 191 __upper_font_data = .; | |
| 192 KEEP( *(.upper_fonts) ) | |
| 193 __upper_font_data_end = .; | |
| 194 } >UPPER | |
| 195 | |
| 196 .upper_font_directory 0x081E0000 : { /* Last 128 KBytes of UPPER ROM */ | |
| 197 | |
| 198 /* Define Known Address for Each Font */ | |
| 199 __font_directory = .; | |
| 200 PROVIDE( Awe48 = __font_directory + 0 * 0xc ); | |
| 201 PROVIDE( FontT24 = __font_directory + 1 * 0xc ); | |
| 202 PROVIDE( FontT42 = __font_directory + 2 * 0xc ); | |
| 203 PROVIDE( FontT48 = __font_directory + 3 * 0xc ); | |
| 204 PROVIDE( FontT54 = __font_directory + 4 * 0xc ); | |
| 205 PROVIDE( FontT84 = __font_directory + 5 * 0xc ); | |
| 206 PROVIDE( FontT105 = __font_directory + 6 * 0xc ); | |
| 207 PROVIDE( FontT144 = __font_directory + 7 * 0xc ); | |
| 208 PROVIDE( Batt24 = __font_directory + 8 * 0xc ); | |
| 209 __font_directory_end = __font_directory + 9 * 0xc; | |
| 210 | |
| 211 KEEP( *(.upper_font_directory) ) | |
| 212 LONG( -1 ); /* Magic End Marker */ | |
| 213 | |
| 214 /* and for Each Image */ | |
| 215 __image_directory = .; | |
| 216 PROVIDE( ImgHWcolor = __image_directory + 0 * 8 ); | |
| 217 PROVIDE( ImgOSTC = __image_directory + 1 * 8 ); | |
| 218 __image_directory_end = __image_directory + 2 * 8; | |
| 219 | |
| 220 /* FIXME: shall KEEP images here */ | |
| 221 LONG( -1 ); /* Magic End Marker */ | |
| 222 | |
| 223 /* and for CLUT */ | |
| 224 PROVIDE( indexHWcolor = . ); | |
| 225 . += 0x400; | |
| 226 LONG( -1 ); /* Magic End Marker */ | |
| 227 } >UPPER | |
| 228 | |
| 229 /************ Initialized Data Sections into RAM & ROM Memory **************/ | |
| 230 .data : | |
| 231 { | |
| 232 . = ALIGN(4); | |
| 233 | |
| 234 _sdata = .; /* create a global symbol at data start */ | |
| 235 *(.data) /* .data sections */ | |
| 236 *(.data*) /* .data* sections */ | |
| 237 *(vtable) | |
| 238 | |
| 239 . = ALIGN(4); | |
| 240 _edata = .; /* define a global symbol at data end */ | |
| 241 } >RAM AT>ROM | |
| 242 | |
| 243 /*************** Uninitialized Data Section into RAM Memory ****************/ | |
| 244 .bss : | |
| 245 { | |
| 246 . = ALIGN(4); | |
| 247 | |
| 248 /* This is used by the startup in order to initialize the .bss secion */ | |
| 249 _sbss = .; /* define a global symbol at bss start */ | |
| 250 __bss_start__ = _sbss; | |
| 251 *(.bss) | |
| 252 *(.bss*) | |
| 253 *(COMMON) | |
| 254 | |
| 255 . = ALIGN(4); | |
| 256 _ebss = .; /* define a global symbol at bss end */ | |
| 257 __bss_end__ = _ebss; | |
| 258 } >RAM | |
| 259 | |
| 260 /********************** User_heap_stack section ****************************/ | |
| 261 /* just to check that there is enough RAM left */ | |
| 262 ._user_heap_stack : | |
| 263 { | |
| 264 . = ALIGN(8); | |
| 265 PROVIDE ( end = . ); | |
| 266 PROVIDE ( _end = . ); | |
| 267 . = . + _Min_Heap_Size; | |
| 268 . = . + _Min_Stack_Size; | |
| 269 . = ALIGN(8); | |
| 270 } >RAM | |
| 271 | |
| 272 /* Remove information from the compiler libraries */ | |
| 273 /DISCARD/ : | |
| 274 { | |
| 275 libc.a ( * ) | |
| 276 libm.a ( * ) | |
| 277 libgcc.a ( * ) | |
| 278 } | |
| 279 | |
| 280 .ARM.attributes 0 : { *(.ARM.attributes) } | |
| 281 } |
