bl.ld 4.9 KB

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