app.ld 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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 = 3008K
  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. /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
  94. ._user_heap_stack :
  95. {
  96. . = ALIGN(8);
  97. PROVIDE ( end = . );
  98. PROVIDE ( _end = . );
  99. . = . + _Min_Heap_Size;
  100. . = . + _Min_Stack_Size;
  101. . = ALIGN(8);
  102. } >RAM
  103. /* Initialized data sections into "RAM" Ram type memory */
  104. /* Used by the startup to initialize data */
  105. _sidata = LOADADDR(.data);
  106. .data :
  107. {
  108. . = ALIGN(4);
  109. _sdata = .; /* create a global symbol at data start */
  110. *(.data) /* .data sections */
  111. *(.data*) /* .data* sections */
  112. *(.RamFunc) /* .RamFunc sections */
  113. *(.RamFunc*) /* .RamFunc* sections */
  114. . = ALIGN(4);
  115. _edata = .; /* define a global symbol at data end */
  116. } >RAM AT> FLASH
  117. /* Uninitialized data section into "RAM" Ram type memory */
  118. . = ALIGN(4);
  119. .bss :
  120. {
  121. /* This is used by the startup in order to initialize the .bss section */
  122. _sbss = .; /* define a global symbol at bss start */
  123. __bss_start__ = _sbss;
  124. *(.bss)
  125. *(.bss*)
  126. *(COMMON)
  127. . = ALIGN(4);
  128. _ebss = .; /* define a global symbol at bss end */
  129. __bss_end__ = _ebss;
  130. } >RAM
  131. . = ALIGN(16);
  132. __os_heap_start = .;
  133. /* Remove information from the compiler libraries */
  134. /DISCARD/ :
  135. {
  136. libc.a ( * )
  137. libm.a ( * )
  138. libgcc.a ( * )
  139. }
  140. .ARM.attributes 0 : { *(.ARM.attributes) }
  141. }