My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ldscript.ld 5.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. *****************************************************************************
  3. **
  4. ** File : ldscript.ld
  5. **
  6. ** Abstract : Linker script for STM32F401RETx Device with
  7. ** 512KByte FLASH, 96KByte RAM
  8. **
  9. ** Set heap size, stack size and stack location according
  10. ** to application requirements.
  11. **
  12. ** Set memory bank area and size if external memory is used.
  13. **
  14. ** Target : STMicroelectronics STM32
  15. **
  16. **
  17. ** Distribution: The file is distributed as is, without any warranty
  18. ** of any kind.
  19. **
  20. *****************************************************************************
  21. ** @attention
  22. **
  23. ** Copyright (c) 2014 Ac6
  24. **
  25. ** Redistribution and use in source and binary forms, with or without modification,
  26. ** are permitted provided that the following conditions are met:
  27. ** 1. Redistributions of source code must retain the above copyright notice,
  28. ** this list of conditions and the following disclaimer.
  29. ** 2. Redistributions in binary form must reproduce the above copyright notice,
  30. ** this list of conditions and the following disclaimer in the documentation
  31. ** and/or other materials provided with the distribution.
  32. ** 3. Neither the name of Ac6 nor the names of its contributors
  33. ** may be used to endorse or promote products derived from this software
  34. ** without specific prior written permission.
  35. **
  36. ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  37. ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  38. ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39. ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  40. ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  41. ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  42. ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  43. ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44. ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  45. ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  46. **
  47. *****************************************************************************
  48. */
  49. /* Entry Point */
  50. ENTRY(Reset_Handler)
  51. /* Highest address of the user mode stack */
  52. _estack = 0x20010000; /* end of RAM */
  53. /* Generate a link error if heap and stack don't fit into RAM */
  54. _Min_Heap_Size = 0x200; /* required amount of heap */
  55. _Min_Stack_Size = 0x400; /* required amount of stack */
  56. /* Specify the memory areas */
  57. MEMORY
  58. {
  59. BOOT (rx) : ORIGIN = 0x08000000, LENGTH = 16K
  60. EMULATED_EEPROM (rx) : ORIGIN = 0x08004000, LENGTH = 16K
  61. FLASH (rx) : ORIGIN = 0x08008000, LENGTH = 256K - 16K * 2
  62. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 64K
  63. }
  64. /* Define output sections */
  65. SECTIONS
  66. {
  67. /* The startup code goes first into FLASH */
  68. .isr_vector :
  69. {
  70. . = ALIGN(4);
  71. KEEP(*(.isr_vector)) /* Startup code */
  72. . = ALIGN(4);
  73. } >BOOT
  74. .boot :
  75. {
  76. . = ALIGN(4);
  77. *(.text.Reset_Handler)
  78. . = ALIGN(4);
  79. } >BOOT
  80. /* The program code and other data goes into FLASH */
  81. .text :
  82. {
  83. . = ALIGN(4);
  84. *(.text) /* .text sections (code) */
  85. *(.text*) /* .text* sections (code) */
  86. *(.glue_7) /* glue arm to thumb code */
  87. *(.glue_7t) /* glue thumb to arm code */
  88. *(.eh_frame)
  89. KEEP (*(.init))
  90. KEEP (*(.fini))
  91. . = ALIGN(4);
  92. _etext = .; /* define a global symbols at end of code */
  93. } >FLASH
  94. /* Constant data goes into FLASH */
  95. .rodata :
  96. {
  97. . = ALIGN(4);
  98. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  99. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  100. . = ALIGN(4);
  101. } >FLASH
  102. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  103. .ARM : {
  104. __exidx_start = .;
  105. *(.ARM.exidx*)
  106. __exidx_end = .;
  107. } >FLASH
  108. .preinit_array :
  109. {
  110. PROVIDE_HIDDEN (__preinit_array_start = .);
  111. KEEP (*(.preinit_array*))
  112. PROVIDE_HIDDEN (__preinit_array_end = .);
  113. } >FLASH
  114. .init_array :
  115. {
  116. PROVIDE_HIDDEN (__init_array_start = .);
  117. KEEP (*(SORT(.init_array.*)))
  118. KEEP (*(.init_array*))
  119. PROVIDE_HIDDEN (__init_array_end = .);
  120. } >FLASH
  121. .fini_array :
  122. {
  123. PROVIDE_HIDDEN (__fini_array_start = .);
  124. KEEP (*(SORT(.fini_array.*)))
  125. KEEP (*(.fini_array*))
  126. PROVIDE_HIDDEN (__fini_array_end = .);
  127. } >FLASH
  128. /* used by the startup to initialize data */
  129. _sidata = LOADADDR(.data);
  130. /* Initialized data sections goes into RAM, load LMA copy after code */
  131. .data :
  132. {
  133. . = ALIGN(4);
  134. _sdata = .; /* create a global symbol at data start */
  135. *(.data) /* .data sections */
  136. *(.data*) /* .data* sections */
  137. . = ALIGN(4);
  138. _edata = .; /* define a global symbol at data end */
  139. } >RAM AT> FLASH
  140. /* Uninitialized data section */
  141. . = ALIGN(4);
  142. .bss :
  143. {
  144. /* This is used by the startup in order to initialize the .bss secion */
  145. _sbss = .; /* define a global symbol at bss start */
  146. __bss_start__ = _sbss;
  147. *(.bss)
  148. *(.bss*)
  149. *(COMMON)
  150. . = ALIGN(4);
  151. _ebss = .; /* define a global symbol at bss end */
  152. __bss_end__ = _ebss;
  153. } >RAM
  154. /* User_heap_stack section, used to check that there is enough RAM left */
  155. ._user_heap_stack :
  156. {
  157. . = ALIGN(4);
  158. PROVIDE ( end = . );
  159. PROVIDE ( _end = . );
  160. . = . + _Min_Heap_Size;
  161. . = . + _Min_Stack_Size;
  162. . = ALIGN(4);
  163. } >RAM
  164. /* Remove information from the standard libraries */
  165. /DISCARD/ :
  166. {
  167. libc.a ( * )
  168. libm.a ( * )
  169. libgcc.a ( * )
  170. }
  171. .ARM.attributes 0 : { *(.ARM.attributes) }
  172. }