1/******************************************************************************* 2 * (c) Copyright 2015 Microsemi SoC Products Group. All rights reserved. 3 * 4 * file name : debug-in-microsemi-smartfusion2-esram.ld 5 * SmartFusion2 Cortex-M3 linker script for creating a SoftConsole downloadable 6 * debug image executing in SmartFusion2 internal eSRAM. 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: 7478 $ 33 * SVN $Date: 2015-06-18 21:48:18 +0530 (Thu, 18 Jun 2015) $ 34 */ 35 36OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm") 37GROUP(-lc -lgcc -lm) 38OUTPUT_ARCH(arm) 39ENTRY(Reset_Handler) 40SEARCH_DIR(.) 41__DYNAMIC = 0; 42 43/******************************************************************************* 44 * Start of board customization. 45 *******************************************************************************/ 46MEMORY 47{ 48 /* 49 * In general, example LD scripts use lowest common memory footprint 50 * so will work with all devices. 51 */ 52 /* 53 * WARNING: The words "SOFTCONSOLE", "FLASH", and "USE", the colon ":", and 54 * the name of the type of flash memory are all in a specific order. 55 * Please do not modify that comment line, in order to ensure 56 * debugging of your application will use the flash memory correctly. 57 */ 58 /* SmartFusion2 internal eSRAM */ 59 ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64k 60} 61 62RAM_START_ADDRESS = 0x20000000; /* Must be the same value MEMORY region ram ORIGIN above. */ 63RAM_SIZE = 64k; /* Must be the same value MEMORY region ram LENGTH above. */ 64MAIN_STACK_SIZE = 4k; /* Cortex main stack size. */ 65MIN_SIZE_HEAP = 4k; /* needs to be calculated for your application */ 66 67/* Please note that unassigned RAM will be allocated to the .heap section. */ 68 69/******************************************************************************* 70 * End of board customization. 71 *******************************************************************************/ 72 73PROVIDE (__main_stack_start = RAM_START_ADDRESS + RAM_SIZE); 74PROVIDE (_estack = __main_stack_start); 75PROVIDE (__mirrored_nvm = 0); /* Indicate to startup code that NVM is not mirrored to VMA address .text copy is required. */ 76 77 /* 78 * Remap instruction for start-up code and debugger. 79 * set __smartfusion2_memory_remap to one of the following: 80 * 0: remap eNVM to address 0x00000000 Production mode or debugging from eNVM 81 * 1: remap eSRAM to address 0x00000000 See note 1 below. 82 * 2: remap external DDR memory to address 0x00000000 Debugging from or production relocate to DDR memory 83 * note 1: This option should only be used in production mode if required. When debugging using eSRAM, code is not 84 * relocated and __smartfusion2_memory_remap should be set to option 0. In revision 7419 and below of 85 * this file, __smartfusion2_memory_remap was set to option 1. This remap was not required and could lead to an issue 86 * when displaying some invalid memory locations in the debugger using some Libero designs. 87 * 88 */ 89 90PROVIDE (__smartfusion2_memory_remap = 0); 91 92SECTIONS 93{ 94 .vector_table : ALIGN(0x10) 95 { 96 __vector_table_load = LOADADDR(.vector_table); 97 __vector_table_start = .; 98 __vector_table_vma_base_address = .; 99 KEEP(*(.isr_vector)) 100 . = ALIGN(0x10); 101 _evector_table = .; 102 } >ram 103 104 .boot_code : ALIGN(0x10) /* When all code in RAM, no requirement for this section- but adds clarity when looking at .lst file */ 105 { 106 *(.boot_code) 107 . = ALIGN(0x10); 108 } >ram 109 110 .text : 111 ALIGN(0x10) 112 { 113 CREATE_OBJECT_SYMBOLS 114 __text_load = LOADADDR(.text); 115 __text_start = .; 116 *(.text .text.* .gnu.linkonce.t.*) 117 *(.plt) 118 *(.gnu.warning) 119 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) 120 121 . = ALIGN(0x4); 122 /* These are for running static constructors and destructors under ELF. */ 123 KEEP (*crtbegin.o(.ctors)) 124 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) 125 KEEP (*(SORT(.ctors.*))) 126 KEEP (*crtend.o(.ctors)) 127 KEEP (*crtbegin.o(.dtors)) 128 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) 129 KEEP (*(SORT(.dtors.*))) 130 KEEP (*crtend.o(.dtors)) 131 132 *(.rodata .rodata.* .gnu.linkonce.r.*) 133 134 *(.ARM.extab* .gnu.linkonce.armextab.*) 135 *(.gcc_except_table) 136 *(.eh_frame_hdr) 137 *(.eh_frame) 138 139 KEEP (*(.vector_table)) 140 KEEP (*(.init)) 141 KEEP (*(.fini)) 142 143 PROVIDE_HIDDEN (__preinit_array_start = .); 144 KEEP (*(.preinit_array)) 145 PROVIDE_HIDDEN (__preinit_array_end = .); 146 PROVIDE_HIDDEN (__init_array_start = .); 147 KEEP (*(SORT(.init_array.*))) 148 KEEP (*(.init_array)) 149 PROVIDE_HIDDEN (__init_array_end = .); 150 PROVIDE_HIDDEN (__fini_array_start = .); 151 KEEP (*(.fini_array)) 152 KEEP (*(SORT(.fini_array.*))) 153 PROVIDE_HIDDEN (__fini_array_end = .); 154 . = ALIGN(0x10); 155 } >ram 156 /* .ARM.exidx is sorted, so has to go in its own output section. */ 157 __exidx_start = .; 158 .ARM.exidx : 159 { 160 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 161 } >ram 162 __exidx_end = .; 163 _etext = .; 164 PROVIDE(__text_end = .); 165 166 .data : 167 ALIGN(0x10) 168 { 169 __data_load = LOADADDR (.data); 170 _sidata = LOADADDR (.data); 171 __data_start = .; 172 _sdata = .; 173 KEEP(*(.jcr)) 174 *(.got.plt) *(.got) 175 *(.shdata) 176 *(.data .data.* .gnu.linkonce.d.*) 177 . = ALIGN(0x10); 178 _edata = .; 179 } >ram 180 181 .bss : ALIGN(0x10) 182 { 183 __bss_start__ = . ; 184 _sbss = .; 185 *(.shbss) 186 *(.bss .bss.* .gnu.linkonce.b.*) 187 *(COMMON) 188 . = ALIGN(0x10); 189 __bss_end__ = .; 190 _end = .; 191 __end = _end; 192 _ebss = .; 193 PROVIDE(end = .); 194 } >ram 195 196 .heap : ALIGN(0x10) 197 { 198 __heap_start__ = .; 199 . += MIN_SIZE_HEAP; /* will generate error if this minimum size not available */ 200 . += ((ABSOLUTE(RAM_START_ADDRESS) + RAM_SIZE - MAIN_STACK_SIZE) - .); /* assumes stack starts after heap */ 201 _eheap = .; 202 } >ram 203 204 .stack : ALIGN(0x10) 205 { 206 __stack_start__ = .; 207 . += MAIN_STACK_SIZE; 208 _estack = .; 209 } >ram 210 211 .stab 0 (NOLOAD) : 212 { 213 *(.stab) 214 } 215 216 .stabstr 0 (NOLOAD) : 217 { 218 *(.stabstr) 219 } 220 /* DWARF debug sections. 221 Symbols in the DWARF debugging sections are relative to the beginning 222 of the section so we begin them at 0. */ 223 /* DWARF 1 */ 224 .debug 0 : { *(.debug) } 225 .line 0 : { *(.line) } 226 /* GNU DWARF 1 extensions */ 227 .debug_srcinfo 0 : { *(.debug_srcinfo) } 228 .debug_sfnames 0 : { *(.debug_sfnames) } 229 /* DWARF 1.1 and DWARF 2 */ 230 .debug_aranges 0 : { *(.debug_aranges) } 231 .debug_pubnames 0 : { *(.debug_pubnames) } 232 /* DWARF 2 */ 233 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 234 .debug_abbrev 0 : { *(.debug_abbrev) } 235 .debug_line 0 : { *(.debug_line) } 236 .debug_frame 0 : { *(.debug_frame) } 237 .debug_str 0 : { *(.debug_str) } 238 .debug_loc 0 : { *(.debug_loc) } 239 .debug_macinfo 0 : { *(.debug_macinfo) } 240 /* SGI/MIPS DWARF 2 extensions */ 241 .debug_weaknames 0 : { *(.debug_weaknames) } 242 .debug_funcnames 0 : { *(.debug_funcnames) } 243 .debug_typenames 0 : { *(.debug_typenames) } 244 .debug_varnames 0 : { *(.debug_varnames) } 245 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 246 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) } 247 /DISCARD/ : { *(.note.GNU-stack) *(.isr_vector) } 248} 249