mk20dx256.ld 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. /* Teensyduino Core Library
  2. * http://www.pjrc.com/teensy/
  3. * Copyright (c) 2013 PJRC.COM, LLC.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining
  6. * a copy of this software and associated documentation files (the
  7. * "Software"), to deal in the Software without restriction, including
  8. * without limitation the rights to use, copy, modify, merge, publish,
  9. * distribute, sublicense, and/or sell copies of the Software, and to
  10. * permit persons to whom the Software is furnished to do so, subject to
  11. * the following conditions:
  12. *
  13. * 1. The above copyright notice and this permission notice shall be
  14. * included in all copies or substantial portions of the Software.
  15. *
  16. * 2. If the Software is incorporated into a build system that allows
  17. * selection among a list of target devices, then similar target
  18. * devices manufactured by PJRC.COM must be included in the list of
  19. * target devices and selectable in the same manner.
  20. *
  21. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  22. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  23. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  24. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  25. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  26. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  27. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  28. * SOFTWARE.
  29. */
  30. MEMORY
  31. {
  32. FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 256K
  33. RAM (rwx) : ORIGIN = 0x1FFF8000, LENGTH = 64K
  34. }
  35. /* produce a link error if there is not this amount of RAM for these sections */
  36. _minimum_stack_size = 2K;
  37. _minimum_heap_size = 16K;
  38. /* INCLUDE common.ld */
  39. /* Teensyduino Core Library
  40. * http://www.pjrc.com/teensy/
  41. * Copyright (c) 2013 PJRC.COM, LLC.
  42. *
  43. * Permission is hereby granted, free of charge, to any person obtaining
  44. * a copy of this software and associated documentation files (the
  45. * "Software"), to deal in the Software without restriction, including
  46. * without limitation the rights to use, copy, modify, merge, publish,
  47. * distribute, sublicense, and/or sell copies of the Software, and to
  48. * permit persons to whom the Software is furnished to do so, subject to
  49. * the following conditions:
  50. *
  51. * 1. The above copyright notice and this permission notice shall be
  52. * included in all copies or substantial portions of the Software.
  53. *
  54. * 2. If the Software is incorporated into a build system that allows
  55. * selection among a list of target devices, then similar target
  56. * devices manufactured by PJRC.COM must be included in the list of
  57. * target devices and selectable in the same manner.
  58. *
  59. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  60. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  61. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  62. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  63. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  64. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  65. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  66. * SOFTWARE.
  67. */
  68. SECTIONS
  69. {
  70. .text : {
  71. . = 0;
  72. KEEP(*(.vectors))
  73. *(.startup*)
  74. /* TODO: does linker detect startup overflow onto flashconfig? */
  75. . = 0x400;
  76. KEEP(*(.flashconfig*))
  77. *(.text*)
  78. *(.rodata*)
  79. . = ALIGN(4);
  80. KEEP(*(.init))
  81. . = ALIGN(4);
  82. __preinit_array_start = .;
  83. KEEP (*(.preinit_array))
  84. __preinit_array_end = .;
  85. __init_array_start = .;
  86. KEEP (*(SORT(.init_array.*)))
  87. KEEP (*(.init_array))
  88. __init_array_end = .;
  89. } > FLASH = 0xFF
  90. .ARM.exidx : {
  91. __exidx_start = .;
  92. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  93. __exidx_end = .;
  94. } > FLASH
  95. _etext = .;
  96. .usbdescriptortable (NOLOAD) : {
  97. /* . = ORIGIN(RAM); */
  98. . = ALIGN(512);
  99. *(.usbdescriptortable*)
  100. } > RAM
  101. .dmabuffers (NOLOAD) : {
  102. . = ALIGN(4);
  103. *(.dmabuffers*)
  104. } > RAM
  105. .usbbuffers (NOLOAD) : {
  106. . = ALIGN(4);
  107. *(.usbbuffers*)
  108. } > RAM
  109. /* used by the startup to initialize data */
  110. _sidata = LOADADDR(.data);
  111. .data : AT (_etext) {
  112. . = ALIGN(4);
  113. _sdata = .;
  114. _ram_start = .;
  115. *(.data*)
  116. . = ALIGN(4);
  117. _edata = .;
  118. } > RAM
  119. /*
  120. * _staticfs is the place in flash where the static filesystem which
  121. * is concatenated to the .hex file will wind up.
  122. */
  123. _staticfs = LOADADDR(.data) + SIZEOF(.data);
  124. .noinit (NOLOAD) : {
  125. *(.noinit*)
  126. } > RAM
  127. .bss : {
  128. . = ALIGN(4);
  129. _sbss = .;
  130. *(.bss*)
  131. *(COMMON)
  132. . = ALIGN(4);
  133. _ebss = .;
  134. __bss_end = .;
  135. } > RAM
  136. /* this is to define the start of the heap, and make sure we have a minimum size */
  137. .heap :
  138. {
  139. . = ALIGN(4);
  140. _heap_start = .; /* define a global symbol at heap start */
  141. . = . + _minimum_heap_size;
  142. } >RAM
  143. /* this just checks there is enough RAM for the stack */
  144. .stack :
  145. {
  146. . = ALIGN(4);
  147. . = . + _minimum_stack_size;
  148. . = ALIGN(4);
  149. } >RAM
  150. _estack = ORIGIN(RAM) + LENGTH(RAM);
  151. _ram_end = ORIGIN(RAM) + LENGTH(RAM);
  152. _heap_end = ORIGIN(RAM) + 0xe000;
  153. }