S&B Volcano vaporizer remote control with Pi Pico W
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

memmap_custom.ld 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /*
  2. * Based on Pico SDK memmap_default.ld
  3. * https://community.element14.com/products/raspberry-pi/b/blog/posts/raspberry-pico-c-sdk-reserve-a-flash-memory-block-for-persistent-storage
  4. */
  5. /* TODO hard-coded. Should take into account PICO_FLASH_BANK_STORAGE_OFFSET */
  6. __PERSISTENT_STORAGE_LEN = (3 * 4k);
  7. MEMORY
  8. {
  9. FLASH(rx) : ORIGIN = 0x10000000, LENGTH = 2048k - __PERSISTENT_STORAGE_LEN
  10. FLASH_PERSISTENT(r) : ORIGIN = 0x10000000 + (2048k - __PERSISTENT_STORAGE_LEN) , LENGTH = __PERSISTENT_STORAGE_LEN
  11. RAM(rwx) : ORIGIN = 0x20000000, LENGTH = 256k
  12. SCRATCH_X(rwx) : ORIGIN = 0x20040000, LENGTH = 4k
  13. SCRATCH_Y(rwx) : ORIGIN = 0x20041000, LENGTH = 4k
  14. }
  15. ENTRY(_entry_point)
  16. SECTIONS
  17. {
  18. /* Second stage bootloader is prepended to the image. It must be 256 bytes big
  19. and checksummed. It is usually built by the boot_stage2 target
  20. in the Raspberry Pi Pico SDK
  21. */
  22. .flash_begin : {
  23. __flash_binary_start = .;
  24. } > FLASH
  25. .boot2 : {
  26. __boot2_start__ = .;
  27. KEEP (*(.boot2))
  28. __boot2_end__ = .;
  29. } > FLASH
  30. ASSERT(__boot2_end__ - __boot2_start__ == 256,
  31. "ERROR: Pico second stage bootloader must be 256 bytes in size")
  32. /* The second stage will always enter the image at the start of .text.
  33. The debugger will use the ELF entry point, which is the _entry_point
  34. symbol if present, otherwise defaults to start of .text.
  35. This can be used to transfer control back to the bootrom on debugger
  36. launches only, to perform proper flash setup.
  37. */
  38. .text : {
  39. __logical_binary_start = .;
  40. KEEP (*(.vectors))
  41. KEEP (*(.binary_info_header))
  42. __binary_info_header_end = .;
  43. KEEP (*(.reset))
  44. /* TODO revisit this now memset/memcpy/float in ROM */
  45. /* bit of a hack right now to exclude all floating point and time critical (e.g. memset, memcpy) code from
  46. * FLASH ... we will include any thing excluded here in .data below by default */
  47. *(.init)
  48. *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .text*)
  49. *(.fini)
  50. /* Pull all c'tors into .text */
  51. *crtbegin.o(.ctors)
  52. *crtbegin?.o(.ctors)
  53. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
  54. *(SORT(.ctors.*))
  55. *(.ctors)
  56. /* Followed by destructors */
  57. *crtbegin.o(.dtors)
  58. *crtbegin?.o(.dtors)
  59. *(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
  60. *(SORT(.dtors.*))
  61. *(.dtors)
  62. *(.eh_frame*)
  63. . = ALIGN(4);
  64. } > FLASH
  65. .rodata : {
  66. *(EXCLUDE_FILE(*libgcc.a: *libc.a:*lib_a-mem*.o *libm.a:) .rodata*)
  67. . = ALIGN(4);
  68. *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.flashdata*)))
  69. . = ALIGN(4);
  70. } > FLASH
  71. .ARM.extab :
  72. {
  73. *(.ARM.extab* .gnu.linkonce.armextab.*)
  74. } > FLASH
  75. __exidx_start = .;
  76. .ARM.exidx :
  77. {
  78. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  79. } > FLASH
  80. __exidx_end = .;
  81. /* Machine inspectable binary information */
  82. . = ALIGN(4);
  83. __binary_info_start = .;
  84. .binary_info :
  85. {
  86. KEEP(*(.binary_info.keep.*))
  87. *(.binary_info.*)
  88. } > FLASH
  89. __binary_info_end = .;
  90. . = ALIGN(4);
  91. .ram_vector_table (NOLOAD): {
  92. *(.ram_vector_table)
  93. } > RAM
  94. .data : {
  95. __data_start__ = .;
  96. *(vtable)
  97. *(.time_critical*)
  98. /* remaining .text and .rodata; i.e. stuff we exclude above because we want it in RAM */
  99. *(.text*)
  100. . = ALIGN(4);
  101. *(.rodata*)
  102. . = ALIGN(4);
  103. *(.data*)
  104. . = ALIGN(4);
  105. *(.after_data.*)
  106. . = ALIGN(4);
  107. /* preinit data */
  108. PROVIDE_HIDDEN (__mutex_array_start = .);
  109. KEEP(*(SORT(.mutex_array.*)))
  110. KEEP(*(.mutex_array))
  111. PROVIDE_HIDDEN (__mutex_array_end = .);
  112. . = ALIGN(4);
  113. /* preinit data */
  114. PROVIDE_HIDDEN (__preinit_array_start = .);
  115. KEEP(*(SORT(.preinit_array.*)))
  116. KEEP(*(.preinit_array))
  117. PROVIDE_HIDDEN (__preinit_array_end = .);
  118. . = ALIGN(4);
  119. /* init data */
  120. PROVIDE_HIDDEN (__init_array_start = .);
  121. KEEP(*(SORT(.init_array.*)))
  122. KEEP(*(.init_array))
  123. PROVIDE_HIDDEN (__init_array_end = .);
  124. . = ALIGN(4);
  125. /* finit data */
  126. PROVIDE_HIDDEN (__fini_array_start = .);
  127. *(SORT(.fini_array.*))
  128. *(.fini_array)
  129. PROVIDE_HIDDEN (__fini_array_end = .);
  130. *(.jcr)
  131. . = ALIGN(4);
  132. /* All data end */
  133. __data_end__ = .;
  134. } > RAM AT> FLASH
  135. /* __etext is (for backwards compatibility) the name of the .data init source pointer (...) */
  136. __etext = LOADADDR(.data);
  137. .uninitialized_data (NOLOAD): {
  138. . = ALIGN(4);
  139. *(.uninitialized_data*)
  140. } > RAM
  141. /* Start and end symbols must be word-aligned */
  142. .scratch_x : {
  143. __scratch_x_start__ = .;
  144. *(.scratch_x.*)
  145. . = ALIGN(4);
  146. __scratch_x_end__ = .;
  147. } > SCRATCH_X AT > FLASH
  148. __scratch_x_source__ = LOADADDR(.scratch_x);
  149. .scratch_y : {
  150. __scratch_y_start__ = .;
  151. *(.scratch_y.*)
  152. . = ALIGN(4);
  153. __scratch_y_end__ = .;
  154. } > SCRATCH_Y AT > FLASH
  155. __scratch_y_source__ = LOADADDR(.scratch_y);
  156. .bss : {
  157. . = ALIGN(4);
  158. __bss_start__ = .;
  159. *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*)))
  160. *(COMMON)
  161. . = ALIGN(4);
  162. __bss_end__ = .;
  163. } > RAM
  164. .heap (NOLOAD):
  165. {
  166. __end__ = .;
  167. end = __end__;
  168. KEEP(*(.heap*))
  169. __HeapLimit = .;
  170. } > RAM
  171. /* .stack*_dummy section doesn't contains any symbols. It is only
  172. * used for linker to calculate size of stack sections, and assign
  173. * values to stack symbols later
  174. *
  175. * stack1 section may be empty/missing if platform_launch_core1 is not used */
  176. /* by default we put core 0 stack at the end of scratch Y, so that if core 1
  177. * stack is not used then all of SCRATCH_X is free.
  178. */
  179. .stack1_dummy (NOLOAD):
  180. {
  181. *(.stack1*)
  182. } > SCRATCH_X
  183. .stack_dummy (NOLOAD):
  184. {
  185. KEEP(*(.stack*))
  186. } > SCRATCH_Y
  187. .flash_end : {
  188. PROVIDE(__flash_binary_end = .);
  189. } > FLASH
  190. /* stack limit is poorly named, but historically is maximum heap ptr */
  191. __StackLimit = ORIGIN(RAM) + LENGTH(RAM);
  192. __StackOneTop = ORIGIN(SCRATCH_X) + LENGTH(SCRATCH_X);
  193. __StackTop = ORIGIN(SCRATCH_Y) + LENGTH(SCRATCH_Y);
  194. __StackOneBottom = __StackOneTop - SIZEOF(.stack1_dummy);
  195. __StackBottom = __StackTop - SIZEOF(.stack_dummy);
  196. PROVIDE(__stack = __StackTop);
  197. /* Check if data + heap + stack exceeds RAM limit */
  198. ASSERT(__StackLimit >= __HeapLimit, "region RAM overflowed")
  199. ASSERT( __binary_info_header_end - __logical_binary_start <= 256, "Binary info must be in first 256 bytes of the binary")
  200. /* todo assert on extra code */
  201. }