ln882h.ld 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
  2. OUTPUT_ARCH(arm)
  3. ENTRY(Reset_Handler)
  4. /* Linker script to configure memory regions. */
  5. MEMORY
  6. {
  7. FLASH (rx) : ORIGIN = 0x10007100, LENGTH = 1228544
  8. RAM0 (rwx) : ORIGIN = 0x20000000, LENGTH = 295K
  9. RETENTION (rwx) : ORIGIN = 0x20049C00, LENGTH = 1K
  10. CACHE_MEM (rwx) : ORIGIN = 0x2004A000, LENGTH = 32K
  11. }
  12. SECTIONS
  13. {
  14. .flash_copysection :
  15. {
  16. __copysection_ram0_load = LOADADDR(.flash_copysection);
  17. __copysection_ram0_start = .;
  18. KEEP(*(.vectors)) /* startup code: ARM vectors */
  19. *hal_qspi.o*(.text*)
  20. *hal_cache.o*(.text*)
  21. *hal_dma.o*(.text*)
  22. *hal_rtc.o*(.text*)
  23. *qspi.o*(.text*)
  24. *flash.o*(.text*)
  25. *port.o*(.text*)
  26. /* Optional .text part*/
  27. /*
  28. *hal_uart.o*(.text)
  29. *log.o*(.text)
  30. *serial.o*(.text)
  31. *serial_hw.o*(.text)
  32. *fifobuf.o*(.text)
  33. */
  34. . = ALIGN(4);
  35. /* all RW data in ram0 of wlan shared memory and lwip pubf pool are not in this section, they are in .bss section */
  36. *(.data*)
  37. . = ALIGN(4);
  38. /* preinit data */
  39. PROVIDE_HIDDEN (__preinit_array_start = .);
  40. KEEP(*(.preinit_array))
  41. PROVIDE_HIDDEN (__preinit_array_end = .);
  42. . = ALIGN(4);
  43. /* init data */
  44. PROVIDE_HIDDEN (__init_array_start = .);
  45. KEEP(*(SORT(.init_array.*)))
  46. KEEP(*(.init_array))
  47. PROVIDE_HIDDEN (__init_array_end = .);
  48. . = ALIGN(4);
  49. /* finit data */
  50. PROVIDE_HIDDEN (__fini_array_start = .);
  51. KEEP(*(SORT(.fini_array.*)))
  52. KEEP(*(.fini_array))
  53. PROVIDE_HIDDEN (__fini_array_end = .);
  54. KEEP(*(.jcr*))
  55. . = ALIGN(4);
  56. /* All data end */
  57. __copysection_ram0_end = .;
  58. } >RAM0 AT>FLASH
  59. .flash_text :
  60. {
  61. PROVIDE(_stext = .);
  62. *(.text*)
  63. PROVIDE(_etext = .);
  64. KEEP(*(.init))
  65. KEEP(*(.fini))
  66. /* .ctors */
  67. *crtbegin.o(.ctors)
  68. *crtbegin?.o(.ctors)
  69. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  70. *(SORT(.ctors.*))
  71. *(.ctors)
  72. /* .dtors */
  73. *crtbegin.o(.dtors)
  74. *crtbegin?.o(.dtors)
  75. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
  76. *(SORT(.dtors.*))
  77. *(.dtors)
  78. *(.rodata*)
  79. KEEP(*(.eh_frame*))
  80. /* section information for ln_at */
  81. . = ALIGN(4);
  82. __ln_at_cmd_tbl_start = .;
  83. KEEP(*(ln_at_cmd_tbl))
  84. __ln_at_cmd_tbl_end = .;
  85. . = ALIGN(4);
  86. __fsymtab_start = .;
  87. KEEP(*(FSymTab))
  88. __fsymtab_end = .;
  89. /* section information for initial. */
  90. . = ALIGN(4);
  91. __zos_init_start = .;
  92. KEEP(*(SORT(.zos_init_call*)))
  93. __zos_init_end = .;
  94. . = ALIGN(4);
  95. __zosatcmdtab_start = .;
  96. KEEP(*(ZosAtCmdTab))
  97. __zosatcmdtab_end = .;
  98. . = ALIGN(4);
  99. } >FLASH
  100. /* .stack_dummy section doesn't contain any symbols. It is only
  101. * used for linker to calculate size of stack sections, and assign
  102. * values to stack symbols later */
  103. .stack_dummy (COPY):
  104. {
  105. PROVIDE(__stack_start__ = .);
  106. KEEP(*(.stack*))
  107. PROVIDE(__c_stack_top__ = .);
  108. PROVIDE(__stack_end__ = .);
  109. } >RAM0
  110. /* Location counter can end up 2byte aligned with narrow Thumb code but
  111. __etext is assumed by startup code to be the LMA of a section in RAM
  112. which must be 4byte aligned */
  113. __etext = ALIGN (4);
  114. .bss_ram0 (NOLOAD):
  115. {
  116. . = ALIGN(4);
  117. __bss_ram0_start__ = .;
  118. *memp.o(.bss* COMMON)
  119. *(wlan_mem_local)
  120. *(wlan_mem_pkt)
  121. *(wlan_mem_dscr)
  122. *(.bss*)
  123. *(COMMON)
  124. . = ALIGN(4);
  125. __bss_ram0_end__ = .;
  126. } >RAM0
  127. .no_init_data (NOLOAD):
  128. {
  129. . = ALIGN(4);
  130. *(.no_init_data)
  131. *(.noinit .noinit.*)
  132. . = ALIGN(4);
  133. __retention_start__ = .;
  134. *(retention_data)
  135. . = ALIGN(4);
  136. __retention_end__ = .;
  137. } >RETENTION
  138. /* Group unwind sections together: */
  139. .ARM.extab : { *(.ARM.extab*) }
  140. .ARM.exidx : { *(.ARM.exidx*) }
  141. /DISCARD/ : {
  142. *(.ARM.exidx.exit.text)
  143. *(.ARM.extab.exit.text)
  144. *(.ARM.exidx.devexit.text)
  145. *(.ARM.extab.devexit.text)
  146. }
  147. /* Set stack top to end of RAM, and stack limit move down by
  148. * size of stack_dummy section */
  149. PROVIDE(__StackTop = __c_stack_top__);
  150. PROVIDE(__StackLimit = __stack_start__);
  151. PROVIDE(__stack = __StackTop);
  152. PROVIDE(heap0_start = __bss_ram0_end__);
  153. PROVIDE(heap0_end = ORIGIN(RAM0) + LENGTH(RAM0)); /* RAM0 end */
  154. PROVIDE(heap0_len = heap0_end - heap0_start);
  155. /* Check if data + heap + stack exceeds RAM limit */
  156. /* ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed with stack") */
  157. ASSERT(heap0_start < heap0_end, "region RAM0 overflowed with .bss")
  158. }