ram-magpie.ld 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. /*
  2. * Copyright (c) 2013 Qualcomm Atheros, Inc.
  3. *
  4. * All rights reserved.
  5. *
  6. * Redistribution and use in source and binary forms, with or without
  7. * modification, are permitted (subject to the limitations in the
  8. * disclaimer below) provided that the following conditions are met:
  9. *
  10. * * Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. *
  13. * * Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in the
  15. * documentation and/or other materials provided with the
  16. * distribution.
  17. *
  18. * * Neither the name of Qualcomm Atheros nor the names of its
  19. * contributors may be used to endorse or promote products derived
  20. * from this software without specific prior written permission.
  21. *
  22. * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
  23. * GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
  24. * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
  25. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  26. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  27. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  28. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  29. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  30. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  31. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  32. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  33. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  34. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. */
  36. /* Linker script for Magpie RAM-based applications */
  37. /*
  38. Currently, ROM code reserves the first 8KB of RAM for its data/bss.
  39. The next 12KB or RAM is used for RAM software's literals and read-only data.
  40. After that comes 64KB reserved for RAM software's data and bss.
  41. Then 92KB of RAM is reserved for text (code).
  42. The last 8KB of RAM is reserved for ROM patches, customer DataSets,
  43. and RAM software expansion. (There is also some additional RAM between
  44. segments that can be used, if needed.)
  45. ROM reserved: 0x00500000..0x00501fff
  46. Literals: 0x00502000..0x00504fff
  47. Data: 0x00505000..0x00514fff
  48. Text: 0x00915000..0x0092bfff
  49. TBD: May want to use a 2-pass link approach in order to
  50. eliminate fixed boundaries. Support for physical addressing
  51. in Tensilica tools would be helpful, but it's not coming
  52. any time soon.
  53. */
  54. /* dram_seg: 0x504000, see target.rom.ld */
  55. /* ***** */
  56. MEMORY
  57. {
  58. lit_seg : org = 0x004E8000, len = 0x1f600
  59. iram_seg : org = 0x00906000, len = 0xad00
  60. dram_seg : org = 0x00510d00, len = 0x6000
  61. }
  62. PHDRS
  63. {
  64. lit_phdr PT_LOAD;
  65. dram_phdr PT_LOAD;
  66. iram_phdr PT_LOAD;
  67. }
  68. /* Default entry point: */
  69. ENTRY(app_start)
  70. SECTIONS
  71. {
  72. /*
  73. * This empty section is used to convince RAM linkage
  74. * to share litbase with ROM code.
  75. */
  76. .lit4 (NOLOAD) :
  77. {
  78. _rom_literal_start = ABSOLUTE(.);
  79. . += 0x19000; /* Reserved virtual space for physical mem gap and ROM */
  80. _lit4_start = ABSOLUTE(.);
  81. _lit4_end = ABSOLUTE(.);
  82. _rom_literal_end = ABSOLUTE(.);
  83. } >lit_seg :NONE
  84. .dport0.rodata :
  85. {
  86. _dport0_rodata_start = ABSOLUTE(.); /* 0x505000 */
  87. *(.dport0.rodata)
  88. *(.dport.rodata)
  89. _dport0_rodata_end = ABSOLUTE(.);
  90. } >lit_seg :lit_phdr
  91. .dport0.literal :
  92. {
  93. _dport0_literal_start = ABSOLUTE(.);
  94. *(.dport0.literal)
  95. *(.dport.literal)
  96. _dport0_literal_end = ABSOLUTE(.);
  97. } >lit_seg :lit_phdr
  98. .dram0.rodata :
  99. {
  100. _dram0_rodata_start = ABSOLUTE(.);
  101. *(.dram0.rodata)
  102. *(.dram.rodata)
  103. _dram0_rodata_end = ABSOLUTE(.);
  104. } >lit_seg :lit_phdr
  105. .rodata :
  106. {
  107. _rodata_start = ABSOLUTE(.);
  108. *(.rodata)
  109. *(.rodata.*)
  110. *(.gnu.linkonce.r.*)
  111. *(.rodata1)
  112. __XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
  113. *(.xt_except_table)
  114. *(.gcc_except_table)
  115. *(.gnu.linkonce.e.*)
  116. *(.gnu.version_r)
  117. . = ALIGN(4); /* this table MUST be 4-byte aligned */
  118. _bss_table_start = ABSOLUTE(.);
  119. LONG(_dport0_bss_start)
  120. LONG(_dport0_bss_end)
  121. LONG(_bss_start)
  122. LONG(_bss_end)
  123. _bss_table_end = ABSOLUTE(.);
  124. _rodata_end = ABSOLUTE(.);
  125. } >lit_seg :lit_phdr
  126. .literals :
  127. {
  128. _literals_start = ABSOLUTE(.);
  129. *(*.lit4)
  130. *(.gnu.linkonce.lit4.*)
  131. _literals_end = ABSOLUTE(.);
  132. } >lit_seg :lit_phdr
  133. .dram0.literal :
  134. {
  135. _dram0_literal_start = ABSOLUTE(.);
  136. *(.dram0.literal)
  137. *(.dram.literal)
  138. _dram0_literal_end = ABSOLUTE(.);
  139. } >lit_seg :lit_phdr
  140. .dport0.data :
  141. {
  142. _dport0_data_start = ABSOLUTE(.);
  143. *(.dport0.data)
  144. *(.dport.data)
  145. _dport0_data_end = ABSOLUTE(.);
  146. } >dram_seg :dram_phdr
  147. .dport0.bss :
  148. {
  149. . = ALIGN (8);
  150. _dport0_bss_start = ABSOLUTE(.);
  151. *(.dport0.bss)
  152. . = ALIGN (8);
  153. _dport0_bss_end = ABSOLUTE(.);
  154. } >dram_seg :dram_phdr
  155. .dram0.data :
  156. {
  157. _dram0_data_start = ABSOLUTE(.);
  158. *(.dram0.data)
  159. *(.dram.data)
  160. _dram0_data_end = ABSOLUTE(.);
  161. } >dram_seg :dram_phdr
  162. .data :
  163. {
  164. _data_start = ABSOLUTE(.);
  165. *(.data)
  166. *(.data.*)
  167. *(.gnu.linkonce.d.*)
  168. *(.data1)
  169. *(.sdata)
  170. *(.sdata.*)
  171. *(.gnu.linkonce.s.*)
  172. *(.sdata2)
  173. *(.sdata2.*)
  174. *(.gnu.linkonce.s2.*)
  175. *(.jcr)
  176. *(.eh_frame)
  177. /* C++ constructor and destructor tables, properly ordered: */
  178. KEEP (*crtbegin.o(.ctors))
  179. KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
  180. KEEP (*(SORT(.ctors.*)))
  181. KEEP (*(.ctors))
  182. KEEP (*crtbegin.o(.dtors))
  183. KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
  184. KEEP (*(SORT(.dtors.*)))
  185. KEEP (*(.dtors))
  186. /* C++ exception handlers table: */
  187. __XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
  188. *(.xt_except_desc)
  189. *(.gnu.linkonce.h.*)
  190. __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
  191. *(.xt_except_desc_end)
  192. *(.dynamic)
  193. *(.gnu.version_d)
  194. _data_end = ABSOLUTE(.);
  195. } >dram_seg :dram_phdr
  196. .bss :
  197. {
  198. . = ALIGN (8);
  199. _bss_start = ABSOLUTE(.);
  200. *(.dynsbss)
  201. *(.sbss)
  202. *(.sbss.*)
  203. *(.gnu.linkonce.sb.*)
  204. *(.scommon)
  205. *(.sbss2)
  206. *(.sbss2.*)
  207. *(.gnu.linkonce.sb2.*)
  208. *(.dynbss)
  209. *(.bss)
  210. *(.bss.*)
  211. *(.gnu.linkonce.b.*)
  212. *(COMMON)
  213. *(.dram0.bss)
  214. . = ALIGN (8);
  215. _bss_end = ABSOLUTE(.);
  216. _end = ALIGN(0x8);
  217. PROVIDE(end = ALIGN(0x8));
  218. _fw_image_end = ABSOLUTE(.);
  219. /*_stack_sentry = ALIGN(0x8);*/
  220. } >dram_seg :dram_phdr
  221. .boot :
  222. { *(.boot) } > iram_seg :iram_phdr
  223. .text :
  224. {
  225. _stext = .;
  226. _text_start = ABSOLUTE(.);
  227. *(.entry.text)
  228. *(.init.literal)
  229. *(.init)
  230. *(.literal .text .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
  231. *(.fini.literal)
  232. *(.fini)
  233. *(.gnu.version)
  234. _text_end = ABSOLUTE(.);
  235. _etext = .;
  236. } >iram_seg :iram_phdr
  237. .iram0.text :
  238. {
  239. _iram0_text_start = ABSOLUTE(.);
  240. *(.iram0.literal .iram.literal .iram.text.literal .iram0.text .iram.text)
  241. _iram0_text_end = ABSOLUTE(.);
  242. } >iram_seg :iram_phdr
  243. .debug 0 : { *(.debug) }
  244. .line 0 : { *(.line) }
  245. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  246. .debug_sfnames 0 : { *(.debug_sfnames) }
  247. .debug_aranges 0 : { *(.debug_aranges) }
  248. .debug_pubnames 0 : { *(.debug_pubnames) }
  249. .debug_info 0 : { *(.debug_info) }
  250. .debug_abbrev 0 : { *(.debug_abbrev) }
  251. .debug_line 0 : { *(.debug_line) }
  252. .debug_frame 0 : { *(.debug_frame) }
  253. .debug_str 0 : { *(.debug_str) }
  254. .debug_loc 0 : { *(.debug_loc) }
  255. .debug_macinfo 0 : { *(.debug_macinfo) }
  256. .debug_weaknames 0 : { *(.debug_weaknames) }
  257. .debug_funcnames 0 : { *(.debug_funcnames) }
  258. .debug_typenames 0 : { *(.debug_typenames) }
  259. .debug_varnames 0 : { *(.debug_varnames) }
  260. .xt.insn 0 :
  261. {
  262. KEEP (*(.xt.insn))
  263. KEEP (*(.gnu.linkonce.x.*))
  264. }
  265. .xt.prop 0 :
  266. {
  267. KEEP (*(.xt.prop))
  268. KEEP (*(.gnu.linkonce.prop.*))
  269. }
  270. .xt.lit 0 :
  271. {
  272. KEEP (*(.xt.lit))
  273. KEEP (*(.gnu.linkonce.p.*))
  274. }
  275. }