debug-in-microsemi-smartfusion2-esram.ld 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  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. 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. /* SmartFusion2 internal eSRAM */
  57. ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64k
  58. }
  59. RAM_START_ADDRESS = 0x20000000; /* Must be the same value MEMORY region ram ORIGIN above. */
  60. RAM_SIZE = 64k; /* Must be the same value MEMORY region ram LENGTH above. */
  61. MAIN_STACK_SIZE = 4k; /* Cortex main stack size. */
  62. MIN_SIZE_HEAP = 4k; /* needs to be calculated for your application */
  63. /* Please note that unassigned RAM will be allocated to the .heap section. */
  64. /*******************************************************************************
  65. * End of board customization.
  66. *******************************************************************************/
  67. PROVIDE (__main_stack_start = RAM_START_ADDRESS + RAM_SIZE);
  68. PROVIDE (_estack = __main_stack_start);
  69. PROVIDE (__mirrored_nvm = 0); /* Indicate to startup code that NVM is not mirrored to VMA address .text copy is required. */
  70. /*
  71. * Remap instruction for start-up code and debugger.
  72. * set __smartfusion2_memory_remap to one of the following:
  73. * 0: remap eNVM to address 0x00000000 Production mode or debugging from eNVM
  74. * 1: remap eSRAM to address 0x00000000 See note 1 below.
  75. * 2: remap external DDR memory to address 0x00000000 Debugging from or production relocate to DDR memory
  76. * note 1: This option should only be used in production mode if required. When debugging using eSRAM, code is not
  77. * relocated and __smartfusion2_memory_remap should be set to option 0. In revision 7419 and below of
  78. * this file, __smartfusion2_memory_remap was set to option 1. This remap was not required and could lead to an issue
  79. * when displaying some invalid memory locations in the debugger using some Libero designs.
  80. *
  81. */
  82. PROVIDE (__smartfusion2_memory_remap = 0);
  83. SECTIONS
  84. {
  85. .vector_table : ALIGN(0x10)
  86. {
  87. __vector_table_load = LOADADDR(.vector_table);
  88. __vector_table_start = .;
  89. __vector_table_vma_base_address = .;
  90. KEEP(*(.isr_vector))
  91. . = ALIGN(0x10);
  92. _evector_table = .;
  93. } >ram
  94. .boot_code : ALIGN(0x10) /* When all code in RAM, no requirement for this section- but adds clarity when looking at .lst file */
  95. {
  96. *(.boot_code)
  97. . = ALIGN(0x10);
  98. } >ram
  99. .text :
  100. 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. . = ALIGN(0x4);
  110. /* These are for running static constructors and destructors under ELF. */
  111. KEEP (*crtbegin.o(.ctors))
  112. KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
  113. KEEP (*(SORT(.ctors.*)))
  114. KEEP (*crtend.o(.ctors))
  115. KEEP (*crtbegin.o(.dtors))
  116. KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
  117. KEEP (*(SORT(.dtors.*)))
  118. KEEP (*crtend.o(.dtors))
  119. *(.rodata .rodata.* .gnu.linkonce.r.*)
  120. *(.ARM.extab* .gnu.linkonce.armextab.*)
  121. *(.gcc_except_table)
  122. *(.eh_frame_hdr)
  123. *(.eh_frame)
  124. KEEP (*(.vector_table))
  125. KEEP (*(.init))
  126. KEEP (*(.fini))
  127. PROVIDE_HIDDEN (__preinit_array_start = .);
  128. KEEP (*(.preinit_array))
  129. PROVIDE_HIDDEN (__preinit_array_end = .);
  130. PROVIDE_HIDDEN (__init_array_start = .);
  131. KEEP (*(SORT(.init_array.*)))
  132. KEEP (*(.init_array))
  133. PROVIDE_HIDDEN (__init_array_end = .);
  134. PROVIDE_HIDDEN (__fini_array_start = .);
  135. KEEP (*(.fini_array))
  136. KEEP (*(SORT(.fini_array.*)))
  137. PROVIDE_HIDDEN (__fini_array_end = .);
  138. . = ALIGN(0x10);
  139. } >ram
  140. /* .ARM.exidx is sorted, so has to go in its own output section. */
  141. __exidx_start = .;
  142. .ARM.exidx :
  143. {
  144. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  145. } >ram
  146. __exidx_end = .;
  147. _etext = .;
  148. PROVIDE(__text_end = .);
  149. .data :
  150. ALIGN(0x10)
  151. {
  152. __data_load = LOADADDR (.data);
  153. _sidata = LOADADDR (.data);
  154. __data_start = .;
  155. _sdata = .;
  156. KEEP(*(.jcr))
  157. *(.got.plt) *(.got)
  158. *(.shdata)
  159. *(.data .data.* .gnu.linkonce.d.*)
  160. . = ALIGN(0x10);
  161. _edata = .;
  162. } >ram
  163. .bss : ALIGN(0x10)
  164. {
  165. __bss_start__ = . ;
  166. _sbss = .;
  167. *(.shbss)
  168. *(.bss .bss.* .gnu.linkonce.b.*)
  169. *(COMMON)
  170. . = ALIGN(0x10);
  171. __bss_end__ = .;
  172. _end = .;
  173. __end = _end;
  174. _ebss = .;
  175. PROVIDE(end = .);
  176. } >ram
  177. .heap : ALIGN(0x10)
  178. {
  179. __heap_start__ = .;
  180. . += MIN_SIZE_HEAP; /* will generate error if this minimum size not available */
  181. . += ((ABSOLUTE(RAM_START_ADDRESS) + RAM_SIZE - MAIN_STACK_SIZE) - .); /* assumes stack starts after heap */
  182. _eheap = .;
  183. } >ram
  184. .stack : ALIGN(0x10)
  185. {
  186. __stack_start__ = .;
  187. . += MAIN_STACK_SIZE;
  188. _estack = .;
  189. } >ram
  190. .stab 0 (NOLOAD) :
  191. {
  192. *(.stab)
  193. }
  194. .stabstr 0 (NOLOAD) :
  195. {
  196. *(.stabstr)
  197. }
  198. /* DWARF debug sections.
  199. Symbols in the DWARF debugging sections are relative to the beginning
  200. of the section so we begin them at 0. */
  201. /* DWARF 1 */
  202. .debug 0 : { *(.debug) }
  203. .line 0 : { *(.line) }
  204. /* GNU DWARF 1 extensions */
  205. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  206. .debug_sfnames 0 : { *(.debug_sfnames) }
  207. /* DWARF 1.1 and DWARF 2 */
  208. .debug_aranges 0 : { *(.debug_aranges) }
  209. .debug_pubnames 0 : { *(.debug_pubnames) }
  210. /* DWARF 2 */
  211. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  212. .debug_abbrev 0 : { *(.debug_abbrev) }
  213. .debug_line 0 : { *(.debug_line) }
  214. .debug_frame 0 : { *(.debug_frame) }
  215. .debug_str 0 : { *(.debug_str) }
  216. .debug_loc 0 : { *(.debug_loc) }
  217. .debug_macinfo 0 : { *(.debug_macinfo) }
  218. /* SGI/MIPS DWARF 2 extensions */
  219. .debug_weaknames 0 : { *(.debug_weaknames) }
  220. .debug_funcnames 0 : { *(.debug_funcnames) }
  221. .debug_typenames 0 : { *(.debug_typenames) }
  222. .debug_varnames 0 : { *(.debug_varnames) }
  223. .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
  224. .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
  225. /DISCARD/ : { *(.note.GNU-stack) *(.isr_vector) }
  226. }