c32-release.ld 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. /****************************************************************************
  2. * configs/pic32mx7mmb/scripts/c32-release.ld
  3. *
  4. * Copyright (C) 2012 Gregory Nutt. All rights reserved.
  5. * Author: Gregory Nutt <gnutt@nuttx.org>
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. * 2. Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in
  15. * the documentation and/or other materials provided with the
  16. * distribution.
  17. * 3. Neither the name NuttX nor the names of its contributors may be
  18. * used to endorse or promote products derived from this software
  19. * without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. * POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. ****************************************************************************/
  35. /* Memory Regions ***********************************************************/
  36. MEMORY
  37. {
  38. /* The PIC32MX795F512L has 512Kb of program FLASH at physical address
  39. * 0x1d000000 but is always accessed at KSEG0 address 0x9d00:0000
  40. */
  41. kseg0_progmem (rx) : ORIGIN = 0x9d000000, LENGTH = 512K
  42. /* The PIC32MX795F512L has 12Kb of boot FLASH at physical address
  43. * 0x1fc00000. The initial reset vector is in KSEG1, but all other
  44. * accesses are in KSEG0.
  45. *
  46. * REGION PHYSICAL KSEG SIZE
  47. * DESCRIPTION START ADDR (BYTES)
  48. * ------------- ---------- ------ ----------------------
  49. * Exceptions:*
  50. * Reset 0x1fc00000 KSEG1 512 512
  51. * TLB Refill 0x1fc00200 KSEG1 256 768
  52. * Cache Error 0x1fc00300 KSEG1 128 896
  53. * Others 0x1fc00380 KSEG1 128 1024 (1Kb)
  54. * Interrupt 0x1fc00400 KSEG1 128 1152
  55. * JTAG 0x1fc00480 KSEG1 16 1168
  56. * Exceptions 0x1fc00490 KSEG0 8192-1168 8192 (4Kb)
  57. * Debug code 0x1fc02000 KSEG1 4096-16 12272
  58. * DEVCFG3-0 0x1fc02ff0 KSEG1 16 12288 (12Kb)
  59. *
  60. * Exceptions assume:
  61. *
  62. * STATUS: BEV=0/1 and EXL=0
  63. * CAUSE: IV=1
  64. * JTAG: ProbEn=0
  65. * And multi-vector support disabled
  66. */
  67. kseg1_reset (rx) : ORIGIN = 0xbfc00000, LENGTH = 384
  68. kseg1_genexcpt (rx) : ORIGIN = 0xbfc00180, LENGTH = 128
  69. kseg1_ebexcpt (rx) : ORIGIN = 0xbfc00200, LENGTH = 128
  70. kseg1_bevexcpt (rx) : ORIGIN = 0xbfc00380, LENGTH = 128
  71. kseg1_intexcpt (rx) : ORIGIN = 0xbfc00400, LENGTH = 128
  72. kseg1_dbgexcpt (rx) : ORIGIN = 0xbfc00480, LENGTH = 16
  73. kseg0_bootmem (rx) : ORIGIN = 0x9fc00490, LENGTH = 8192-1168
  74. kseg1_dbgcode (rx) : ORIGIN = 0xbfc02000, LENGTH = 4096-16
  75. kseg1_devcfg (r) : ORIGIN = 0xbfc02ff0, LENGTH = 16
  76. /* The PIC32MX795F512L has 128Kb of data memory at physical address
  77. * 0x00000000. Since the PIC32MX has no data cache, this memory is
  78. * always accessed through KSEG1.
  79. *
  80. * When used with MPLAB, we need to set aside 512 bytes of memory
  81. * for use by MPLAB.
  82. */
  83. kseg1_datamem (w!x) : ORIGIN = 0xa0000200, LENGTH = 128K - 512
  84. }
  85. OUTPUT_FORMAT("elf32-tradlittlemips")
  86. OUTPUT_ARCH(pic32mx)
  87. ENTRY(__start)
  88. SECTIONS
  89. {
  90. /* Boot FLASH sections */
  91. .reset :
  92. {
  93. KEEP (*(.reset))
  94. } > kseg1_reset
  95. /* Exception handlers. The following is assumed:
  96. *
  97. * STATUS: BEV=1 and EXL=0
  98. * CAUSE: IV=1
  99. * JTAG: ProbEn=0
  100. * And multi-vector support disabled
  101. *
  102. * In that configuration, the vector locations become:
  103. *
  104. * Reset, Soft Reset bfc0:0000
  105. * TLB Refill bfc0:0200
  106. * Cache Error bfc0:0300
  107. * All others bfc0:0380
  108. * Interrupt bfc0:0400
  109. * EJTAG Debug bfc0:0480
  110. */
  111. /* KSEG1 exception handler "trampolines" */
  112. .gen_excpt :
  113. {
  114. KEEP (*(.gen_excpt))
  115. } > kseg1_genexcpt
  116. .ebase_excpt :
  117. {
  118. KEEP (*(.ebase_excpt))
  119. } > kseg1_ebexcpt
  120. .bev_excpt :
  121. {
  122. KEEP (*(.bev_excpt))
  123. } > kseg1_bevexcpt
  124. .int_excpt :
  125. {
  126. KEEP (*(.int_excpt))
  127. } > kseg1_intexcpt
  128. .dbg_excpt = ORIGIN(kseg1_dbgexcpt);
  129. .start :
  130. {
  131. /* KSEG0 Reset startup logic */
  132. *(.start)
  133. /* KSEG0 exception handlers */
  134. *(.nmi_handler)
  135. *(.bev_handler)
  136. *(.int_handler)
  137. } > kseg0_bootmem
  138. .dbg_code = ORIGIN(kseg1_dbgcode);
  139. .devcfg :
  140. {
  141. KEEP (*(.devcfg))
  142. } > kseg1_devcfg
  143. /* Program FLASH sections */
  144. .text :
  145. {
  146. _stext = ABSOLUTE(.);
  147. *(.text .text.*)
  148. *(.stub)
  149. KEEP (*(.text.*personality*))
  150. *(.gnu.linkonce.t.*)
  151. *(.gnu.warning)
  152. *(.mips16.fn.*)
  153. *(.mips16.call.*)
  154. /* Read-only data is included in the text section */
  155. *(.rodata .rodata.*)
  156. *(.rodata1)
  157. *(.gnu.linkonce.r.*)
  158. /* Small initialized constant global and static data */
  159. *(.sdata2 .sdata2.*)
  160. *(.gnu.linkonce.s2.*)
  161. /* Uninitialized constant global and static data */
  162. *(.sbss2 .sbss2.*)
  163. *(.gnu.linkonce.sb2.*)
  164. _etext = ABSOLUTE(.);
  165. } > kseg0_progmem
  166. /* Initialization data begins here in progmem */
  167. _data_loaddr = LOADADDR(.data);
  168. .eh_frame_hdr : { *(.eh_frame_hdr) }
  169. .eh_frame : ONLY_IF_RO { KEEP (*(.eh_frame)) }
  170. /* RAM functions are positioned at the beginning of RAM so that
  171. * they can be guaranteed to satisfy the 2Kb alignment requirement.
  172. */
  173. /* This causes failures if there are no RAM functions
  174. .ramfunc ALIGN(2K) :
  175. {
  176. _sramfunc = ABSOLUTE(.);
  177. *(.ramfunc .ramfunc.*)
  178. _eramfunc = ABSOLUTE(.);
  179. } > kseg1_datamem AT > kseg0_progmem
  180. _ramfunc_loadaddr = LOADADDR(.ramfunc);
  181. _ramfunc_sizeof = SIZEOF(.ramfunc);
  182. _bmxdkpba_address = _sramfunc - ORIGIN(kseg1_datamem) ;
  183. _bmxdudba_address = LENGTH(kseg1_datamem) ;
  184. _bmxdupba_address = LENGTH(kseg1_datamem) ;
  185. */
  186. .data :
  187. {
  188. _sdata = ABSOLUTE(.);
  189. *(.data .data.*)
  190. *(.gnu.linkonce.d.*)
  191. KEEP (*(.gnu.linkonce.d.*personality*))
  192. *(.data1)
  193. } > kseg1_datamem AT > kseg0_progmem
  194. .eh_frame : ONLY_IF_RW { KEEP (*(.eh_frame)) }
  195. _gp = ALIGN(16) + 0x7FF0 ;
  196. .got :
  197. {
  198. *(.got.plt) *(.got)
  199. } > kseg1_datamem AT > kseg0_progmem
  200. .sdata :
  201. {
  202. *(.sdata .sdata.* .gnu.linkonce.s.*)
  203. } > kseg1_datamem AT > kseg0_progmem
  204. .lit8 :
  205. {
  206. *(.lit8)
  207. } > kseg1_datamem AT > kseg0_progmem
  208. .lit4 :
  209. {
  210. *(.lit4)
  211. _edata = ABSOLUTE(.);
  212. } >kseg1_datamem AT>kseg0_progmem
  213. .sbss :
  214. {
  215. _sbss = ABSOLUTE(.);
  216. *(.dynsbss)
  217. *(.sbss .sbss.* .gnu.linkonce.sb.*)
  218. *(.scommon)
  219. } >kseg1_datamem
  220. .bss :
  221. {
  222. *(.dynbss)
  223. *(.bss .bss.*)
  224. *(.gnu.linkonce.b.*)
  225. *(COMMON)
  226. _ebss = ABSOLUTE(.);
  227. } > kseg1_datamem
  228. /* Stabs debugging sections */
  229. .stab 0 : { *(.stab) }
  230. .stabstr 0 : { *(.stabstr) }
  231. .stab.excl 0 : { *(.stab.excl) }
  232. .stab.exclstr 0 : { *(.stab.exclstr) }
  233. .stab.index 0 : { *(.stab.index) }
  234. .stab.indexstr 0 : { *(.stab.indexstr) }
  235. .comment 0 : { *(.comment) }
  236. /* DWARF debug sections */
  237. /* DWARF 1 */
  238. .debug 0 : { *(.debug) }
  239. .line 0 : { *(.line) }
  240. /* GNU DWARF 1 extensions */
  241. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  242. .debug_sfnames 0 : { *(.debug_sfnames) }
  243. /* DWARF 1.1 and DWARF 2 */
  244. .debug_aranges 0 : { *(.debug_aranges) }
  245. .debug_pubnames 0 : { *(.debug_pubnames) }
  246. /* DWARF 2 */
  247. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  248. .debug_abbrev 0 : { *(.debug_abbrev) }
  249. .debug_line 0 : { *(.debug_line) }
  250. .debug_frame 0 : { *(.debug_frame) }
  251. .debug_str 0 : { *(.debug_str) }
  252. .debug_loc 0 : { *(.debug_loc) }
  253. .debug_macinfo 0 : { *(.debug_macinfo) }
  254. /* SGI/MIPS DWARF 2 extensions */
  255. .debug_weaknames 0 : { *(.debug_weaknames) }
  256. .debug_funcnames 0 : { *(.debug_funcnames) }
  257. .debug_typenames 0 : { *(.debug_typenames) }
  258. .debug_varnames 0 : { *(.debug_varnames) }
  259. /DISCARD/ : { *(.note.GNU-stack) }
  260. }