88
99MEMORY {
1010 /*
11- * This is bootloader for the RP2040. It must live at the start of the
12- external flash chip .
11+ * The Pico 2 has 4096 KiB of external Flash Memory. We allow ourselves 128
12+ * KiB for the BIOS, leaving the rest for the OS and any user applications .
1313 */
14- BOOT2 : ORIGIN = 0x10000000 , LENGTH = 0x100
14+ FLASH : ORIGIN = 0x10000000 , LENGTH = 128K
1515 /*
16- * The Pico has 2048 KiB of external Flash Memory. We allow ourselves 128
17- * KiB for the BIOS, leaving the rest
18- * for the OS and any user applications.
16+ * This is the remainder of the 4096 KiB flash chip.
1917 */
20- FLASH : ORIGIN = 0x10000100 , LENGTH = 128K - 0x100
21- /*
22- * This is the remainder of the 2048 KiB flash chip.
23- */
24- FLASH_OS : ORIGIN = 0x10020000 , LENGTH = 2048K - 128K
18+ FLASH_OS : ORIGIN = 0x10020000 , LENGTH = 4096K - 128K
2519 /*
2620 * This is the bottom of the four striped banks of SRAM in the RP2040.
2721 */
28- RAM_OS : ORIGIN = 0x20000000 , LENGTH = 0x42000 - 0x9300
22+ RAM_OS : ORIGIN = 0x20000000 , LENGTH = 0x82000 - 0x9300
2923 /*
3024 * This is the top of the four striped banks of SRAM in the RP2040, plus
3125 * SRAM_BANK4 and SRAM_BANK5.
@@ -36,7 +30,7 @@ MEMORY {
3630 * 0x9300 should be the (size of .data + size of .bss + size of .uninit +
3731 * 0x2000 for the stack).
3832 */
39- RAM : ORIGIN = 0x20042000 - 0x9300 , LENGTH = 0x9300
33+ RAM : ORIGIN = 0x20082000 - 0x9300 , LENGTH = 0x9300
4034}
4135
4236/*
@@ -48,17 +42,55 @@ _ram_os_start = ORIGIN(RAM_OS);
4842_ram_os_len = LENGTH (RAM_OS);
4943
5044SECTIONS {
51- /* ### RP2040 Boot loader */
52- .boot2 ORIGIN (BOOT2) :
45+ /* ### Boot ROM info
46+ *
47+ * Goes after .vector_table, to keep it in the first 4K of flash
48+ * where the Boot ROM (and picotool) can find it
49+ */
50+ .start_block : ALIGN (4 )
51+ {
52+ __start_block_addr = .;
53+ KEEP (*(.start_block ));
54+ } > FLASH
55+
56+ } INSERT AFTER .vector_table;
57+
58+ /* move .text to start /after/ the boot info */
59+ _stext = ADDR (.start_block) + SIZEOF (.start_block);
60+
61+ SECTIONS {
62+ /* ### Picotool 'Binary Info' Entries
63+ *
64+ * Picotool looks through this block (as we have pointers to it in our
65+ * header) to find interesting information.
66+ */
67+ .bi_entries : ALIGN (4 )
5368 {
54- KEEP (*(.boot2 ));
55- } > BOOT2
69+ /* We put this in the header */
70+ __bi_entries_start = .;
71+ /* Here are the entries */
72+ KEEP (*(.bi_entries ));
73+ /* Keep this block a nice round size */
74+ . = ALIGN (4 );
75+ /* We put this in the header */
76+ __bi_entries_end = .;
77+ } > FLASH
78+ } INSERT AFTER .text;
5679
57- /* ### Neotron OS */
58- .flash_os ORIGIN (FLASH_OS) :
80+ SECTIONS {
81+ /* ### Boot ROM extra info
82+ *
83+ * Goes after everything in our program, so it can contain a signature.
84+ */
85+ .end_block : ALIGN (4 )
5986 {
60- KEEP (*(.flash_os ));
61- } > FLASH_OS
62- } INSERT BEFORE .text;
87+ __end_block_addr = .;
88+ KEEP (*(.end_block ));
89+ } > FLASH
90+
91+ } INSERT AFTER .uninit;
92+
93+ PROVIDE (start_to_end = __end_block_addr - __start_block_addr);
94+ PROVIDE (end_to_start = __start_block_addr - __end_block_addr);
6395
6496
0 commit comments