bl.ld 4.9 KB

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