1/******************************************************************************* 2 * (c) Copyright 2015 Microsemi SoC Products Group. All rights reserved. 3 * 4 * file name : production-smartfusion2-execute-in-place.ld 5 * SmartFusion2 Cortex-M3 linker script for creating a SoftConsole downloadable 6 * image executing in SmartFusion2 internal eNVM. 7 * 8 * Some current (April 2015) dev kit memory map possibilities are 9 * --Type-------Device-----------address start---address end----size---Dbus--RAM IC-------SF2--Comment--------------- 10 * --eNVM-------M2S010-----------0x60000000------0x6007FFFF-----256KB---------------------010------------------------ 11 * --eNVM-------M2S090-----------0x60000000------0x6007FFFF-----512KB---------------------090------------------------ 12 * --eSRAM------M2Sxxx-----------0x20000000------0x2000FFFF-----64KB----------------------xxx--All have same amount-- 13 * --eSRAM------M2Sxxx-----------0x20000000------0x20013FFF-----80KB----------------------xxx--If ECC/SECDED not used 14 * --Fabric-----M2S010-----------0x30000000------0x6007FFFF-----400Kb---------------------010--note-K bits----------- 15 * --Fabric-----M2S090-----------0x30000000------0x6007FFFF-----2074Kb--------------------090--note-K bits----------- 16 * --LPDDR------STARTER-KIT------0xA0000000------0xA3FFFFFF-----64MB---16--MT46H32M16-----050------------------------ 17 * --LPDDR------484-STARTER-KIT--0xA0000000------0xA3FFFFFF-----64MB---16--MT46H32M16-----010------------------------ 18 * --LPDDR------SEC-EVAL-KIT-----0xA0000000------0xA3FFFFFF-----64MB---16--MT46H32M16LF---090--Security eval kit----- 19 * --DDR3-------ADevKit----------0xA0000000------0xBFFFFFFF-----1GB----32--MT41K256M8DA---150------------------------ 20 * --Some older physical memory map possibilities are 21 * --Type-------location---------address start---address end----size---Dbus---RAM IC------SF2--Comment-------------- 22 * --LPDDR------EVAL KIT---------0xA0000000------0xA3FFFFFF-----64MB-=-16--MT46H32M16LF---025--Eval Kit-------------- 23 * --DDR3-------DevKit-----------0xA0000000------0xAFFFFFFF-----512MB--16--MT41K256M8DA---050------------------------ 24 * 25 * Example linker scripts use lowest practicl values so will work accross dev kits 26 * eNVM=256KB eRAM=64KB External memory = 64MB 27 * 28 * On reset, the eNVM region is mapped to 0x00000000 29 * This is changed below by setting the __smartfusion2_memory_remap variable as required. 30 * Options are detailed below. 31 * 32 * SVN $Revision: 7454 $ 33 * SVN $Date: 2015-06-08 20:28:07 +0530 (Mon, 08 Jun 2015) $ 34 */ 35OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") 36GROUP(-lc -lgcc -lm) 37OUTPUT_ARCH(arm) 38ENTRY(Reset_Handler) 39SEARCH_DIR(.) 40__DYNAMIC = 0; 41 42/******************************************************************************* 43 * Start of board customization. 44 *******************************************************************************/ 45MEMORY 46{ 47 /* 48 * In general, example LD scripts use lowest common memory footprint 49 * so will work with all devices. 50 */ 51 /* 52 * WARNING: The words "SOFTCONSOLE", "FLASH", and "USE", the colon ":", and 53 * the name of the type of flash memory are all in a specific order. 54 * Please do not modify that comment line, in order to ensure 55 * debugging of your application will use the flash memory correctly. 56 */ 57 58 /* SOFTCONSOLE FLASH USE: microsemi-smartfusion2-envm */ 59 rom (rx) : ORIGIN = 0x00000000, LENGTH = 256k 60 61 /* SmartFusion2 internal eSRAM */ 62 ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64k 63} 64 65RAM_START_ADDRESS = 0x20000000; /* Must be the same value MEMORY region ram ORIGIN above. */ 66RAM_SIZE = 64k; /* Must be the same value MEMORY region ram LENGTH above. */ 67MAIN_STACK_SIZE = 4k; /* Cortex main stack size. */ 68MIN_SIZE_HEAP = 4k; /* needs to be calculated for your application */ 69 70/******************************************************************************* 71 * End of board customization. 72 *******************************************************************************/ 73 74PROVIDE (__main_stack_start = RAM_START_ADDRESS + RAM_SIZE); 75PROVIDE (__process_stack_start = __main_stack_start - MAIN_STACK_SIZE); 76PROVIDE (_estack = __main_stack_start); 77PROVIDE (__mirrored_nvm = 0); /* Indicate to startup code that NVM is not mirrored to VMA address .text copy is required. */ 78 79/* 80 * Remap instruction for startup code and debugger: 81 * 0: remap eNVM to address 0x00000000 82 * 1: remap eSRAM to address 0x00000000 83 * 2: remap external DDR memory to address 0x00000000 84 */ 85PROVIDE (__smartfusion2_memory_remap = 0); 86 87SECTIONS 88{ 89 .vector_table : 90 { 91 __vector_table_load = LOADADDR(.vector_table); 92 __vector_table_start = .; 93 __vector_table_vma_base_address = .; 94 KEEP(*(.isr_vector)) 95 . = ALIGN(0x10); 96 _evector_table = .; 97 } >rom 98 99 .boot_code : ALIGN(0x10) /* When all code in NVRAM, no requirement for this section- but adds clarity when looking at .lst file */ 100 { 101 *(.boot_code) 102 . = ALIGN(0x10); 103 } >rom 104 105 .text : ALIGN(0x10) 106 { 107 CREATE_OBJECT_SYMBOLS 108 __text_load = LOADADDR(.text); 109 __text_start = .; 110 111 *(.text .text.* .gnu.linkonce.t.*) 112 *(.plt) 113 *(.gnu.warning) 114 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) 115 116 . = ALIGN(0x4); 117 /* These are for running static constructors and destructors under ELF. */ 118 KEEP (*crtbegin.o(.ctors)) 119 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) 120 KEEP (*(SORT(.ctors.*))) 121 KEEP (*crtend.o(.ctors)) 122 KEEP (*crtbegin.o(.dtors)) 123 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) 124 KEEP (*(SORT(.dtors.*))) 125 KEEP (*crtend.o(.dtors)) 126 127 *(.rodata .rodata.* .gnu.linkonce.r.*) 128 129 *(.ARM.extab* .gnu.linkonce.armextab.*) 130 *(.gcc_except_table) 131 *(.eh_frame_hdr) 132 *(.eh_frame) 133 134 KEEP (*(.vector_table)) 135 KEEP (*(.init)) 136 KEEP (*(.fini)) 137 138 PROVIDE_HIDDEN (__preinit_array_start = .); 139 KEEP (*(.preinit_array)) 140 PROVIDE_HIDDEN (__preinit_array_end = .); 141 PROVIDE_HIDDEN (__init_array_start = .); 142 KEEP (*(SORT(.init_array.*))) 143 KEEP (*(.init_array)) 144 PROVIDE_HIDDEN (__init_array_end = .); 145 PROVIDE_HIDDEN (__fini_array_start = .); 146 KEEP (*(.fini_array)) 147 KEEP (*(SORT(.fini_array.*))) 148 PROVIDE_HIDDEN (__fini_array_end = .); 149 . = ALIGN(0x10); 150 } >rom 151 /* .ARM.exidx is sorted, so has to go in its own output section. */ 152 __exidx_start = .; 153 .ARM.exidx : 154 { 155 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 156 } >rom 157 __exidx_end = .; 158 _etext = .; 159 160 .data : ALIGN(0x10) 161 { 162 __data_load = LOADADDR(.data); 163 _sidata = LOADADDR (.data); 164 __data_start = .; 165 _sdata = .; 166 KEEP(*(.jcr)) 167 *(.got.plt) *(.got) 168 *(.shdata) 169 *(.data .data.* .gnu.linkonce.d.*) 170 . = ALIGN(0x10); 171 _edata = .; 172 } >ram AT>rom 173 174 .bss : ALIGN(0x10) 175 { 176 __bss_start__ = . ; 177 _sbss = .; 178 *(.shbss) 179 *(.bss .bss.* .gnu.linkonce.b.*) 180 *(COMMON) 181 . = ALIGN(0x10); 182 __bss_end__ = .; 183 _end = .; 184 __end = _end; 185 _ebss = .; 186 PROVIDE(end = .); 187 } >ram AT>rom 188 189 .heap : ALIGN(0x10) 190 { 191 __heap_start__ = .; 192 . += MIN_SIZE_HEAP; /* will generate error if this minimum size not available */ 193 . += ((ABSOLUTE(RAM_START_ADDRESS) + RAM_SIZE - MAIN_STACK_SIZE) - .); /* assumes stack starts after heap */ 194 _eheap = .; 195 } >ram 196 197 .stack : ALIGN(0x10) 198 { 199 __stack_start__ = .; 200 . += MAIN_STACK_SIZE; 201 _estack = .; 202 } >ram 203 204 .stab 0 (NOLOAD) : 205 { 206 *(.stab) 207 } 208 209 .stabstr 0 (NOLOAD) : 210 { 211 *(.stabstr) 212 } 213 /* DWARF debug sections. 214 Symbols in the DWARF debugging sections are relative to the beginning 215 of the section so we begin them at 0. */ 216 /* DWARF 1 */ 217 .debug 0 : { *(.debug) } 218 .line 0 : { *(.line) } 219 /* GNU DWARF 1 extensions */ 220 .debug_srcinfo 0 : { *(.debug_srcinfo) } 221 .debug_sfnames 0 : { *(.debug_sfnames) } 222 /* DWARF 1.1 and DWARF 2 */ 223 .debug_aranges 0 : { *(.debug_aranges) } 224 .debug_pubnames 0 : { *(.debug_pubnames) } 225 /* DWARF 2 */ 226 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 227 .debug_abbrev 0 : { *(.debug_abbrev) } 228 .debug_line 0 : { *(.debug_line) } 229 .debug_frame 0 : { *(.debug_frame) } 230 .debug_str 0 : { *(.debug_str) } 231 .debug_loc 0 : { *(.debug_loc) } 232 .debug_macinfo 0 : { *(.debug_macinfo) } 233 /* SGI/MIPS DWARF 2 extensions */ 234 .debug_weaknames 0 : { *(.debug_weaknames) } 235 .debug_funcnames 0 : { *(.debug_funcnames) } 236 .debug_typenames 0 : { *(.debug_typenames) } 237 .debug_varnames 0 : { *(.debug_varnames) } 238 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 239 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) } 240 /DISCARD/ : { *(.note.GNU-stack) } 241} 242