Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

195 lines
4.1KB

  1. /* Linker script to configure memory regions.
  2. * Need modifying for a specific board.
  3. * FLASH.ORIGIN: starting address of flash
  4. * FLASH.LENGTH: length of flash
  5. * RAM.ORIGIN: starting address of RAM bank 0
  6. * RAM.LENGTH: length of RAM bank 0
  7. */
  8. MEMORY
  9. {
  10. FLASH (rx) : ORIGIN = 0x0, LENGTH = 0x20000 /* 128K */
  11. RAM (rwx) : ORIGIN = 0x10000000, LENGTH = 0x2000 /* 8K */
  12. }
  13. /* Linker script to place sections and symbol values. Should be used together
  14. * with other linker script that defines memory regions FLASH and RAM.
  15. * It references following symbols, which must be defined in code:
  16. * Reset_Handler : Entry of reset handler
  17. *
  18. * It defines following symbols, which code can use without definition:
  19. * __exidx_start
  20. * __exidx_end
  21. * __copy_table_start__
  22. * __copy_table_end__
  23. * __zero_table_start__
  24. * __zero_table_end__
  25. * __etext
  26. * __data_start__
  27. * __preinit_array_start
  28. * __preinit_array_end
  29. * __init_array_start
  30. * __init_array_end
  31. * __fini_array_start
  32. * __fini_array_end
  33. * __data_end__
  34. * __bss_start__
  35. * __bss_end__
  36. * __end__
  37. * end
  38. * __HeapLimit
  39. * __StackLimit
  40. * __StackTop
  41. * __stack
  42. */
  43. ENTRY(Reset_Handler)
  44. SECTIONS
  45. {
  46. .text :
  47. {
  48. KEEP(*(.isr_vector))
  49. *(.text*)
  50. *(.init)
  51. *(.fini)
  52. /* .ctors */
  53. *crtbegin.o(.ctors)
  54. *crtbegin?.o(.ctors)
  55. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  56. *(SORT(.ctors.*))
  57. *(.ctors)
  58. /* .dtors */
  59. *crtbegin.o(.dtors)
  60. *crtbegin?.o(.dtors)
  61. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
  62. *(SORT(.dtors.*))
  63. *(.dtors)
  64. *(.rodata*)
  65. *(.eh_frame*)
  66. } > FLASH
  67. .ARM.extab :
  68. {
  69. *(.ARM.extab* .gnu.linkonce.armextab.*)
  70. } > FLASH
  71. __exidx_start = .;
  72. .ARM.exidx :
  73. {
  74. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  75. } > FLASH
  76. __exidx_end = .;
  77. /* To copy multiple ROM to RAM sections,
  78. * uncomment .copy.table section and,
  79. * define __STARTUP_COPY_MULTIPLE in startup_ARMCMx.S */
  80. /*
  81. .copy.table :
  82. {
  83. . = ALIGN(4);
  84. __copy_table_start__ = .;
  85. LONG (__etext)
  86. LONG (__data_start__)
  87. LONG (__data_end__ - __data_start__)
  88. LONG (__etext2)
  89. LONG (__data2_start__)
  90. LONG (__data2_end__ - __data2_start__)
  91. __copy_table_end__ = .;
  92. } > FLASH
  93. */
  94. /* To clear multiple BSS sections,
  95. * uncomment .zero.table section and,
  96. * define __STARTUP_CLEAR_BSS_MULTIPLE in startup_ARMCMx.S */
  97. /*
  98. .zero.table :
  99. {
  100. . = ALIGN(4);
  101. __zero_table_start__ = .;
  102. LONG (__bss_start__)
  103. LONG (__bss_end__ - __bss_start__)
  104. LONG (__bss2_start__)
  105. LONG (__bss2_end__ - __bss2_start__)
  106. __zero_table_end__ = .;
  107. } > FLASH
  108. */
  109. /* Location counter can end up 2byte aligned with narrow Thumb code but
  110. __etext is assumed by startup code to be the LMA of a section in RAM
  111. which must be 4byte aligned */
  112. __etext = ALIGN (4);
  113. .data : AT (__etext)
  114. {
  115. __data_start__ = .;
  116. *(vtable)
  117. *(.data*)
  118. . = ALIGN(4);
  119. /* preinit data */
  120. PROVIDE_HIDDEN (__preinit_array_start = .);
  121. *(.preinit_array)
  122. PROVIDE_HIDDEN (__preinit_array_end = .);
  123. . = ALIGN(4);
  124. /* init data */
  125. PROVIDE_HIDDEN (__init_array_start = .);
  126. *(SORT(.init_array.*))
  127. *(.init_array)
  128. PROVIDE_HIDDEN (__init_array_end = .);
  129. . = ALIGN(4);
  130. /* finit data */
  131. PROVIDE_HIDDEN (__fini_array_start = .);
  132. *(SORT(.fini_array.*))
  133. *(.fini_array)
  134. PROVIDE_HIDDEN (__fini_array_end = .);
  135. *(.jcr)
  136. . = ALIGN(4);
  137. /* All data end */
  138. __data_end__ = .;
  139. } > RAM
  140. .bss :
  141. {
  142. . = ALIGN(4);
  143. __bss_start__ = .;
  144. *(.bss*)
  145. *(COMMON)
  146. . = ALIGN(4);
  147. __bss_end__ = .;
  148. } > RAM
  149. .heap (COPY):
  150. {
  151. __end__ = .;
  152. PROVIDE(end = .);
  153. *(.heap*)
  154. __HeapLimit = .;
  155. } > RAM
  156. /* .stack_dummy section doesn't contains any symbols. It is only
  157. * used for linker to calculate size of stack sections, and assign
  158. * values to stack symbols later */
  159. .stack_dummy (COPY):
  160. {
  161. *(.stack*)
  162. } > RAM
  163. /* Set stack top to end of RAM, and stack limit move down by
  164. * size of stack_dummy section */
  165. __StackTop = ORIGIN(RAM) + LENGTH(RAM);
  166. __StackLimit = __StackTop - SIZEOF(.stack_dummy);
  167. PROVIDE(__stack = __StackTop);
  168. /* Check if data + heap + stack exceeds RAM limit */
  169. ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
  170. }