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.

common.inc 5.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. /*
  2. * Linker script for libmaple.
  3. *
  4. * Original author "lanchon" from ST forums, with modifications by LeafLabs.
  5. */
  6. OUTPUT_FORMAT ("elf32-littlearm", "elf32-bigarm", "elf32-littlearm")
  7. /*
  8. * Configure other libraries we want in the link.
  9. *
  10. * libgcc, libc, and libm are common across supported toolchains.
  11. * However, some toolchains require additional archives which aren't
  12. * present everywhere (e.g. ARM's gcc-arm-embedded releases).
  13. *
  14. * To hack around this, we let the build system specify additional
  15. * archives by putting the right extra_libs.inc (in a directory under
  16. * toolchains/) in our search path.
  17. */
  18. GROUP(libgcc.a libc.a libm.a)
  19. INCLUDE extra_libs.inc
  20. /*
  21. * These force the linker to search for vector table symbols.
  22. *
  23. * These symbols vary by STM32 family (and also within families).
  24. * It's up to the build system to configure the link's search path
  25. * properly for the target MCU.
  26. */
  27. INCLUDE vector_symbols.inc
  28. /* STM32 vector table. */
  29. EXTERN(__stm32_vector_table)
  30. /* C runtime initialization function. */
  31. EXTERN(start_c)
  32. /* main entry point */
  33. EXTERN(main)
  34. /* Initial stack pointer value. */
  35. EXTERN(__msp_init)
  36. PROVIDE(__msp_init = ORIGIN(ram) + LENGTH(ram));
  37. /* Reset vector and chip reset entry point */
  38. EXTERN(__start__)
  39. ENTRY(__start__)
  40. PROVIDE(__exc_reset = __start__);
  41. /* Heap boundaries, for libmaple */
  42. EXTERN(_lm_heap_start);
  43. EXTERN(_lm_heap_end);
  44. SECTIONS
  45. {
  46. .text :
  47. {
  48. __text_start__ = .;
  49. /*
  50. * STM32 vector table. Leave this here. Yes, really.
  51. */
  52. *(.stm32.interrupt_vector)
  53. /*
  54. * Program code and vague linking
  55. */
  56. *(.text .text.* .gnu.linkonce.t.*)
  57. *(.plt)
  58. *(.gnu.warning)
  59. *(.glue_7t) *(.glue_7) *(.vfp11_veneer)
  60. *(.ARM.extab* .gnu.linkonce.armextab.*)
  61. *(.gcc_except_table)
  62. *(.eh_frame_hdr)
  63. *(.eh_frame)
  64. . = ALIGN(4);
  65. KEEP(*(.init))
  66. . = ALIGN(4);
  67. __preinit_array_start = .;
  68. KEEP (*(.preinit_array))
  69. __preinit_array_end = .;
  70. . = ALIGN(4);
  71. __init_array_start = .;
  72. KEEP (*(SORT(.init_array.*)))
  73. KEEP (*(.init_array))
  74. __init_array_end = .;
  75. . = ALIGN(0x4);
  76. KEEP (*crtbegin.o(.ctors))
  77. KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
  78. KEEP (*(SORT(.ctors.*)))
  79. KEEP (*crtend.o(.ctors))
  80. . = ALIGN(4);
  81. KEEP(*(.fini))
  82. . = ALIGN(4);
  83. __fini_array_start = .;
  84. KEEP (*(.fini_array))
  85. KEEP (*(SORT(.fini_array.*)))
  86. __fini_array_end = .;
  87. KEEP (*crtbegin.o(.dtors))
  88. KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
  89. KEEP (*(SORT(.dtors.*)))
  90. KEEP (*crtend.o(.dtors))
  91. } > REGION_TEXT
  92. /*
  93. * End of text
  94. */
  95. .text.align :
  96. {
  97. . = ALIGN(8);
  98. __text_end__ = .;
  99. } > REGION_TEXT
  100. /*
  101. * .ARM.exidx exception unwinding; mandated by ARM's C++ ABI
  102. */
  103. __exidx_start = .;
  104. .ARM.exidx :
  105. {
  106. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  107. } > REGION_RODATA
  108. __exidx_end = .;
  109. /*
  110. * .data
  111. */
  112. .data :
  113. {
  114. __data_start__ = .;
  115. LONG(0)
  116. . = ALIGN(8);
  117. *(.got.plt) *(.got)
  118. *(.data .data.* .gnu.linkonce.d.*)
  119. . = ALIGN(8);
  120. __data_end__ = .;
  121. } > REGION_DATA AT> REGION_RODATA
  122. /*
  123. * Read-only data
  124. */
  125. .rodata :
  126. {
  127. *(.rodata .rodata.* .gnu.linkonce.r.*)
  128. /* .USER_FLASH: We allow users to allocate into Flash here */
  129. *(.USER_FLASH)
  130. /* ROM image configuration; for C startup */
  131. . = ALIGN(4);
  132. _lm_rom_img_cfgp = .;
  133. LONG(LOADADDR(.data));
  134. /*
  135. * Heap: Linker scripts may choose a custom heap by overriding
  136. * _lm_heap_start and _lm_heap_end. Otherwise, the heap is in
  137. * internal SRAM, beginning after .bss, and growing towards
  138. * the stack.
  139. *
  140. * I'm shoving these here naively; there's probably a cleaner way
  141. * to go about this. [mbolivar]
  142. */
  143. _lm_heap_start = DEFINED(_lm_heap_start) ? _lm_heap_start : _end;
  144. _lm_heap_end = DEFINED(_lm_heap_end) ? _lm_heap_end : __msp_init;
  145. } > REGION_RODATA
  146. /*
  147. * .bss
  148. */
  149. .bss :
  150. {
  151. . = ALIGN(8);
  152. __bss_start__ = .;
  153. *(.bss .bss.* .gnu.linkonce.b.*)
  154. *(COMMON)
  155. . = ALIGN (8);
  156. __bss_end__ = .;
  157. _end = __bss_end__;
  158. } > REGION_BSS
  159. /*
  160. * Debugging sections
  161. */
  162. .stab 0 (NOLOAD) : { *(.stab) }
  163. .stabstr 0 (NOLOAD) : { *(.stabstr) }
  164. /* DWARF debug sections.
  165. * Symbols in the DWARF debugging sections are relative to the beginning
  166. * of the section so we begin them at 0. */
  167. /* DWARF 1 */
  168. .debug 0 : { *(.debug) }
  169. .line 0 : { *(.line) }
  170. /* GNU DWARF 1 extensions */
  171. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  172. .debug_sfnames 0 : { *(.debug_sfnames) }
  173. /* DWARF 1.1 and DWARF 2 */
  174. .debug_aranges 0 : { *(.debug_aranges) }
  175. .debug_pubnames 0 : { *(.debug_pubnames) }
  176. /* DWARF 2 */
  177. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  178. .debug_abbrev 0 : { *(.debug_abbrev) }
  179. .debug_line 0 : { *(.debug_line) }
  180. .debug_frame 0 : { *(.debug_frame) }
  181. .debug_str 0 : { *(.debug_str) }
  182. .debug_loc 0 : { *(.debug_loc) }
  183. .debug_macinfo 0 : { *(.debug_macinfo) }
  184. /* SGI/MIPS DWARF 2 extensions */
  185. .debug_weaknames 0 : { *(.debug_weaknames) }
  186. .debug_funcnames 0 : { *(.debug_funcnames) }
  187. .debug_typenames 0 : { *(.debug_typenames) }
  188. .debug_varnames 0 : { *(.debug_varnames) }
  189. .note.gnu.arm.ident 0 : { KEEP (*(.note.gnu.arm.ident)) }
  190. .ARM.attributes 0 : { KEEP (*(.ARM.attributes)) }
  191. /DISCARD/ : { *(.note.GNU-stack) }
  192. }