bl.ld 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /* Entry Point */
  2. ENTRY(Reset_Handler)
  3. _stext = ORIGIN(CODE);
  4. _Min_Heap_Size = 0 ; /* required amount of heap */
  5. _Min_Stack_Size = 0x4000 ; /* required amount of stack */
  6. _estack = ORIGIN(RAM) + _Min_Stack_Size + _Min_Heap_Size; /* start of "RAM" Ram type memory */
  7. _sstack = ORIGIN(RAM); /* start of "RAM" Ram type memory */
  8. __ram_end = ORIGIN(RAM) + LENGTH(RAM);
  9. /* Memories definition */
  10. MEMORY
  11. {
  12. RAM (xrw) : ORIGIN = 0x20010000, LENGTH = 576K
  13. CODE (rx) : ORIGIN = 0x20000400, LENGTH = 63K
  14. FLASH (rx) : ORIGIN = 0x01001000, LENGTH = 56K
  15. }
  16. /* Sections */
  17. SECTIONS
  18. {
  19. /* The startup code into "FLASH" Rom type memory */
  20. .isr_vector :
  21. {
  22. . = ALIGN(4);
  23. __isr_start_address = .;
  24. KEEP(*(.isr_vector)) /* Startup code */
  25. . = ALIGN(4);
  26. } >FLASH
  27. /* The program code and other data into "FLASH" Rom type memory */
  28. .start :
  29. {
  30. . = ALIGN(4);
  31. *startup_full.o(.text .text.*)
  32. *startup_full.s.o(.text .text.*)
  33. *startup_run_in_ram.o(.text .text.*)
  34. *startup_run_in_ram.s.o(.text .text.*)
  35. } >FLASH
  36. _sitext = LOADADDR(.text);
  37. .text :
  38. {
  39. . = ALIGN(4);
  40. _sstext = .;
  41. *(.text) /* .text sections (code) */
  42. *(.text*) /* .text* sections (code) */
  43. *(.glue_7) /* glue arm to thumb code */
  44. *(.glue_7t) /* glue thumb to arm code */
  45. *(.eh_frame)
  46. KEEP (*(.init))
  47. KEEP (*(.fini))
  48. . = ALIGN(4);
  49. _etext = .; /* define a global symbols at end of code */
  50. } >CODE AT> FLASH
  51. /* Constant data into "FLASH" Rom type memory */
  52. .rodata :
  53. {
  54. . = ALIGN(4);
  55. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  56. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  57. . = ALIGN(4);
  58. } >CODE AT> FLASH
  59. .ARM.extab : {
  60. . = ALIGN(4);
  61. *(.ARM.extab* .gnu.linkonce.armextab.*)
  62. . = ALIGN(4);
  63. } >CODE AT> FLASH
  64. .ARM : {
  65. . = ALIGN(4);
  66. __exidx_start = .;
  67. *(.ARM.exidx*)
  68. __exidx_end = .;
  69. . = ALIGN(4);
  70. } >CODE AT> FLASH
  71. .preinit_array :
  72. {
  73. . = ALIGN(4);
  74. PROVIDE_HIDDEN (__preinit_array_start = .);
  75. KEEP (*(.preinit_array*))
  76. PROVIDE_HIDDEN (__preinit_array_end = .);
  77. . = ALIGN(4);
  78. } >CODE AT> FLASH
  79. .init_array :
  80. {
  81. . = ALIGN(4);
  82. PROVIDE_HIDDEN (__init_array_start = .);
  83. KEEP (*(SORT(.init_array.*)))
  84. KEEP (*(.init_array*))
  85. PROVIDE_HIDDEN (__init_array_end = .);
  86. . = ALIGN(4);
  87. } >CODE AT> FLASH
  88. .fini_array :
  89. {
  90. . = ALIGN(4);
  91. PROVIDE_HIDDEN (__fini_array_start = .);
  92. KEEP (*(SORT(.fini_array.*)))
  93. KEEP (*(.fini_array*))
  94. PROVIDE_HIDDEN (__fini_array_end = .);
  95. . = ALIGN(4);
  96. } >CODE AT> FLASH
  97. .preinit_fun_array :
  98. {
  99. . = ALIGN(4);
  100. __preinit_fun_array_start = .;
  101. KEEP (*(SORT(.preinit_fun_array.*)))
  102. KEEP (*(.preinit_fun_array*))
  103. __preinit_fun_array_end = .;
  104. . = ALIGN(4);
  105. } >CODE AT> FLASH
  106. .init_fun_array :
  107. {
  108. . = ALIGN(4);
  109. __init_fun_array_start = .;
  110. KEEP (*(SORT(.init_fun_array.*)))
  111. KEEP (*(.init_fun_array*))
  112. __init_fun_array_end = .;
  113. . = ALIGN(4);
  114. } >CODE AT> FLASH
  115. .task_fun_array :
  116. {
  117. . = ALIGN(4);
  118. __task_fun_array_start = .;
  119. KEEP (*(SORT(.task_fun_array.*)))
  120. KEEP (*(.task_fun_array*))
  121. __task_fun_array_end = .;
  122. . = ALIGN(4);
  123. _setext = .;
  124. } >CODE AT> FLASH
  125. /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
  126. ._user_heap_stack :
  127. {
  128. . = ALIGN(8);
  129. PROVIDE ( end = . );
  130. PROVIDE ( _end = . );
  131. . = . + _Min_Heap_Size;
  132. . = . + _Min_Stack_Size;
  133. . = ALIGN(8);
  134. } >RAM
  135. /* Used by the startup to initialize data */
  136. _sidata = LOADADDR(.data);
  137. /* Initialized data sections into "RAM" Ram type memory */
  138. .data :
  139. {
  140. . = ALIGN(4);
  141. _sdata = .; /* create a global symbol at data start */
  142. *(.data) /* .data sections */
  143. *(.data*) /* .data* sections */
  144. *(.RamFunc) /* .RamFunc sections */
  145. *(.RamFunc*) /* .RamFunc* sections */
  146. . = ALIGN(4);
  147. _edata = .; /* define a global symbol at data end */
  148. } >RAM AT> FLASH
  149. /* Uninitialized data section into "RAM" Ram type memory */
  150. . = ALIGN(4);
  151. .bss :
  152. {
  153. /* This is used by the startup in order to initialize the .bss section */
  154. _sbss = .; /* define a global symbol at bss start */
  155. __bss_start__ = _sbss;
  156. *(.bss)
  157. *(.bss*)
  158. *(COMMON)
  159. . = ALIGN(4);
  160. _ebss = .; /* define a global symbol at bss end */
  161. __bss_end__ = _ebss;
  162. } >RAM
  163. /* .no_init (NOLOAD):
  164. {
  165. . = _sstack;
  166. _enoinitdata = .;
  167. } >RAM */
  168. . = ALIGN(16);
  169. __os_heap_start = .;
  170. /* Remove information from the compiler libraries */
  171. /DISCARD/ :
  172. {
  173. libc.a ( * )
  174. libm.a ( * )
  175. libgcc.a ( * )
  176. }
  177. .ARM.attributes 0 : { *(.ARM.attributes) }
  178. }