S&B Volcano vaporizer remote control with Pi Pico W
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

memmap_custom.ld 7.1KB

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