production-smartfusion2-relocate-to-external-ram.ld 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /*******************************************************************************
  2. * (c) Copyright 2015 Microsemi SoC Products Group. All rights reserved.
  3. *
  4. * file name : production-smartfusion2-relocate-to-external-ram.ld
  5. * SmartFusion2 Cortex-M3 linker script for creating a SoftConsole downloadable
  6. * image which is copied from internal eNVM to external RAM during boot-up.
  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: 7419 $
  33. * SVN $Date: 2015-05-15 21:20:21 +0530 (Fri, 15 May 2015) $
  34. */
  35. OUTPUT_FORMAT("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
  36. GROUP(-lc -lgcc -lm)
  37. OUTPUT_ARCH(arm)
  38. ENTRY(Reset_Handler)
  39. SEARCH_DIR(.)
  40. __DYNAMIC = 0;
  41. /*******************************************************************************
  42. * Start of board customization.
  43. *******************************************************************************/
  44. MEMORY
  45. {
  46. /*
  47. * In general, example LD scripts use lowest common memory footprint
  48. * so will work with all devices.
  49. */
  50. /*
  51. * WARNING: The words "SOFTCONSOLE", "FLASH", and "USE", the colon ":", and
  52. * the name of the type of flash memory are all in a specific order.
  53. * Please do not modify that comment line, in order to ensure
  54. * debugging of your application will use the flash memory correctly.
  55. */
  56. /* SOFTCONSOLE FLASH USE: microsemi-smartfusion2-envm */
  57. rom (rx) : ORIGIN = 0x60000000, LENGTH = 256k
  58. /* External MDDR RAM used for data section. */
  59. /* 0xA0000000 where external memory starts */
  60. /* first 0x00FFFFF reserved for relocated progam */
  61. /* Locate external RX data above reserved program area */
  62. /* !!! This must not overlap with external_ram when MDDR is remapped to 0x00000000.!!! */
  63. data_external_ram (rw) : ORIGIN = 0xA2000000, LENGTH = 32m
  64. /* SmartFusion2 development board external RAM */
  65. external_ram (rwx) : ORIGIN = 0x00000000, LENGTH = 32m
  66. /* SmartFusion2 internal eSRAM */
  67. esram (rwx) : ORIGIN = 0x20000000, LENGTH = 64k
  68. }
  69. ESRAM_START_ADDRESS = 0x20000000; /* Must be the same value as MEMORY region esram ORIGIN above. */
  70. ESRAM_SIZE = 64k; /* Must be the same value as MEMORY region esram LENGTH above. */
  71. MAIN_STACK_SIZE = 64k; /* Cortex main stack size. */
  72. MIN_SIZE_HEAP = 64k; /* needs to be calculated for your application */
  73. TOP_OF_MDDR = 0xA4000000; /* Top address of the external MDDR memory. */
  74. /*******************************************************************************
  75. * End of board customization.
  76. *******************************************************************************/
  77. PROVIDE (__main_stack_start = ESRAM_START_ADDRESS + ESRAM_SIZE);
  78. PROVIDE (__process_stack_start = __main_stack_start - MAIN_STACK_SIZE);
  79. PROVIDE (_estack = __main_stack_start);
  80. PROVIDE (__mirrored_nvm = 0); /* Indicate to startup code that NVM is not mirrored to VMA address .text copy is required. */
  81. /*
  82. * Remap instruction for startup code and debugger.
  83. * set __smartfusion2_memory_remap to one of the following:
  84. * 0: remap eNVM to address 0x00000000 Production mode or debugging from eNVM
  85. * 1: remap eSRAM to address 0x00000000 Debugging from eSRAM
  86. * 2: remap external DDR memory to address 0x00000000 Debugging from DDR memory
  87. */
  88. PROVIDE (__smartfusion2_memory_remap = 2);
  89. SECTIONS
  90. {
  91. .vector_table : ALIGN(0x10)
  92. {
  93. __vector_table_load = LOADADDR(.vector_table);
  94. __vector_table_start = .;
  95. __vector_table_vma_base_address = .;
  96. KEEP(*(.isr_vector))
  97. . = ALIGN(0x10);
  98. _evector_table = .;
  99. } >external_ram AT>rom
  100. /* all data and code run/used before reloaction must be located here */
  101. .boot_code : ALIGN(0x10)
  102. {
  103. *(.boot_code) /* reset handler */
  104. *system_m2sxxx.o(.text*) /* SystemInit() - called before relocation to RAM so keep in ROM */
  105. *sys_config.o(.rodata*)
  106. *sys_config_SERDESIF_?.o(.rodata*) /* data- used to configure external memeory before use */
  107. /* note ? is a wildcard, can be upto 4 instances */
  108. *mscc_post_hw_cfg_init.o /* used on startup */
  109. *ecc_error_handler.o(.text*) /* do we need this???? */
  110. . = ALIGN(0x10);
  111. } >rom
  112. .text : ALIGN(0x10)
  113. {
  114. CREATE_OBJECT_SYMBOLS
  115. __text_load = LOADADDR(.text);
  116. __text_start = .;
  117. *(.text .text.* .gnu.linkonce.t.*)
  118. *(.plt)
  119. *(.gnu.warning)
  120. *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
  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. *(.rodata .rodata.* .gnu.linkonce.r.*)
  132. *(.ARM.extab* .gnu.linkonce.armextab.*)
  133. *(.gcc_except_table)
  134. *(.eh_frame_hdr)
  135. *(.eh_frame)
  136. KEEP (*(.vector_table))
  137. KEEP (*(.init))
  138. KEEP (*(.fini))
  139. PROVIDE_HIDDEN (__preinit_array_start = .);
  140. KEEP (*(.preinit_array))
  141. PROVIDE_HIDDEN (__preinit_array_end = .);
  142. PROVIDE_HIDDEN (__init_array_start = .);
  143. KEEP (*(SORT(.init_array.*)))
  144. KEEP (*(.init_array))
  145. PROVIDE_HIDDEN (__init_array_end = .);
  146. PROVIDE_HIDDEN (__fini_array_start = .);
  147. KEEP (*(.fini_array))
  148. KEEP (*(SORT(.fini_array.*)))
  149. PROVIDE_HIDDEN (__fini_array_end = .);
  150. . = ALIGN(0x10);
  151. } >external_ram AT>rom
  152. /* .ARM.exidx is sorted, so has to go in its own output section. */
  153. __exidx_start = .;
  154. .ARM.exidx :
  155. {
  156. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  157. } >external_ram AT>rom
  158. __exidx_end = .;
  159. _etext = .;
  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. } >data_external_ram AT>rom
  173. .bss : ALIGN(0x10)
  174. {
  175. __bss_start__ = . ;
  176. _sbss = .;
  177. *(.shbss)
  178. *(.bss .bss.* .gnu.linkonce.b.*)
  179. *(COMMON)
  180. . = ALIGN(0x10);
  181. __bss_end__ = .;
  182. _end = .;
  183. __end = _end;
  184. _ebss = .;
  185. PROVIDE(end = .);
  186. } >data_external_ram AT>rom
  187. .heap : ALIGN(0x10)
  188. {
  189. __heap_start__ = .;
  190. . += MIN_SIZE_HEAP; /* will generate error if this minimum size not available */
  191. . += (ABSOLUTE(TOP_OF_MDDR) - . );
  192. _eheap = .;
  193. } >data_external_ram
  194. .stack : ALIGN(0x10)
  195. {
  196. __stack_start__ = .;
  197. . += MAIN_STACK_SIZE;
  198. _estack = .;
  199. } >esram
  200. .stab 0 (NOLOAD) :
  201. {
  202. *(.stab)
  203. }
  204. .stabstr 0 (NOLOAD) :
  205. {
  206. *(.stabstr)
  207. }
  208. /* DWARF debug sections.
  209. Symbols in the DWARF debugging sections are relative to the beginning
  210. of the section so we begin them at 0. */
  211. /* DWARF 1 */
  212. .debug 0 : { *(.debug) }
  213. .line 0 : { *(.line) }
  214. /* GNU DWARF 1 extensions */
  215. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  216. .debug_sfnames 0 : { *(.debug_sfnames) }
  217. /* DWARF 1.1 and DWARF 2 */
  218. .debug_aranges 0 : { *(.debug_aranges) }
  219. .debug_pubnames 0 : { *(.debug_pubnames) }
  220. /* DWARF 2 */
  221. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  222. .debug_abbrev 0 : { *(.debug_abbrev) }
  223. .debug_line 0 : { *(.debug_line) }
  224. .debug_frame 0 : { *(.debug_frame) }
  225. .debug_str 0 : { *(.debug_str) }
  226. .debug_loc 0 : { *(.debug_loc) }
  227. .debug_macinfo 0 : { *(.debug_macinfo) }
  228. /* SGI/MIPS DWARF 2 extensions */
  229. .debug_weaknames 0 : { *(.debug_weaknames) }
  230. .debug_funcnames 0 : { *(.debug_funcnames) }
  231. .debug_typenames 0 : { *(.debug_typenames) }
  232. .debug_varnames 0 : { *(.debug_varnames) }
  233. .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
  234. .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
  235. /DISCARD/ : { *(.note.GNU-stack) }
  236. }