Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

197 Zeilen
3.9 KiB

  1. /*
  2. * This file is part of the libopencm3 project.
  3. *
  4. * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
  5. * Copyright (C) 2013 Frantisek Burian <BuFran@seznam.cz>
  6. *
  7. * This library is free software: you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation, either version 3 of the License, or
  10. * (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public License
  18. * along with this library. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20. /* Generic linker script for all targets using libopencm3. */
  21. /* Enforce emmition of the vector table. */
  22. EXTERN(vector_table)
  23. /* Define the entry point of the output file. */
  24. ENTRY(reset_handler)
  25. /* Define memory regions. */
  26. MEMORY
  27. {
  28. /* RAM is always used */
  29. ram (rwx) : ORIGIN = _RAM_OFF, LENGTH = _RAM
  30. #if defined(_ROM)
  31. rom (rx) : ORIGIN = _ROM_OFF, LENGTH = _ROM
  32. #endif
  33. #if defined(_ROM1)
  34. rom1 (rx) : ORIGIN = _ROM1_OFF, LENGTH = _ROM1
  35. #endif
  36. #if defined(_ROM2)
  37. rom2 (rx) : ORIGIN = _ROM2_OFF, LENGTH = _ROM2
  38. #endif
  39. #if defined(_RAM1)
  40. ram1 (rwx) : ORIGIN = _RAM1_OFF, LENGTH = _RAM1
  41. #endif
  42. #if defined(_RAM2)
  43. ram2 (rwx) : ORIGIN = _RAM2_OFF, LENGTH = _RAM2
  44. #endif
  45. #if defined(_RAM3)
  46. ram3 (rwx) : ORIGIN = _RAM3_OFF, LENGTH = _RAM3
  47. #endif
  48. #if defined(_CCM)
  49. ccm (rwx) : ORIGIN = _CCM_OFF, LENGTH = _CCM
  50. #endif
  51. #if defined(_EEP)
  52. eep (r) : ORIGIN = _EEP_OFF, LENGTH = _EEP
  53. #endif
  54. #if defined(_XSRAM)
  55. xsram (rw) : ORIGIN = _XSRAM_OFF, LENGTH = _XSRAM
  56. #endif
  57. #if defined(_XDRAM)
  58. xdram (rw) : ORIGIN = _XDRAM_OFF, LENGTH = _XDRAM
  59. #endif
  60. #if defined(_NFCRAM)
  61. nfcram (rw) : ORIGIN _NFCRAM_OFF, LENGTH = _NFCRAM
  62. #endif
  63. }
  64. /* Define sections. */
  65. SECTIONS
  66. {
  67. .text : {
  68. *(.vectors) /* Vector table */
  69. *(.text*) /* Program code */
  70. . = ALIGN(4);
  71. *(.rodata*) /* Read-only data */
  72. . = ALIGN(4);
  73. } >rom
  74. /* C++ Static constructors/destructors, also used for
  75. * __attribute__((constructor)) and the likes.
  76. */
  77. .preinit_array : {
  78. . = ALIGN(4);
  79. __preinit_array_start = .;
  80. KEEP (*(.preinit_array))
  81. __preinit_array_end = .;
  82. } >rom
  83. .init_array : {
  84. . = ALIGN(4);
  85. __init_array_start = .;
  86. KEEP (*(SORT(.init_array.*)))
  87. KEEP (*(.init_array))
  88. __init_array_end = .;
  89. } >rom
  90. .fini_array : {
  91. . = ALIGN(4);
  92. __fini_array_start = .;
  93. KEEP (*(.fini_array))
  94. KEEP (*(SORT(.fini_array.*)))
  95. __fini_array_end = .;
  96. } >rom
  97. /*
  98. * Another section used by C++ stuff, appears when using newlib with
  99. * 64bit (long long) printf support
  100. */
  101. .ARM.extab : {
  102. *(.ARM.extab*)
  103. } >rom
  104. .ARM.exidx : {
  105. __exidx_start = .;
  106. *(.ARM.exidx*)
  107. __exidx_end = .;
  108. } >rom
  109. . = ALIGN(4);
  110. _etext = .;
  111. .data : {
  112. _data = .;
  113. *(.data*) /* Read-write initialized data */
  114. . = ALIGN(4);
  115. _edata = .;
  116. } >ram AT >rom
  117. _data_loadaddr = LOADADDR(.data);
  118. .bss : {
  119. *(.bss*) /* Read-write zero initialized data */
  120. *(COMMON)
  121. . = ALIGN(4);
  122. _ebss = .;
  123. } >ram
  124. #if defined(_CCM)
  125. .ccm : {
  126. *(.ccmram*)
  127. . = ALIGN(4);
  128. } >ccm
  129. #endif
  130. #if defined(_RAM1)
  131. .ram1 : {
  132. *(.ram1*)
  133. . = ALIGN(4);
  134. } >ram1
  135. #endif
  136. #if defined(_RAM2)
  137. .ram2 : {
  138. *(.ram2*)
  139. . = ALIGN(4);
  140. } >ram2
  141. #endif
  142. #if defined(_RAM3)
  143. .ram3 : {
  144. *(.ram3*)
  145. . = ALIGN(4);
  146. } >ram3
  147. #endif
  148. #if defined(_XSRAM)
  149. .xsram : {
  150. *(.xsram*)
  151. . = ALIGN(4);
  152. } >xsram
  153. #endif
  154. #if defined(_XDRAM)
  155. .xdram : {
  156. *(.xdram*)
  157. . = ALIGN(4);
  158. } >xdram
  159. #endif
  160. #if defined(_NFCRAM)
  161. .nfcram : {
  162. *(.nfcram*)
  163. . = ALIGN(4);
  164. } >nfcram
  165. #endif
  166. /*
  167. * The .eh_frame section appears to be used for C++ exception handling.
  168. * You may need to fix this if you're using C++.
  169. */
  170. /DISCARD/ : { *(.eh_frame) }
  171. . = ALIGN(4);
  172. end = .;
  173. }
  174. PROVIDE(_stack = ORIGIN(ram) + LENGTH(ram));