app.ld 5.1 KB

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