c32-release.ld 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306
  1. /****************************************************************************
  2. * boards/mips/pic32mx/sure-pic32mx/scripts/c32-release.ld
  3. *
  4. * Licensed to the Apache Software Foundation (ASF) under one or more
  5. * contributor license agreements. See the NOTICE file distributed with
  6. * this work for additional information regarding copyright ownership. The
  7. * ASF licenses this file to you under the Apache License, Version 2.0 (the
  8. * "License"); you may not use this file except in compliance with the
  9. * License. You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  15. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  16. * License for the specific language governing permissions and limitations
  17. * under the License.
  18. *
  19. ****************************************************************************/
  20. /* Memory Regions ***********************************************************/
  21. MEMORY
  22. {
  23. /* The PIC32MX440F512H has 512Kb of program FLASH at physical address
  24. * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
  25. */
  26. kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
  27. /* The PIC32MX440F512H has 12Kb of boot FLASH at physical address
  28. * 0x1fc00000. The initial reset vector is in KSEG1, but all other
  29. * accesses are in KSEG0.
  30. *
  31. * REGION PHYSICAL KSEG SIZE
  32. * DESCRIPTION START ADDR (BYTES)
  33. * ------------- ---------- ------ ----------------------
  34. * Exceptions:*
  35. * Reset 0x1fc00000 KSEG1 512 512
  36. * TLB Refill 0x1fc00200 KSEG1 256 768
  37. * Cache Error 0x1fc00300 KSEG1 128 896
  38. * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
  39. * Interrupt 0x1fc00400 KSEG1 128 1152
  40. * JTAG 0x1fc00480 KSEG1 16 1168
  41. * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
  42. * Debug code 0x1fc02000 KSEG1 4096-16 12272
  43. * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
  44. *
  45. * Exceptions assume:
  46. *
  47. * STATUS: BEV=0/1 and EXL=0
  48. * CAUSE: IV=1
  49. * JTAG: ProbEn=0
  50. * And multi-vector support disabled
  51. */
  52. kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
  53. kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
  54. kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
  55. kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
  56. kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
  57. kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
  58. kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
  59. kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
  60. kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
  61. /* The PIC32MX440F512H has 32Kb of data memory at physical address
  62. * 0x00000000. Since the PIC32MX has no data cache, this memory is
  63. * always accessed through KSEG1.
  64. *
  65. * When used with MPLAB, we need to set aside 512 bytes of memory
  66. * for use by MPLAB.
  67. */
  68. kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 32K - 512
  69. }
  70. OUTPUT_FORMAT("elf32-tradlittlemips")
  71. OUTPUT_ARCH(pic32mx)
  72. ENTRY(__start)
  73. SECTIONS
  74. {
  75. /* Boot FLASH sections */
  76. .reset :
  77. {
  78. KEEP (*(.reset))
  79. } > kseg1_reset
  80. /* Exception handlers. The following is assumed:
  81. *
  82. * STATUS: BEV=1 and EXL=0
  83. * CAUSE: IV=1
  84. * JTAG: ProbEn=0
  85. * And multi-vector support disabled
  86. *
  87. * In that configuration, the vector locations become:
  88. *
  89. * Reset, Soft Reset bfc0:0000
  90. * TLB Refill bfc0:0200
  91. * Cache Error bfc0:0300
  92. * All others bfc0:0380
  93. * Interrupt bfc0:0400
  94. * EJTAG Debug bfc0:0480
  95. */
  96. /* KSEG1 exception handler "trampolines" */
  97. .gen_excpt :
  98. {
  99. KEEP (*(.gen_excpt))
  100. } > kseg1_genexcpt
  101. .ebase_excpt :
  102. {
  103. KEEP (*(.ebase_excpt))
  104. } > kseg1_ebexcpt
  105. .bev_excpt :
  106. {
  107. KEEP (*(.bev_excpt))
  108. } > kseg1_bevexcpt
  109. .int_excpt :
  110. {
  111. KEEP (*(.int_excpt))
  112. } > kseg1_intexcpt
  113. .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
  114. .start :
  115. {
  116. /* KSEG0 Reset startup logic */
  117. *(.start)
  118. /* KSEG0 exception handlers */
  119. *(.nmi_handler)
  120. *(.bev_handler)
  121. *(.int_handler)
  122. } > kseg0_bootmem
  123. .dbg_code = ORIGIN(kseg1_dbgcode);
  124. .devcfg :
  125. {
  126. KEEP (*(.devcfg))
  127. } > kseg1_devcfg
  128. /* Program FLASH sections */
  129. .text :
  130. {
  131. _stext = ABSOLUTE(.);
  132. *(.text .text.*)
  133. *(.stub)
  134. KEEP (*(.text.*personality*))
  135. *(.gnu.linkonce.t.*)
  136. *(.gnu.warning)
  137. *(.mips16.fn.*)
  138. *(.mips16.call.*)
  139. /* Read-only data is included in the text section */
  140. *(.rodata .rodata.*)
  141. *(.rodata1)
  142. *(.gnu.linkonce.r.*)
  143. /* Small initialized constant global and static data */
  144. *(.sdata2 .sdata2.*)
  145. *(.gnu.linkonce.s2.*)
  146. /* Uninitialized constant global and static data */
  147. *(.sbss2 .sbss2.*)
  148. *(.gnu.linkonce.sb2.*)
  149. _etext = ABSOLUTE(.);
  150. } > kseg0_progmem
  151. /* Initialization data begins here in progmem */
  152. _data_loaddr = LOADADDR(.data);
  153. .eh_frame_hdr : { *(.eh_frame_hdr) }
  154. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
  155. /* RAM functions are positioned at the beginning of RAM so that
  156. * they can be guaranteed to satisfy the 2Kb alignment requirement.
  157. */
  158. /* This causes failures if there are no RAM functions
  159. .ramfunc ALIGN(2K) :
  160. {
  161. _sramfunc = ABSOLUTE(.);
  162. *(.ramfunc .ramfunc.*)
  163. _eramfunc = ABSOLUTE(.);
  164. } > kseg1_datamem AT > kseg0_progmem
  165. _ramfunc_loadaddr = LOADADDR(.ramfunc);
  166. _ramfunc_sizeof = SIZEOF(.ramfunc);
  167. _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
  168. _bmxdudba_address = LENGTH(kseg1_datamem) ;
  169. _bmxdupba_address = LENGTH(kseg1_datamem) ;
  170. */
  171. .data :
  172. {
  173. _sdata = ABSOLUTE(.);
  174. *(.data .data.*)
  175. *(.gnu.linkonce.d.*)
  176. KEEP (*(.gnu.linkonce.d.*personality*))
  177. *(.data1)
  178. } > kseg1_datamem AT > kseg0_progmem
  179. .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
  180. _gp = ALIGN(16) + 0x7FF0 ;
  181. .got :
  182. {
  183. *(.got.plt) *(.got)
  184. } > kseg1_datamem AT > kseg0_progmem
  185. .sdata :
  186. {
  187. *(.sdata .sdata.* .gnu.linkonce.s.*)
  188. } > kseg1_datamem AT > kseg0_progmem
  189. .lit8 :
  190. {
  191. *(.lit8)
  192. } > kseg1_datamem AT > kseg0_progmem
  193. .lit4 :
  194. {
  195. *(.lit4)
  196. . = ALIGN(4);
  197. _edata = ABSOLUTE(.);
  198. } >kseg1_datamem AT>kseg0_progmem
  199. .sbss :
  200. {
  201. . = ALIGN(16);
  202. _sbss = ABSOLUTE(.);
  203. *(.dynsbss)
  204. *(.sbss .sbss.* .gnu.linkonce.sb.*)
  205. *(.scommon)
  206. } >kseg1_datamem
  207. .bss :
  208. {
  209. *(.dynbss)
  210. *(.bss .bss.*)
  211. *(.gnu.linkonce.b.*)
  212. *(COMMON)
  213. . = ALIGN(16);
  214. _ebss = ABSOLUTE(.);
  215. } > kseg1_datamem
  216. /* Stabs debugging sections */
  217. .stab 0 : { *(.stab) }
  218. .stabstr 0 : { *(.stabstr) }
  219. .stab.excl 0 : { *(.stab.excl) }
  220. .stab.exclstr 0 : { *(.stab.exclstr) }
  221. .stab.index 0 : { *(.stab.index) }
  222. .stab.indexstr 0 : { *(.stab.indexstr) }
  223. .comment 0 : { *(.comment) }
  224. /* DWARF debug sections */
  225. /* DWARF 1 */
  226. .debug 0 : { *(.debug) }
  227. .line 0 : { *(.line) }
  228. /* GNU DWARF 1 extensions */
  229. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  230. .debug_sfnames 0 : { *(.debug_sfnames) }
  231. /* DWARF 1.1 and DWARF 2 */
  232. .debug_aranges 0 : { *(.debug_aranges) }
  233. .debug_pubnames 0 : { *(.debug_pubnames) }
  234. /* DWARF 2 */
  235. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  236. .debug_abbrev 0 : { *(.debug_abbrev) }
  237. .debug_line 0 : { *(.debug_line) }
  238. .debug_frame 0 : { *(.debug_frame) }
  239. .debug_str 0 : { *(.debug_str) }
  240. .debug_loc 0 : { *(.debug_loc) }
  241. .debug_macinfo 0 : { *(.debug_macinfo) }
  242. /* SGI/MIPS DWARF 2 extensions */
  243. .debug_weaknames 0 : { *(.debug_weaknames) }
  244. .debug_funcnames 0 : { *(.debug_funcnames) }
  245. .debug_typenames 0 : { *(.debug_typenames) }
  246. .debug_varnames 0 : { *(.debug_varnames) }
  247. /DISCARD/ : { *(.note.GNU-stack) }
  248. }