full.ld 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 = 0x8000 ; /* 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 = 0x01001000, LENGTH = 4092K
  15. }
  16. /* Sections */
  17. SECTIONS
  18. {
  19. /* The startup code into "FLASH" Rom type memory */
  20. .isr_vector :
  21. {
  22. . = ALIGN(4);
  23. __isr_start_address = .;
  24. KEEP(*(.isr_vector)) /* Startup code */
  25. . = ALIGN(4);
  26. } >FLASH
  27. /* The program code and other data into "FLASH" Rom type memory */
  28. .text :
  29. {
  30. . = ALIGN(4);
  31. *(.text) /* .text sections (code) */
  32. *(.text*) /* .text* sections (code) */
  33. *(.glue_7) /* glue arm to thumb code */
  34. *(.glue_7t) /* glue thumb to arm code */
  35. *(.eh_frame)
  36. KEEP (*(.init))
  37. KEEP (*(.fini))
  38. . = ALIGN(4);
  39. _etext = .; /* define a global symbols at end of code */
  40. } >FLASH
  41. /* Constant data into "FLASH" Rom type memory */
  42. .rodata :
  43. {
  44. . = ALIGN(4);
  45. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  46. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  47. . = ALIGN(4);
  48. } >FLASH
  49. .ARM.extab : {
  50. . = ALIGN(4);
  51. *(.ARM.extab* .gnu.linkonce.armextab.*)
  52. . = ALIGN(4);
  53. } >FLASH
  54. .ARM : {
  55. . = ALIGN(4);
  56. __exidx_start = .;
  57. *(.ARM.exidx*)
  58. __exidx_end = .;
  59. . = ALIGN(4);
  60. } >FLASH
  61. .preinit_array :
  62. {
  63. . = ALIGN(4);
  64. PROVIDE_HIDDEN (__preinit_array_start = .);
  65. KEEP (*(.preinit_array*))
  66. PROVIDE_HIDDEN (__preinit_array_end = .);
  67. . = ALIGN(4);
  68. } >FLASH
  69. .init_array :
  70. {
  71. . = ALIGN(4);
  72. PROVIDE_HIDDEN (__init_array_start = .);
  73. KEEP (*(SORT(.init_array.*)))
  74. KEEP (*(.init_array*))
  75. PROVIDE_HIDDEN (__init_array_end = .);
  76. . = ALIGN(4);
  77. } >FLASH
  78. .fini_array :
  79. {
  80. . = ALIGN(4);
  81. PROVIDE_HIDDEN (__fini_array_start = .);
  82. KEEP (*(SORT(.fini_array.*)))
  83. KEEP (*(.fini_array*))
  84. PROVIDE_HIDDEN (__fini_array_end = .);
  85. . = ALIGN(4);
  86. } >FLASH
  87. /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
  88. ._user_heap_stack :
  89. {
  90. . = ALIGN(8);
  91. PROVIDE ( end = . );
  92. PROVIDE ( _end = . );
  93. . = . + _Min_Heap_Size;
  94. . = . + _Min_Stack_Size;
  95. . = ALIGN(8);
  96. } >RAM
  97. /* Initialized data sections into "RAM" Ram type memory */
  98. /* Used by the startup to initialize data */
  99. _sidata = LOADADDR(.data);
  100. .data :
  101. {
  102. . = ALIGN(4);
  103. _sdata = .; /* create a global symbol at data start */
  104. *(.data) /* .data sections */
  105. *(.data*) /* .data* sections */
  106. *(.RamFunc) /* .RamFunc sections */
  107. *(.RamFunc*) /* .RamFunc* sections */
  108. . = ALIGN(4);
  109. _edata = .; /* define a global symbol at data end */
  110. } >RAM AT> FLASH
  111. /* Uninitialized data section into "RAM" Ram type memory */
  112. . = ALIGN(4);
  113. .bss :
  114. {
  115. /* This is used by the startup in order to initialize the .bss section */
  116. _sbss = .; /* define a global symbol at bss start */
  117. __bss_start__ = _sbss;
  118. *(.bss)
  119. *(.bss*)
  120. *(COMMON)
  121. . = ALIGN(4);
  122. _ebss = .; /* define a global symbol at bss end */
  123. __bss_end__ = _ebss;
  124. } >RAM
  125. . = ALIGN(16);
  126. __os_heap_start = .;
  127. /* Remove information from the compiler libraries */
  128. /DISCARD/ :
  129. {
  130. libc.a ( * )
  131. libm.a ( * )
  132. libgcc.a ( * )
  133. }
  134. .ARM.attributes 0 : { *(.ARM.attributes) }
  135. }