Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

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