K64FN1M0xxx12.ld 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. /*
  2. * K64F ARM GCC linker script file
  3. */
  4. MEMORY
  5. {
  6. VECTORS (rx) : ORIGIN = 0x00000000, LENGTH = 0x00000400
  7. FLASH_PROTECTION (rx) : ORIGIN = 0x00000400, LENGTH = 0x00000010
  8. FLASH (rx) : ORIGIN = 0x00000410, LENGTH = 0x00100000 - 0x00000410
  9. RAM (rwx) : ORIGIN = 0x1FFF0198, LENGTH = 0x00040000 - 0x00000198
  10. }
  11. /* Linker script to place sections and symbol values. Should be used together
  12. * with other linker script that defines memory regions FLASH and RAM.
  13. * It references following symbols, which must be defined in code:
  14. * _reset_init : Entry of reset handler
  15. *
  16. * It defines following symbols, which code can use without definition:
  17. * __exidx_start
  18. * __exidx_end
  19. * __etext
  20. * __data_start__
  21. * __preinit_array_start
  22. * __preinit_array_end
  23. * __init_array_start
  24. * __init_array_end
  25. * __fini_array_start
  26. * __fini_array_end
  27. * __data_end__
  28. * __bss_start__
  29. * __bss_end__
  30. * __end__
  31. * end
  32. * __HeapLimit
  33. * __StackLimit
  34. * __StackTop
  35. * __stack
  36. */
  37. ENTRY(Reset_Handler)
  38. SECTIONS
  39. {
  40. .isr_vector :
  41. {
  42. __vector_table = .;
  43. KEEP(*(.vector_table))
  44. *(.text.Reset_Handler)
  45. *(.text.System_Init)
  46. . = ALIGN(4);
  47. } > VECTORS
  48. .flash_protect :
  49. {
  50. KEEP(*(.kinetis_flash_config_field))
  51. . = ALIGN(4);
  52. } > FLASH_PROTECTION
  53. .text :
  54. {
  55. *(.text*)
  56. KEEP(*(.init))
  57. KEEP(*(.fini))
  58. /* .ctors */
  59. *crtbegin.o(.ctors)
  60. *crtbegin?.o(.ctors)
  61. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  62. *(SORT(.ctors.*))
  63. *(.ctors)
  64. /* .dtors */
  65. *crtbegin.o(.dtors)
  66. *crtbegin?.o(.dtors)
  67. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
  68. *(SORT(.dtors.*))
  69. *(.dtors)
  70. *(.rodata*)
  71. /* section information for finsh shell */
  72. . = ALIGN(4);
  73. __fsymtab_start = .;
  74. KEEP(*(FSymTab))
  75. __fsymtab_end = .;
  76. . = ALIGN(4);
  77. __vsymtab_start = .;
  78. KEEP(*(VSymTab))
  79. __vsymtab_end = .;
  80. . = ALIGN(4);
  81. /* section information for initial. */
  82. . = ALIGN(4);
  83. __rt_init_start = .;
  84. KEEP(*(SORT(.rti_fn*)))
  85. __rt_init_end = .;
  86. . = ALIGN(4);
  87. . = ALIGN(4);
  88. _etext = .;
  89. KEEP(*(.eh_frame*))
  90. } > FLASH
  91. .ARM.extab :
  92. {
  93. *(.ARM.extab* .gnu.linkonce.armextab.*)
  94. } > FLASH
  95. __exidx_start = .;
  96. .ARM.exidx :
  97. {
  98. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  99. } > FLASH
  100. __exidx_end = .;
  101. __etext = .;
  102. .data : AT (__etext)
  103. {
  104. __data_start__ = .;
  105. *(vtable)
  106. *(.data*)
  107. . = ALIGN(4);
  108. /* preinit data */
  109. PROVIDE_HIDDEN (__preinit_array_start = .);
  110. KEEP(*(.preinit_array))
  111. PROVIDE_HIDDEN (__preinit_array_end = .);
  112. . = ALIGN(4);
  113. /* init data */
  114. PROVIDE_HIDDEN (__init_array_start = .);
  115. KEEP(*(SORT(.init_array.*)))
  116. KEEP(*(.init_array))
  117. PROVIDE_HIDDEN (__init_array_end = .);
  118. . = ALIGN(4);
  119. /* finit data */
  120. PROVIDE_HIDDEN (__fini_array_start = .);
  121. KEEP(*(SORT(.fini_array.*)))
  122. KEEP(*(.fini_array))
  123. PROVIDE_HIDDEN (__fini_array_end = .);
  124. . = ALIGN(4);
  125. /* All data end */
  126. __data_end__ = .;
  127. } > RAM
  128. __bss_start = .;
  129. .bss :
  130. {
  131. __bss_start__ = .;
  132. *(.bss*)
  133. *(COMMON)
  134. __bss_end__ = .;
  135. } > RAM
  136. __bss_end = .;
  137. .heap :
  138. {
  139. __end__ = .;
  140. end = __end__;
  141. *(.heap*)
  142. __HeapLimit = .;
  143. } > RAM
  144. /* .stack_dummy section doesn't contains any symbols. It is only
  145. * used for linker to calculate size of stack sections, and assign
  146. * values to stack symbols later */
  147. .stack_dummy :
  148. {
  149. *(.stack)
  150. } > RAM
  151. /* Set stack top to end of RAM, and stack limit move down by
  152. * size of stack_dummy section */
  153. __StackTop = ORIGIN(RAM) + LENGTH(RAM);
  154. __StackLimit = __StackTop - SIZEOF(.stack_dummy);
  155. PROVIDE(__stack = __StackTop);
  156. /* Check if data + heap + stack exceeds RAM limit */
  157. ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack")
  158. }