app.ld 4.9 KB

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