link.lds 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. ;*******************************************************************************
  3. ; * Copyright (C) 2020, Huada Semiconductor Co., Ltd. All rights reserved.
  4. ; *
  5. ; * This software component is licensed by HDSC under BSD 3-Clause license
  6. ; * (the "License"); You may not use this file except in compliance with the
  7. ; * License. You may obtain a copy of the License at:
  8. ; * opensource.org/licenses/BSD-3-Clause
  9. */
  10. /*****************************************************************************/
  11. /* File hc32f460xe_flash.ld */
  12. /* Abstract Linker script for HC32F460 Device with */
  13. /* 512KByte FLASH, 192KByte RAM */
  14. /* Version V1.0 */
  15. /* Date 2019-03-13 */
  16. /*****************************************************************************/
  17. /* Use contiguous memory regions for simple. */
  18. MEMORY
  19. {
  20. FLASH (rx): ORIGIN = 0x00000000, LENGTH = 512K
  21. OTP (rx): ORIGIN = 0x03000C00, LENGTH = 1020
  22. RAM (rwx): ORIGIN = 0x1FFF8000, LENGTH = 188K
  23. RET_RAM (rwx): ORIGIN = 0x200F0000, LENGTH = 4K
  24. }
  25. ENTRY(Reset_Handler)
  26. SECTIONS
  27. {
  28. .vectors :
  29. {
  30. . = ALIGN(4);
  31. KEEP(*(.vectors))
  32. . = ALIGN(4);
  33. } >FLASH
  34. .icg_sec 0x00000400 :
  35. {
  36. KEEP(*(.icg_sec))
  37. } >FLASH
  38. .text :
  39. {
  40. . = ALIGN(4);
  41. *(.text)
  42. *(.text*)
  43. *(.glue_7)
  44. *(.glue_7t)
  45. *(.eh_frame)
  46. KEEP(*(.init))
  47. KEEP(*(.fini))
  48. . = ALIGN(4);
  49. } >FLASH
  50. .rodata :
  51. {
  52. . = ALIGN(4);
  53. *(.rodata)
  54. *(.rodata*)
  55. . = ALIGN(4);
  56. } >FLASH
  57. .ARM.extab :
  58. {
  59. *(.ARM.extab* .gnu.linkonce.armextab.*)
  60. } >FLASH
  61. __exidx_start = .;
  62. .ARM.exidx :
  63. {
  64. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  65. } >FLASH
  66. __exidx_end = .;
  67. .preinit_array :
  68. {
  69. . = ALIGN(4);
  70. /* preinit data */
  71. PROVIDE_HIDDEN (__preinit_array_start = .);
  72. KEEP(*(.preinit_array))
  73. PROVIDE_HIDDEN (__preinit_array_end = .);
  74. . = ALIGN(4);
  75. } >FLASH
  76. .init_array :
  77. {
  78. . = ALIGN(4);
  79. /* init data */
  80. PROVIDE_HIDDEN (__init_array_start = .);
  81. KEEP(*(SORT(.init_array.*)))
  82. KEEP(*(.init_array))
  83. PROVIDE_HIDDEN (__init_array_end = .);
  84. . = ALIGN(4);
  85. } >FLASH
  86. .fini_array :
  87. {
  88. . = ALIGN(4);
  89. /* finit data */
  90. PROVIDE_HIDDEN (__fini_array_start = .);
  91. KEEP(*(SORT(.fini_array.*)))
  92. KEEP(*(.fini_array))
  93. PROVIDE_HIDDEN (__fini_array_end = .);
  94. . = ALIGN(4);
  95. } >FLASH
  96. __etext = ALIGN(4);
  97. .otp_sec :
  98. {
  99. KEEP(*(.otp_sec))
  100. } >OTP
  101. .otp_lock_sec 0x03000FC0 :
  102. {
  103. KEEP(*(.otp_lock_sec))
  104. } >OTP
  105. .data : AT (__etext)
  106. {
  107. . = ALIGN(4);
  108. __data_start__ = .;
  109. *(vtable)
  110. *(.data)
  111. *(.data*)
  112. . = ALIGN(4);
  113. *(.ramfunc)
  114. *(.ramfunc*)
  115. . = ALIGN(4);
  116. __data_end__ = .;
  117. } >RAM
  118. __etext_ret_ram = __etext + ALIGN (SIZEOF(.data), 4);
  119. .ret_ram_data : AT (__etext_ret_ram)
  120. {
  121. . = ALIGN(4);
  122. __data_start_ret_ram__ = .;
  123. *(.ret_ram_data)
  124. *(.ret_ram_data*)
  125. . = ALIGN(4);
  126. __data_end_ret_ram__ = .;
  127. } >RET_RAM
  128. .bss :
  129. {
  130. . = ALIGN(4);
  131. _sbss = .;
  132. __bss_start__ = _sbss;
  133. *(.bss)
  134. *(.bss*)
  135. *(COMMON)
  136. . = ALIGN(4);
  137. _ebss = .;
  138. __bss_end__ = _ebss;
  139. } >RAM
  140. .ret_ram_bss :
  141. {
  142. . = ALIGN(4);
  143. __bss_start_ret_ram__ = .;
  144. *(.ret_ram_bss)
  145. *(.ret_ram_bss*)
  146. . = ALIGN(4);
  147. __bss_end_ret_ram__ = .;
  148. } >RET_RAM
  149. .heap_stack (COPY) :
  150. {
  151. . = ALIGN(8);
  152. __end__ = .;
  153. PROVIDE(end = .);
  154. PROVIDE(_end = .);
  155. *(.heap*)
  156. . = ALIGN(8);
  157. __HeapLimit = .;
  158. __StackLimit = .;
  159. *(.stack*)
  160. . = ALIGN(8);
  161. __StackTop = .;
  162. } >RAM
  163. /DISCARD/ :
  164. {
  165. libc.a (*)
  166. libm.a (*)
  167. libgcc.a (*)
  168. }
  169. .ARM.attributes 0 : { *(.ARM.attributes) }
  170. PROVIDE(_stack = __StackTop);
  171. PROVIDE(_Min_Heap_Size = __HeapLimit - __HeapBase);
  172. PROVIDE(_Min_Stack_Size = __StackTop - __StackLimit);
  173. __RamEnd = ORIGIN(RAM) + LENGTH(RAM);
  174. ASSERT(__StackTop <= __RamEnd, "region RAM overflowed with stack")
  175. }