at91x40_ram.ld 5.5 KB

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