bl.ld 4.1 KB

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