rules.ld 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223
  1. /*
  2. ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. __stacks_total_size__ = __und_stack_size__ + __abt_stack_size__ + __fiq_stack_size__ + __irq_stack_size__ + __svc_stack_size__ + __sys_stack_size__;
  14. __ram0_start__ = ORIGIN(ram0);
  15. __ram0_size__ = LENGTH(ram0);
  16. __ram0_end__ = __ram0_start__ + __ram0_size__;
  17. __ram1_start__ = ORIGIN(ram1);
  18. __ram1_size__ = LENGTH(ram1);
  19. __ram1_end__ = __ram1_start__ + __ram1_size__;
  20. __ram2_start__ = ORIGIN(ram2);
  21. __ram2_size__ = LENGTH(ram2);
  22. __ram2_end__ = __ram2_start__ + __ram2_size__;
  23. __ram3_start__ = ORIGIN(ram3);
  24. __ram3_size__ = LENGTH(ram3);
  25. __ram3_end__ = __ram3_start__ + __ram3_size__;
  26. __ram4_start__ = ORIGIN(ram4);
  27. __ram4_size__ = LENGTH(ram4);
  28. __ram4_end__ = __ram4_start__ + __ram4_size__;
  29. __ram5_start__ = ORIGIN(ram5);
  30. __ram5_size__ = LENGTH(ram5);
  31. __ram5_end__ = __ram5_start__ + __ram5_size__;
  32. __ram6_start__ = ORIGIN(ram6);
  33. __ram6_size__ = LENGTH(ram6);
  34. __ram6_end__ = __ram6_start__ + __ram6_size__;
  35. __ram7_start__ = ORIGIN(ram7);
  36. __ram7_size__ = LENGTH(ram7);
  37. __ram7_end__ = __ram7_start__ + __ram7_size__;
  38. ENTRY(Reset_Handler)
  39. SECTIONS
  40. {
  41. . = 0;
  42. _text = .;
  43. startup : ALIGN(16)
  44. {
  45. KEEP(*(.vectors))
  46. KEEP(*(.boot))
  47. } > flash
  48. constructors : ALIGN(4)
  49. {
  50. PROVIDE(__init_array_start = .);
  51. KEEP(*(SORT(.init_array.*)))
  52. KEEP(*(.init_array))
  53. PROVIDE(__init_array_end = .);
  54. } > flash
  55. destructors : ALIGN(4)
  56. {
  57. PROVIDE(__fini_array_start = .);
  58. KEEP(*(.fini_array))
  59. KEEP(*(SORT(.fini_array.*)))
  60. PROVIDE(__fini_array_end = .);
  61. } > flash
  62. .text : ALIGN(16)
  63. {
  64. *(.text)
  65. *(.text.*)
  66. *(.rodata)
  67. *(.rodata.*)
  68. *(.glue_7t)
  69. *(.glue_7)
  70. *(.gcc*)
  71. } > flash
  72. .ARM.extab :
  73. {
  74. *(.ARM.extab* .gnu.linkonce.armextab.*)
  75. } > flash
  76. .ARM.exidx : {
  77. PROVIDE(__exidx_start = .);
  78. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  79. PROVIDE(__exidx_end = .);
  80. } > flash
  81. .eh_frame_hdr :
  82. {
  83. *(.eh_frame_hdr)
  84. } > flash
  85. .eh_frame : ONLY_IF_RO
  86. {
  87. *(.eh_frame)
  88. } > flash
  89. .textalign : ONLY_IF_RO
  90. {
  91. . = ALIGN(8);
  92. } > flash
  93. . = ALIGN(4);
  94. _etext = .;
  95. _textdata = _etext;
  96. .stacks (NOLOAD) :
  97. {
  98. . = ALIGN(8);
  99. __stacks_base__ = .;
  100. __main_thread_stack_base__ = .;
  101. . += __stacks_total_size__;
  102. . = ALIGN(8);
  103. __stacks_end__ = .;
  104. } > STACKS_RAM
  105. .data : ALIGN(4)
  106. {
  107. . = ALIGN(4);
  108. PROVIDE(_data = .);
  109. *(.data)
  110. *(.data.*)
  111. *(.ramtext)
  112. . = ALIGN(4);
  113. PROVIDE(_edata = .);
  114. } > DATA_RAM AT > flash
  115. .bss (NOLOAD) : ALIGN(4)
  116. {
  117. . = ALIGN(4);
  118. PROVIDE(_bss_start = .);
  119. *(.bss)
  120. *(.bss.*)
  121. *(COMMON)
  122. . = ALIGN(4);
  123. PROVIDE(_bss_end = .);
  124. PROVIDE(end = .);
  125. } > BSS_RAM
  126. .ram0 (NOLOAD) : ALIGN(4)
  127. {
  128. . = ALIGN(4);
  129. *(.ram0)
  130. *(.ram0.*)
  131. . = ALIGN(4);
  132. __ram0_free__ = .;
  133. } > ram0
  134. .ram1 (NOLOAD) : ALIGN(4)
  135. {
  136. . = ALIGN(4);
  137. *(.ram1)
  138. *(.ram1.*)
  139. . = ALIGN(4);
  140. __ram1_free__ = .;
  141. } > ram1
  142. .ram2 (NOLOAD) : ALIGN(4)
  143. {
  144. . = ALIGN(4);
  145. *(.ram2)
  146. *(.ram2.*)
  147. . = ALIGN(4);
  148. __ram2_free__ = .;
  149. } > ram2
  150. .ram3 (NOLOAD) : ALIGN(4)
  151. {
  152. . = ALIGN(4);
  153. *(.ram3)
  154. *(.ram3.*)
  155. . = ALIGN(4);
  156. __ram3_free__ = .;
  157. } > ram3
  158. .ram4 (NOLOAD) : ALIGN(4)
  159. {
  160. . = ALIGN(4);
  161. *(.ram4)
  162. *(.ram4.*)
  163. . = ALIGN(4);
  164. __ram4_free__ = .;
  165. } > ram4
  166. .ram5 (NOLOAD) : ALIGN(4)
  167. {
  168. . = ALIGN(4);
  169. *(.ram5)
  170. *(.ram5.*)
  171. . = ALIGN(4);
  172. __ram5_free__ = .;
  173. } > ram5
  174. .ram6 (NOLOAD) : ALIGN(4)
  175. {
  176. . = ALIGN(4);
  177. *(.ram6)
  178. *(.ram6.*)
  179. . = ALIGN(4);
  180. __ram6_free__ = .;
  181. } > ram6
  182. .ram7 (NOLOAD) : ALIGN(4)
  183. {
  184. . = ALIGN(4);
  185. *(.ram7)
  186. *(.ram7.*)
  187. . = ALIGN(4);
  188. __ram7_free__ = .;
  189. } > ram7
  190. }
  191. /* Heap default boundaries, it is defaulted to be the non-used part
  192. of ram0 region.*/
  193. __heap_base__ = __ram0_free__;
  194. __heap_end__ = __ram0_end__;