Skip to content

Commit 2bd5067

Browse files
committed
Finish adapting flash storage size
Before this, CIRCUITPY would start at 1MB anyway. This appeared to work only because I hadn't checked the actual size of the CIRCUITPY drive, and because until now the flash hadn't actually crossed that 1MB boundary into CIRCUITPY storage. WARNING: on pico_w, upgrading/downgrading CircuitPython across this commit boundary will erase the CIRCUITPY filesystem. After this commit, switching between pico and pico_w firmware will erase the CIRCUITPY filesystem
1 parent 18cee2e commit 2bd5067

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

ports/raspberrypi/boards/raspberry_pi_pico_w/mpconfigboard.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,5 @@ CIRCUITPY_SOCKETPOOL = 1
1919
CIRCUITPY_WIFI = 1
2020

2121
CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0
22+
# Must be accompanied by a linker script change
23+
CFLAGS += -DRESERVED_FLASH='(1792 * 1024)'

ports/raspberrypi/supervisor/internal_flash.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,13 @@
4646
#include "src/rp2_common/hardware_flash/include/hardware/flash.h"
4747
#include "src/common/pico_binary_info/include/pico/binary_info.h"
4848

49+
#if !defined(RESERVED_FLASH)
4950
#define RESERVED_FLASH (1 * 1024 * 1024)
51+
#endif
52+
53+
#if !defined(TOTAL_FLASH_MINIMUM)
54+
#define TOTAL_FLASH_MINIMUM (2 * 1024 * 1024)
55+
#endif
5056

5157
// TODO: Split the caching out of supervisor/shared/external_flash so we can use it.
5258
#define SECTOR_SIZE 4096
@@ -60,7 +66,7 @@ void supervisor_flash_init(void) {
6066
BINARY_INFO_MAKE_TAG('C', 'P'),
6167
"CircuitPython",
6268
RESERVED_FLASH,
63-
(1 * 1024 * 1024), // This is a minimum. We can't set it dynamically.
69+
TOTAL_FLASH_MINIMUM - RESERVED_FLASH, // This is a minimum. We can't set it dynamically.
6470
NULL,
6571
BINARY_INFO_BLOCK_DEV_FLAG_READ |
6672
BINARY_INFO_BLOCK_DEV_FLAG_WRITE |

0 commit comments

Comments
 (0)