nodemcu.ld 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. /* This linker script generated from xt-genldscripts.tpp for LSP . */
  2. /* Linker Script for ld -N */
  3. MEMORY
  4. {
  5. dport0_0_seg : org = 0x3FF00000, len = 0x10
  6. dram0_0_seg : org = 0x3FFE8000, len = 0x14000
  7. iram1_0_seg : org = 0x40100000, len = 0x8000
  8. irom0_0_seg : org = 0x40210000, len = 0xE0000
  9. }
  10. PHDRS
  11. {
  12. dport0_0_phdr PT_LOAD;
  13. dram0_0_phdr PT_LOAD;
  14. dram0_0_bss_phdr PT_LOAD;
  15. iram1_0_phdr PT_LOAD;
  16. irom0_0_phdr PT_LOAD;
  17. }
  18. /* Default entry point: */
  19. ENTRY(user_start_trampoline)
  20. EXTERN(_DebugExceptionVector)
  21. EXTERN(_DoubleExceptionVector)
  22. EXTERN(_KernelExceptionVector)
  23. EXTERN(_NMIExceptionVector)
  24. EXTERN(_UserExceptionVector)
  25. PROVIDE(_memmap_vecbase_reset = 0x40000000);
  26. /* Various memory-map dependent cache attribute settings: */
  27. _memmap_cacheattr_wb_base = 0x00000110;
  28. _memmap_cacheattr_wt_base = 0x00000110;
  29. _memmap_cacheattr_bp_base = 0x00000220;
  30. _memmap_cacheattr_unused_mask = 0xFFFFF00F;
  31. _memmap_cacheattr_wb_trapnull = 0x2222211F;
  32. _memmap_cacheattr_wba_trapnull = 0x2222211F;
  33. _memmap_cacheattr_wbna_trapnull = 0x2222211F;
  34. _memmap_cacheattr_wt_trapnull = 0x2222211F;
  35. _memmap_cacheattr_bp_trapnull = 0x2222222F;
  36. _memmap_cacheattr_wb_strict = 0xFFFFF11F;
  37. _memmap_cacheattr_wt_strict = 0xFFFFF11F;
  38. _memmap_cacheattr_bp_strict = 0xFFFFF22F;
  39. _memmap_cacheattr_wb_allvalid = 0x22222112;
  40. _memmap_cacheattr_wt_allvalid = 0x22222112;
  41. _memmap_cacheattr_bp_allvalid = 0x22222222;
  42. PROVIDE(_memmap_cacheattr_reset = _memmap_cacheattr_wb_trapnull);
  43. SECTIONS
  44. {
  45. .dport0.rodata : ALIGN(4)
  46. {
  47. _dport0_rodata_start = ABSOLUTE(.);
  48. *(.dport0.rodata)
  49. *(.dport.rodata)
  50. _dport0_rodata_end = ABSOLUTE(.);
  51. } >dport0_0_seg :dport0_0_phdr
  52. .dport0.literal : ALIGN(4)
  53. {
  54. _dport0_literal_start = ABSOLUTE(.);
  55. *(.dport0.literal)
  56. *(.dport.literal)
  57. _dport0_literal_end = ABSOLUTE(.);
  58. } >dport0_0_seg :dport0_0_phdr
  59. .dport0.data : ALIGN(4)
  60. {
  61. _dport0_data_start = ABSOLUTE(.);
  62. *(.dport0.data)
  63. *(.dport.data)
  64. _dport0_data_end = ABSOLUTE(.);
  65. } >dport0_0_seg :dport0_0_phdr
  66. .text : ALIGN(4)
  67. {
  68. _stext = .;
  69. _text_start = ABSOLUTE(.);
  70. *(.UserEnter.text)
  71. . = ALIGN(16);
  72. *(.DebugExceptionVector.text)
  73. . = ALIGN(16);
  74. *(.NMIExceptionVector.text)
  75. . = ALIGN(16);
  76. *(.KernelExceptionVector.text)
  77. LONG(0)
  78. LONG(0)
  79. LONG(0)
  80. LONG(0)
  81. . = ALIGN(16);
  82. *(.UserExceptionVector.text)
  83. LONG(0)
  84. LONG(0)
  85. LONG(0)
  86. LONG(0)
  87. . = ALIGN(16);
  88. *(.DoubleExceptionVector.text)
  89. LONG(0)
  90. LONG(0)
  91. LONG(0)
  92. LONG(0)
  93. . = ALIGN (16);
  94. *(.entry.text)
  95. *(.init.literal)
  96. *(.init)
  97. /* SDK libraries that used in bootup process, interruption handling
  98. * and other ways where flash cache (iROM) is unavailable: */
  99. *libmain.a:*(.literal .literal.* .text .text.*)
  100. *libnet80211.a:*(.literal .text)
  101. *libphy.a:*(.literal .text)
  102. *libpp.a:*(.literal .text)
  103. *libgcc.a:*(.literal .text)
  104. /* Following SDK libraries have .text sections, but not included in iRAM: */
  105. /* *libat.a:*(.literal .text) - not used anywhere in NodeMCU */
  106. /* *libcrypto.a:*(.literal .text) - tested that safe to keep in iROM */
  107. /* *libdriver.a:*(.literal .text) - not used anywhere in NodeMCU */
  108. /* *libespnow.a:*(.literal .text) - not used anywhere in NodeMCU */
  109. /* *libmesh.a:*(.literal .text) - not used anywhere in NodeMCU */
  110. /* *liblwip_536.a:*(.literal .text) - source-based library used instead */
  111. /* *libpwm.a:*(.literal .text) - our own implementation used instead */
  112. /* *libwpa.a:*(.literal .text) - tested that safe to keep in iROM */
  113. /* *libwps.a:*(.literal .text) - tested that safe to keep in iROM */
  114. *(.iram.text .iram0.text)
  115. *(.stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*)
  116. *(.fini.literal)
  117. *(.fini)
  118. *(.gnu.version)
  119. _text_end = ABSOLUTE(.);
  120. _etext = .;
  121. } >iram1_0_seg :iram1_0_phdr
  122. .data : ALIGN(4)
  123. {
  124. _data_start = ABSOLUTE(.);
  125. *(.data)
  126. *(.data.*)
  127. *(.gnu.linkonce.d.*)
  128. *(.data1)
  129. *(.sdata)
  130. *(.sdata.*)
  131. *(.gnu.linkonce.s.*)
  132. *(.sdata2)
  133. *(.sdata2.*)
  134. *(.gnu.linkonce.s2.*)
  135. *(.jcr)
  136. _data_end = ABSOLUTE(.);
  137. } >dram0_0_seg :dram0_0_phdr
  138. .rodata : ALIGN(4)
  139. {
  140. _rodata_start = ABSOLUTE(.);
  141. *(.rodata.dram .rodata.dram*)
  142. *(.gnu.linkonce.r.*)
  143. __XT_EXCEPTION_TABLE__ = ABSOLUTE(.);
  144. *(.xt_except_table)
  145. *(.gcc_except_table)
  146. *(.gnu.linkonce.e.*)
  147. *(.gnu.version_r)
  148. *(.eh_frame)
  149. /* C++ constructor and destructor tables, properly ordered: */
  150. KEEP (*crtbegin.o(.ctors))
  151. KEEP (*(EXCLUDE_FILE (*crtend.o) .ctors))
  152. KEEP (*(SORT(.ctors.*)))
  153. KEEP (*(.ctors))
  154. KEEP (*crtbegin.o(.dtors))
  155. KEEP (*(EXCLUDE_FILE (*crtend.o) .dtors))
  156. KEEP (*(SORT(.dtors.*)))
  157. KEEP (*(.dtors))
  158. /* C++ exception handlers table: */
  159. __XT_EXCEPTION_DESCS__ = ABSOLUTE(.);
  160. *(.xt_except_desc)
  161. *(.gnu.linkonce.h.*)
  162. __XT_EXCEPTION_DESCS_END__ = ABSOLUTE(.);
  163. *(.xt_except_desc_end)
  164. *(.dynamic)
  165. *(.gnu.version_d)
  166. . = ALIGN(4); /* this table MUST be 4-byte aligned */
  167. _bss_table_start = ABSOLUTE(.);
  168. LONG(_bss_start)
  169. LONG(_bss_end)
  170. _bss_table_end = ABSOLUTE(.);
  171. _rodata_end = ABSOLUTE(.);
  172. } >dram0_0_seg :dram0_0_phdr
  173. .bss ALIGN(8) (NOLOAD) : ALIGN(4)
  174. {
  175. . = ALIGN (8);
  176. _bss_start = ABSOLUTE(.);
  177. *(.dynsbss)
  178. *(.sbss)
  179. *(.sbss.*)
  180. *(.gnu.linkonce.sb.*)
  181. *(.scommon)
  182. *(.sbss2)
  183. *(.sbss2.*)
  184. *(.gnu.linkonce.sb2.*)
  185. *(.dynbss)
  186. *(.bss)
  187. *(.bss.*)
  188. *(.gnu.linkonce.b.*)
  189. *(COMMON)
  190. . = ALIGN (8);
  191. _bss_end = ABSOLUTE(.);
  192. _heap_start = ABSOLUTE(.);
  193. /* _stack_sentry = ALIGN(0x8); */
  194. } >dram0_0_seg :dram0_0_bss_phdr
  195. /* __stack = 0x3ffc8000; */
  196. .lit4 : ALIGN(4)
  197. {
  198. _lit4_start = ABSOLUTE(.);
  199. *(*.lit4)
  200. *(.lit4.*)
  201. *(.gnu.linkonce.lit4.*)
  202. _lit4_end = ABSOLUTE(.);
  203. } >iram1_0_seg :iram1_0_phdr
  204. .irom0.text : ALIGN(0x1000)
  205. {
  206. _irom0_text_start = ABSOLUTE(.);
  207. *(.servercert.flash)
  208. *(.clientcert.flash)
  209. *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text)
  210. *(.literal .text .literal.* .text.*)
  211. *(.rodata*)
  212. *(.sdk.version)
  213. /* Link-time arrays containing the defs for the included modules */
  214. . = ALIGN(4);
  215. lua_libs = ABSOLUTE(.);
  216. /* Allow either empty define or defined-to-1 to include the module */
  217. KEEP(*(.lua_libs))
  218. LONG(0) LONG(0) /* Null-terminate the array */
  219. lua_rotable = ABSOLUTE(.);
  220. KEEP(*(.lua_rotable))
  221. LONG(0) LONG(0) /* Null-terminate the array */
  222. /* SDK doesn't use libc functions, and are therefore safe to put in flash */
  223. */libc.a:*.o(.text* .literal*)
  224. /* end libc functions */
  225. _irom0_text_end = ABSOLUTE(.);
  226. _flash_used_end = ABSOLUTE(.);
  227. } >irom0_0_seg :irom0_0_phdr =0xffffffff
  228. }
  229. /* get ROM code address */
  230. INCLUDE "eagle.rom.addr.v6.ld"