1/******************************************************************************* 2 * (c) Copyright 2015 Microsemi SoC Products Group. All rights reserved. 3 * 4 * file name : debug-in-microsemi-smartfusion2-external-ram.ld 5 * SmartFusion2 Cortex-M3 linker script for creating a SoftConsole downloadable 6 * debug image executing in external eRAM. 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 practical 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: 7419 $ 33 * SVN $Date: 2015-05-15 21:20:21 +0530 (Fri, 15 May 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 * accross dev boards so will work with all devices. Currently this is 64MB 51 * Program and data space is split evenly in this example 32MB each 52 */ 53 /* SmartFusion2 internal eSRAM */ 54 esram (rwx) : ORIGIN = 0x20000000, LENGTH = 64k 55 56 /* SmartFusion2 development board external RAM */ 57 external_ram (rwx) : ORIGIN = 0x00000000, LENGTH = 32m 58 59 /* External MDDR RAM used for data section. */ 60 /* Must be enough room allocated for data section between 0xA0000000 and data_external_ram */ 61 data_external_ram (rw) : ORIGIN = 0xA2000000, LENGTH = 32m 62} 63 64ESRAM_START_ADDRESS = 0x20000000; /* Must be the same value MEMORY region ram ORIGIN above. */ 65ESRAM_SIZE = 64k; /* Must be the same value MEMORY region ram LENGTH above. */ 66MAIN_STACK_SIZE = 64k; /* Cortex main stack size. */ 67MIN_SIZE_HEAP = 64k; /* needs to be calculated for your application */ 68TOP_OF_MDDR = 0xA4000000; /* Top address of the external MDDR memory. */ 69 70/******************************************************************************* 71 * End of board customization. 72 *******************************************************************************/ 73/*PROVIDE (__main_ram_size = ESRAM_SIZE); */ 74PROVIDE (__main_stack_start = ESRAM_START_ADDRESS + ESRAM_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 * set __smartfusion2_memory_remap to one of the following: 82 * 0: remap eNVM to address 0x00000000 Production mode or debugging from eNVM 83 * 1: remap eSRAM to address 0x00000000 Debugging from eSRAM 84 * 2: remap external DDR memory to address 0x00000000 Debugging from DDR memory 85 */ 86PROVIDE (__smartfusion2_memory_remap = 2); 87 88SECTIONS 89{ 90 .vector_table : ALIGN(0x10) 91 { 92 __vector_table_load = LOADADDR(.vector_table); 93 __vector_table_start = .; 94 __vector_table_vma_base_address = .; /* required by debugger for start address */ 95 KEEP(*(.isr_vector)) 96 . = ALIGN(0x10); 97 _evector_table = .; 98 } >external_ram 99 100 .text : ALIGN(0x10) 101 { 102 CREATE_OBJECT_SYMBOLS 103 __text_load = LOADADDR(.text); 104 __text_start = .; 105 *(.text .text.* .gnu.linkonce.t.*) 106 *(.plt) 107 *(.gnu.warning) 108 *(.glue_7t) *(.glue_7) *(.vfp11_veneer) 109 110 . = ALIGN(0x4); 111 /* These are for running static constructors and destructors under ELF. */ 112 KEEP (*crtbegin.o(.ctors)) 113 KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors)) 114 KEEP (*(SORT(.ctors.*))) 115 KEEP (*crtend.o(.ctors)) 116 KEEP (*crtbegin.o(.dtors)) 117 KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors)) 118 KEEP (*(SORT(.dtors.*))) 119 KEEP (*crtend.o(.dtors)) 120 121 *(.rodata .rodata.* .gnu.linkonce.r.*) 122 123 *(.ARM.extab* .gnu.linkonce.armextab.*) 124 *(.gcc_except_table) 125 *(.eh_frame_hdr) 126 *(.eh_frame) 127 128 KEEP (*(.vector_table)) 129 KEEP (*(.init)) 130 KEEP (*(.fini)) 131 132 PROVIDE_HIDDEN (__preinit_array_start = .); 133 KEEP (*(.preinit_array)) 134 PROVIDE_HIDDEN (__preinit_array_end = .); 135 PROVIDE_HIDDEN (__init_array_start = .); 136 KEEP (*(SORT(.init_array.*))) 137 KEEP (*(.init_array)) 138 PROVIDE_HIDDEN (__init_array_end = .); 139 PROVIDE_HIDDEN (__fini_array_start = .); 140 KEEP (*(.fini_array)) 141 KEEP (*(SORT(.fini_array.*))) 142 PROVIDE_HIDDEN (__fini_array_end = .); 143 . = ALIGN(0x10); 144 } >external_ram 145 /* .ARM.exidx is sorted, so has to go in its own output section. */ 146 __exidx_start = .; 147 .ARM.exidx : 148 { 149 *(.ARM.exidx* .gnu.linkonce.armexidx.*) 150 } >external_ram 151 __exidx_end = .; 152 _etext = .; 153 PROVIDE(__text_end = .); 154 155 .data : ALIGN(0x10) 156 { 157 __data_load = LOADADDR (.data); 158 _sidata = LOADADDR (.data); 159 __data_start = .; 160 _sdata = .; 161 KEEP(*(.jcr)) 162 *(.got.plt) *(.got) 163 *(.shdata) 164 *(.data .data.* .gnu.linkonce.d.*) 165 . = ALIGN(0x10); 166 _edata = .; 167 } >data_external_ram 168 169 .bss : ALIGN(0x10) 170 { 171 __bss_start__ = . ; 172 _sbss = .; 173 *(.shbss) 174 *(.bss .bss.* .gnu.linkonce.b.*) 175 *(COMMON) 176 . = ALIGN(0x10); 177 __bss_end__ = .; 178 _end = .; 179 __end = _end; 180 _ebss = .; 181 PROVIDE(end = .); 182 } >data_external_ram 183 184 .heap : ALIGN(0x10) 185 { 186 __heap_start__ = .; 187 . += MIN_SIZE_HEAP; /* will generate error if this minimum size not available */ 188 . += (ABSOLUTE(TOP_OF_MDDR) - . ); 189 . = ALIGN(0x10); 190 _eheap = .; 191 } >data_external_ram 192 193 .stack : ALIGN(0x10) 194 { 195 __stack_start__ = .; 196 . += MAIN_STACK_SIZE; 197 . = ALIGN(0x10); 198 _estack = .; 199 } >esram 200 201 .stab 0 (NOLOAD) : 202 { 203 *(.stab) 204 } 205 206 .stabstr 0 (NOLOAD) : 207 { 208 *(.stabstr) 209 } 210 /* DWARF debug sections. 211 Symbols in the DWARF debugging sections are relative to the beginning 212 of the section so we begin them at 0. */ 213 /* DWARF 1 */ 214 .debug 0 : { *(.debug) } 215 .line 0 : { *(.line) } 216 /* GNU DWARF 1 extensions */ 217 .debug_srcinfo 0 : { *(.debug_srcinfo) } 218 .debug_sfnames 0 : { *(.debug_sfnames) } 219 /* DWARF 1.1 and DWARF 2 */ 220 .debug_aranges 0 : { *(.debug_aranges) } 221 .debug_pubnames 0 : { *(.debug_pubnames) } 222 /* DWARF 2 */ 223 .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) } 224 .debug_abbrev 0 : { *(.debug_abbrev) } 225 .debug_line 0 : { *(.debug_line) } 226 .debug_frame 0 : { *(.debug_frame) } 227 .debug_str 0 : { *(.debug_str) } 228 .debug_loc 0 : { *(.debug_loc) } 229 .debug_macinfo 0 : { *(.debug_macinfo) } 230 /* SGI/MIPS DWARF 2 extensions */ 231 .debug_weaknames 0 : { *(.debug_weaknames) } 232 .debug_funcnames 0 : { *(.debug_funcnames) } 233 .debug_typenames 0 : { *(.debug_typenames) } 234 .debug_varnames 0 : { *(.debug_varnames) } 235 .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) } 236 .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) } 237 /DISCARD/ : { *(.note.GNU-stack) *(.isr_vector) } 238} 239