debug-in-microsemi-smartfusion2-envm.ld 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. /*******************************************************************************
  2. * (c) Copyright 2015 Microsemi SoC Products Group. All rights reserved.
  3. *
  4. * file name : debug-in-microsemi-smartfusion2-envm.ld
  5. * SmartFusion2 Cortex-M3 linker script for creating a SoftConsole downloadable
  6. * debug image executing in SmartFusion2 internal eNVM.
  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. /* SmartFusion2 internal eNVM mirrored to 0x00000000 */
  59. romMirror (rx) : ORIGIN = 0x00000000, LENGTH = 256k
  60. /* SmartFusion2 internal eSRAM */
  61. ram (rwx) : ORIGIN = 0x20000000, LENGTH = 64k
  62. }
  63. RAM_START_ADDRESS = 0x20000000; /* Must be the same value MEMORY region ram ORIGIN above. */
  64. RAM_SIZE = 64k; /* Must be the same value MEMORY region ram LENGTH above. */
  65. MAIN_STACK_SIZE = 4k; /* Cortex main stack size. */
  66. MIN_SIZE_HEAP = 4k; /* needs to be calculated for your application */
  67. /*******************************************************************************
  68. * End of board customization.
  69. *******************************************************************************/
  70. PROVIDE (__main_stack_start = RAM_START_ADDRESS + RAM_SIZE);
  71. PROVIDE (_estack = __main_stack_start);
  72. PROVIDE (__mirrored_nvm = 1); /* Indicate to startup code that NVM is mirrored to VMA address and no text copy is required. */
  73. /*
  74. * Remap instruction for startup code and debugger.
  75. * set __smartfusion2_memory_remap to one of the following:
  76. * 0: remap eNVM to address 0x00000000 Production mode or debugging from eNVM
  77. * 1: remap eSRAM to address 0x00000000 Debugging from eSRAM
  78. * 2: remap external DDR memory to address 0x00000000 Debugging from DDR memory
  79. */
  80. PROVIDE (__smartfusion2_memory_remap = 0);
  81. SECTIONS
  82. {
  83. .vector_table : ALIGN(0x10)
  84. {
  85. __vector_table_load = LOADADDR(.vector_table);
  86. __vector_table_start = .;
  87. __vector_table_vma_base_address = .; /* required by debugger for start address */
  88. KEEP(*(.isr_vector))
  89. . = ALIGN(0x10);
  90. _evector_table = .;
  91. } >romMirror AT>rom
  92. /* all data and code run/used before reloaction must be located here */
  93. /* When all code in NVRAM, no requirement for this section- but adds clarity when looking at .lst file */
  94. .boot_code : ALIGN(0x10)
  95. {
  96. *(.boot_code) /* reset handler */
  97. *system_m2sxxx.o(.text*) /* SystemInit() - called before relocation to RAM so keep in ROM */
  98. *sys_config.o(.rodata*)
  99. . = ALIGN(0x10);
  100. } >romMirror AT>rom
  101. .text : ALIGN(0x10)
  102. {
  103. CREATE_OBJECT_SYMBOLS
  104. __text_load = LOADADDR(.text); /* required when copying to RAM */
  105. __text_start = .; /* required when copying to RAM */
  106. *(.text .text.* .gnu.linkonce.t.*)
  107. *(.plt)
  108. *(.gnu.warning)
  109. *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
  110. . = ALIGN(4);
  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. *(.rodata .rodata.* .gnu.linkonce.r.*)
  121. *(.ARM.extab* .gnu.linkonce.armextab.*)
  122. *(.gcc_except_table)
  123. *(.eh_frame_hdr)
  124. *(.eh_frame)
  125. KEEP (*(.vector_table))
  126. KEEP (*(.init))
  127. KEEP (*(.fini))
  128. PROVIDE_HIDDEN (__preinit_array_start = .);
  129. KEEP (*(.preinit_array))
  130. PROVIDE_HIDDEN (__preinit_array_end = .);
  131. PROVIDE_HIDDEN (__init_array_start = .);
  132. KEEP (*(SORT(.init_array.*)))
  133. KEEP (*(.init_array))
  134. PROVIDE_HIDDEN (__init_array_end = .);
  135. PROVIDE_HIDDEN (__fini_array_start = .);
  136. KEEP (*(.fini_array))
  137. KEEP (*(SORT(.fini_array.*)))
  138. PROVIDE_HIDDEN (__fini_array_end = .);
  139. . = ALIGN(0x10);
  140. } >romMirror AT>rom
  141. /* .ARM.exidx is sorted, so has to go in its own output section. */
  142. __exidx_start = .;
  143. .ARM.exidx :
  144. {
  145. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  146. } >ram AT>rom
  147. __exidx_end = .;
  148. _etext = .; /* required when copying to RAM */
  149. .data : ALIGN(0x10)
  150. {
  151. __data_load = LOADADDR(.data); /* used when copying to RAM */
  152. _sidata = LOADADDR (.data);
  153. __data_start = .; /* used when copying to RAM */
  154. _sdata = .;
  155. KEEP(*(.jcr))
  156. *(.got.plt) *(.got)
  157. *(.shdata)
  158. *(.data .data.* .gnu.linkonce.d.*)
  159. . = ALIGN (0x10);
  160. _edata = .; /* used when copying to RAM */
  161. } >ram AT>rom
  162. .bss : ALIGN(0x10)
  163. {
  164. __bss_start__ = . ;
  165. _sbss = .;
  166. *(.shbss)
  167. *(.bss .bss.* .gnu.linkonce.b.*)
  168. *(COMMON)
  169. . = ALIGN(0x10);
  170. __bss_end__ = .;
  171. _end = .;
  172. __end = _end;
  173. _ebss = .;
  174. PROVIDE(end = .);
  175. } >ram AT>rom
  176. .heap : ALIGN(0x10)
  177. {
  178. __heap_start__ = .;
  179. . += MIN_SIZE_HEAP; /* will generate error if this minimum size not available */
  180. . += ((ABSOLUTE(RAM_START_ADDRESS) + RAM_SIZE - MAIN_STACK_SIZE) - .); /* assumes stack starts after heap */
  181. _eheap = .;
  182. } >ram
  183. .stack : ALIGN(0x10)
  184. {
  185. __stack_start__ = .;
  186. . += MAIN_STACK_SIZE;
  187. _estack = .;
  188. } >ram
  189. .stab 0 (NOLOAD) :
  190. {
  191. *(.stab)
  192. }
  193. .stabstr 0 (NOLOAD) :
  194. {
  195. *(.stabstr)
  196. }
  197. /* DWARF debug sections.
  198. Symbols in the DWARF debugging sections are relative to the beginning
  199. of the section so we begin them at 0. */
  200. /* DWARF 1 */
  201. .debug 0 : { *(.debug) }
  202. .line 0 : { *(.line) }
  203. /* GNU DWARF 1 extensions */
  204. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  205. .debug_sfnames 0 : { *(.debug_sfnames) }
  206. /* DWARF 1.1 and DWARF 2 */
  207. .debug_aranges 0 : { *(.debug_aranges) }
  208. .debug_pubnames 0 : { *(.debug_pubnames) }
  209. /* DWARF 2 */
  210. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  211. .debug_abbrev 0 : { *(.debug_abbrev) }
  212. .debug_line 0 : { *(.debug_line) }
  213. .debug_frame 0 : { *(.debug_frame) }
  214. .debug_str 0 : { *(.debug_str) }
  215. .debug_loc 0 : { *(.debug_loc) }
  216. .debug_macinfo 0 : { *(.debug_macinfo) }
  217. /* SGI/MIPS DWARF 2 extensions */
  218. .debug_weaknames 0 : { *(.debug_weaknames) }
  219. .debug_funcnames 0 : { *(.debug_funcnames) }
  220. .debug_typenames 0 : { *(.debug_typenames) }
  221. .debug_varnames 0 : { *(.debug_varnames) }
  222. .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
  223. .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
  224. /DISCARD/ : { *(.note.GNU-stack) }
  225. }