bl.ld 4.1 KB

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