debug-in-microsemi-smartfusion2-external-ram.ld 8.7 KB

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