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 6.1KB

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