AT32F413xB_FLASH.ld 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /*
  2. *****************************************************************************
  3. **
  4. ** File : AT32F413xB_FLASH.ld
  5. **
  6. ** Abstract : Linker script for AT32F413xB Device with
  7. ** 128KByte FLASH, 32KByte 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. ** Target : Artery Tek AT32
  15. **
  16. ** Environment : Arm gcc toolchain
  17. **
  18. *****************************************************************************
  19. */
  20. /* Entry Point */
  21. ENTRY(Reset_Handler)
  22. /* Highest address of the user mode stack */
  23. _estack = 0x20008000; /* end of RAM */
  24. /* Generate a link error if heap and stack don't fit into RAM */
  25. _Min_Heap_Size = 0x200; /* required amount of heap */
  26. _Min_Stack_Size = 0x400; /* required amount of stack */
  27. /* Specify the memory areas */
  28. MEMORY
  29. {
  30. FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K
  31. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
  32. SPIM (rx) : ORIGIN = 0x08400000, LENGTH = 16384K
  33. }
  34. /* Define output sections */
  35. SECTIONS
  36. {
  37. /* The startup code goes first into FLASH */
  38. .isr_vector :
  39. {
  40. . = ALIGN(4);
  41. KEEP(*(.isr_vector)) /* Startup code */
  42. . = ALIGN(4);
  43. } >FLASH
  44. /* The program code and other data goes into FLASH */
  45. .text :
  46. {
  47. . = ALIGN(4);
  48. *(.text) /* .text sections (code) */
  49. *(.text*) /* .text* sections (code) */
  50. *(.glue_7) /* glue arm to thumb code */
  51. *(.glue_7t) /* glue thumb to arm code */
  52. *(.eh_frame)
  53. KEEP (*(.init))
  54. KEEP (*(.fini))
  55. . = ALIGN(4);
  56. _etext = .; /* define a global symbols at end of code */
  57. } >FLASH
  58. /* Constant data goes into FLASH */
  59. .rodata :
  60. {
  61. . = ALIGN(4);
  62. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  63. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  64. . = ALIGN(4);
  65. } >FLASH
  66. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  67. .ARM : {
  68. __exidx_start = .;
  69. *(.ARM.exidx*)
  70. __exidx_end = .;
  71. } >FLASH
  72. .preinit_array :
  73. {
  74. PROVIDE_HIDDEN (__preinit_array_start = .);
  75. KEEP (*(.preinit_array*))
  76. PROVIDE_HIDDEN (__preinit_array_end = .);
  77. } >FLASH
  78. .init_array :
  79. {
  80. PROVIDE_HIDDEN (__init_array_start = .);
  81. KEEP (*(SORT(.init_array.*)))
  82. KEEP (*(.init_array*))
  83. PROVIDE_HIDDEN (__init_array_end = .);
  84. } >FLASH
  85. .fini_array :
  86. {
  87. PROVIDE_HIDDEN (__fini_array_start = .);
  88. KEEP (*(SORT(.fini_array.*)))
  89. KEEP (*(.fini_array*))
  90. PROVIDE_HIDDEN (__fini_array_end = .);
  91. } >FLASH
  92. /* used by the startup to initialize data */
  93. _sidata = LOADADDR(.data);
  94. /* Initialized data sections goes into RAM, load LMA copy after code */
  95. .data :
  96. {
  97. . = ALIGN(4);
  98. _sdata = .; /* create a global symbol at data start */
  99. *(.data) /* .data sections */
  100. *(.data*) /* .data* sections */
  101. . = ALIGN(4);
  102. _edata = .; /* define a global symbol at data end */
  103. } >RAM AT> FLASH
  104. _spim_init_base = LOADADDR(.spim);
  105. _spim_init_length = SIZEOF(.spim);
  106. .spim :
  107. {
  108. . = ALIGN(4);
  109. _spim_start = .; /* create a global symbol at spim start */
  110. *(.spim) /* .spim sections */
  111. *(.spim*) /* .spim* sections */
  112. . = ALIGN(4);
  113. _spim_end = .; /* define a global symbols at end of spim */
  114. } >SPIM
  115. /* Uninitialized data section */
  116. . = ALIGN(4);
  117. .bss :
  118. {
  119. /* This is used by the startup in order to initialize the .bss secion */
  120. _sbss = .; /* define a global symbol at bss start */
  121. __bss_start__ = _sbss;
  122. *(.bss)
  123. *(.bss*)
  124. *(COMMON)
  125. . = ALIGN(4);
  126. _ebss = .; /* define a global symbol at bss end */
  127. __bss_end__ = _ebss;
  128. } >RAM
  129. /* User_heap_stack section, used to check that there is enough RAM left */
  130. ._user_heap_stack :
  131. {
  132. . = ALIGN(8);
  133. PROVIDE ( end = . );
  134. PROVIDE ( _end = . );
  135. . = . + _Min_Heap_Size;
  136. . = . + _Min_Stack_Size;
  137. . = ALIGN(8);
  138. } >RAM
  139. /* Remove information from the standard libraries */
  140. /DISCARD/ :
  141. {
  142. libc.a ( * )
  143. libm.a ( * )
  144. libgcc.a ( * )
  145. }
  146. .ARM.attributes 0 : { *(.ARM.attributes) }
  147. }