at91_ram.ld 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. /*
  2. * Copyright (C) 2005 by egnite Software GmbH. All rights reserved.
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of the copyright holders nor the names of
  14. * contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  20. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  21. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  24. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  25. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  27. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. * SUCH DAMAGE.
  29. *
  30. * For additional information see http://www.ethernut.de/
  31. */
  32. /*
  33. * $Log$
  34. * Revision 1.2 2006/07/10 14:25:24 haraldkipp
  35. * Adapted to support C++ requirements. Contributed by Matthias Wilde,
  36. * with help of Martin Thomas (WinArm).
  37. *
  38. * Revision 1.1 2005/10/24 11:34:55 haraldkipp
  39. * Initial check in.
  40. *
  41. */
  42. /* Modified by Martin Thomas <mthomas@rhrk.uni-kl.de> for C++-support
  43. ***** NOT TESTED *****
  44. - based on information from the devkitarm linker-script for GBA
  45. - based on infomration from STR7-examples from Anglia Designs
  46. - call the ctors in startup-code before b main / bx main with the following code:
  47. LDR r0, =__ctors_start__
  48. LDR r1, =__ctors_end__
  49. ctor_loop:
  50. CMP r0, r1
  51. BEQ ctor_end
  52. LDR r2, [r0], #4
  53. STMFD sp!, {r0-r1}
  54. MOV lr, pc
  55. MOV pc, r2
  56. LDMFD sp!, {r0-r1}
  57. B ctor_loop
  58. ctor_end:
  59. */
  60. ENTRY(_start)
  61. STARTUP(crtat91_ram.o)
  62. SEARCH_DIR(.)
  63. MEMORY
  64. {
  65. ram : org = 0x00000000, len = 256k
  66. rom : org = 0x10000000, len = 4M
  67. }
  68. SECTIONS
  69. {
  70. .text :
  71. {
  72. *(.vectors);
  73. . = ALIGN(4);
  74. *(.init0);
  75. . = ALIGN(4);
  76. *(.init1);
  77. . = ALIGN(4);
  78. *(.init2);
  79. . = ALIGN(4);
  80. *(.init3);
  81. . = ALIGN(4);
  82. *(.init4);
  83. . = ALIGN(4);
  84. *(.init5);
  85. . = ALIGN(4);
  86. /*
  87. *(.text);
  88. . = ALIGN(4);
  89. *(.rodata*);
  90. . = ALIGN(4);
  91. *(.glue_7t);
  92. . = ALIGN(4);
  93. *(.glue_7);
  94. . = ALIGN(4);
  95. */
  96. *(.text .text.*)
  97. *(.gnu.linkonce.t.*)
  98. *(.glue_7t .glue_7)
  99. KEEP(*(.fini))
  100. *(.gcc_except_table)
  101. . = ALIGN(4);
  102. etext = .;
  103. } > ram
  104. .rodata :
  105. {
  106. *(.rodata .rodata.*)
  107. *(.gnu.linkonce.r.*)
  108. /* SORT(CONSTRUCTORS) */ /* this entry is in the devkitarm script but not in the Anglia example (see section data) */
  109. . = ALIGN(4);
  110. } > ram
  111. .eh_frame :
  112. {
  113. KEEP (*(.eh_frame))
  114. . = ALIGN(4);
  115. } > ram
  116. .ctors :
  117. {
  118. PROVIDE(__ctors_start__ = .);
  119. KEEP(*(SORT(.ctors.*)))
  120. KEEP(*(.ctors))
  121. PROVIDE(__ctors_end__ = .);
  122. . = ALIGN(4);
  123. } > ram
  124. .dtors :
  125. {
  126. PROVIDE(__dtors_start__ = .);
  127. KEEP(*(SORT(.dtors.*)))
  128. KEEP(*(.dtors))
  129. PROVIDE(__dtors_end__ = .);
  130. . = ALIGN(4);
  131. } > ram
  132. .data :
  133. {
  134. PROVIDE (__data_start = .);
  135. *(.data)
  136. *(.data.*)
  137. *(.gnu.linkonce.d*)
  138. SORT(CONSTRUCTORS) /* this entry is in the Anglia example */
  139. /* CONSTRUCTORS */ /* this entry is in the devkitarm script but not in the Anglia example */
  140. . = ALIGN(4);
  141. edata = .;
  142. _edata = .;
  143. PROVIDE (__data_end = .);
  144. } > ram
  145. .bss :
  146. {
  147. PROVIDE (__bss_start = .);
  148. *(.bss)
  149. *(.gnu.linkonce.b*)
  150. *(COMMON)
  151. . = ALIGN(8);
  152. PROVIDE (__bss_end = .);
  153. . += 0x400;
  154. PROVIDE (__stack = .);
  155. PROVIDE (__heap_start = .);
  156. } > ram
  157. /* Stabs debugging sections. */
  158. .stab 0 : { *(.stab) }
  159. .stabstr 0 : { *(.stabstr) }
  160. .stab.excl 0 : { *(.stab.excl) }
  161. .stab.exclstr 0 : { *(.stab.exclstr) }
  162. .stab.index 0 : { *(.stab.index) }
  163. .stab.indexstr 0 : { *(.stab.indexstr) }
  164. .comment 0 : { *(.comment) }
  165. /* DWARF debug sections.
  166. Symbols in the DWARF debugging sections are relative to the beginning
  167. of the section so we begin them at 0. */
  168. /* DWARF 1 */
  169. .debug 0 : { *(.debug) }
  170. .line 0 : { *(.line) }
  171. /* GNU DWARF 1 extensions */
  172. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  173. .debug_sfnames 0 : { *(.debug_sfnames) }
  174. /* DWARF 1.1 and DWARF 2 */
  175. .debug_aranges 0 : { *(.debug_aranges) }
  176. .debug_pubnames 0 : { *(.debug_pubnames) }
  177. /* DWARF 2 */
  178. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  179. .debug_abbrev 0 : { *(.debug_abbrev) }
  180. .debug_line 0 : { *(.debug_line) }
  181. .debug_frame 0 : { *(.debug_frame) }
  182. .debug_str 0 : { *(.debug_str) }
  183. .debug_loc 0 : { *(.debug_loc) }
  184. .debug_macinfo 0 : { *(.debug_macinfo) }
  185. /* SGI/MIPS DWARF 2 extensions */
  186. .debug_weaknames 0 : { *(.debug_weaknames) }
  187. .debug_funcnames 0 : { *(.debug_funcnames) }
  188. .debug_typenames 0 : { *(.debug_typenames) }
  189. .debug_varnames 0 : { *(.debug_varnames) }
  190. }