link.lds 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /*
  2. *****************************************************************************
  3. **
  4. ** File : es32f0654.ld
  5. **
  6. ** Abstract : Linker script for ES32F0654 Device with
  7. ** 256K-Byte FLASH, 32K-Byte RAM
  8. **
  9. ** Set heap size, stack size and stack location according
  10. ** to application requirements.
  11. **
  12. ** Set memory bank area and size if external memory is used.
  13. **
  14. *****************************************************************************
  15. */
  16. /* Entry Point */
  17. ENTRY(Reset_Handler)
  18. /* Highest address of the user mode stack */
  19. _estack = 0x20008000; /* end of 32K RAM */
  20. /* Generate a link error if heap and stack don't fit into RAM */
  21. _Min_Heap_Size = 0; /* required amount of heap */
  22. _Min_Stack_Size = 0x400; /* required amount of stack */
  23. /* Specify the memory areas */
  24. MEMORY
  25. {
  26. FLASH (rx) : ORIGIN = 0x00008000, LENGTH = 224K
  27. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
  28. MEMORY_B1 (rx) : ORIGIN = 0x20008000, LENGTH = 0K
  29. }
  30. /* Define output sections */
  31. SECTIONS
  32. {
  33. /* The startup code goes first into FLASH */
  34. .isr_vector :
  35. {
  36. . = ALIGN(4);
  37. KEEP(*(.isr_vector)) /* Startup code */
  38. . = ALIGN(4);
  39. } >FLASH
  40. /* The program code and other data goes into FLASH */
  41. .text :
  42. {
  43. . = ALIGN(4);
  44. *(.text) /* .text sections (code) */
  45. *(.text*) /* .text* sections (code) */
  46. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  47. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  48. *(.glue_7) /* glue arm to thumb code */
  49. *(.glue_7t) /* glue thumb to arm code */
  50. KEEP (*(.init))
  51. KEEP (*(.fini))
  52. . = ALIGN(4);
  53. _etext = .; /* define a global symbols at end of code */
  54. } >FLASH
  55. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  56. .ARM : {
  57. __exidx_start = .;
  58. *(.ARM.exidx*)
  59. __exidx_end = .;
  60. } >FLASH
  61. .ARM.attributes : { *(.ARM.attributes) } > FLASH
  62. .preinit_array :
  63. {
  64. PROVIDE_HIDDEN (__preinit_array_start = .);
  65. KEEP (*(.preinit_array*))
  66. PROVIDE_HIDDEN (__preinit_array_end = .);
  67. } >FLASH
  68. .init_array :
  69. {
  70. PROVIDE_HIDDEN (__init_array_start = .);
  71. KEEP (*(SORT(.init_array.*)))
  72. KEEP (*(.init_array*))
  73. PROVIDE_HIDDEN (__init_array_end = .);
  74. } >FLASH
  75. .fini_array :
  76. {
  77. PROVIDE_HIDDEN (__fini_array_start = .);
  78. KEEP (*(.fini_array*))
  79. KEEP (*(SORT(.fini_array.*)))
  80. PROVIDE_HIDDEN (__fini_array_end = .);
  81. } >FLASH
  82. /* used by the startup to initialize data */
  83. _sidata = .;
  84. /* Initialized data sections goes into RAM, load LMA copy after code */
  85. .data : AT ( _sidata )
  86. {
  87. . = ALIGN(4);
  88. _sdata = .; /* create a global symbol at data start */
  89. *(.data) /* .data sections */
  90. *(.data*) /* .data* sections */
  91. . = ALIGN(4);
  92. _edata = .; /* define a global symbol at data end */
  93. } >RAM
  94. /* Uninitialized data section */
  95. . = ALIGN(4);
  96. .bss :
  97. {
  98. /* This is used by the startup in order to initialize the .bss secion */
  99. _sbss = .; /* define a global symbol at bss start */
  100. __bss_start__ = _sbss;
  101. *(.bss)
  102. *(.bss*)
  103. *(COMMON)
  104. . = ALIGN(4);
  105. _ebss = .; /* define a global symbol at bss end */
  106. __bss_end__ = _ebss;
  107. } >RAM
  108. PROVIDE ( end = _ebss );
  109. PROVIDE ( _end = _ebss );
  110. /* User_heap_stack section, used to check that there is enough RAM left */
  111. ._user_heap_stack :
  112. {
  113. . = ALIGN(4);
  114. . = . + _Min_Heap_Size;
  115. . = . + _Min_Stack_Size;
  116. . = ALIGN(4);
  117. } >RAM
  118. /* MEMORY_bank1 section, code must be located here explicitly */
  119. /* Example: extern int foo(void) __attribute__ ((section (".mb1text"))); */
  120. .memory_b1_text :
  121. {
  122. *(.mb1text) /* .mb1text sections (code) */
  123. *(.mb1text*) /* .mb1text* sections (code) */
  124. *(.mb1rodata) /* read-only data (constants) */
  125. *(.mb1rodata*)
  126. } >MEMORY_B1
  127. /* Remove information from the standard libraries */
  128. /DISCARD/ :
  129. {
  130. libc.a ( * )
  131. libm.a ( * )
  132. libgcc.a ( * )
  133. }
  134. }