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
This commit is contained in:
Jeff Epler 2022-10-05 09:55:48 -05:00
parent 18cee2ee8b
commit 2bd50673b6
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
2 changed files with 9 additions and 1 deletions

View File

@ -19,3 +19,5 @@ CIRCUITPY_SOCKETPOOL = 1
CIRCUITPY_WIFI = 1
CFLAGS += -DCYW43_PIN_WL_HOST_WAKE=24 -DCYW43_PIN_WL_REG_ON=23 -DCYW43_WL_GPIO_COUNT=3 -DCYW43_WL_GPIO_LED_PIN=0
# Must be accompanied by a linker script change
CFLAGS += -DRESERVED_FLASH='(1792 * 1024)'

View File

@ -46,7 +46,13 @@
#include "src/rp2_common/hardware_flash/include/hardware/flash.h"
#include "src/common/pico_binary_info/include/pico/binary_info.h"
#if !defined(RESERVED_FLASH)
#define RESERVED_FLASH (1 * 1024 * 1024)
#endif
#if !defined(TOTAL_FLASH_MINIMUM)
#define TOTAL_FLASH_MINIMUM (2 * 1024 * 1024)
#endif
// TODO: Split the caching out of supervisor/shared/external_flash so we can use it.
#define SECTOR_SIZE 4096
@ -60,7 +66,7 @@ void supervisor_flash_init(void) {
BINARY_INFO_MAKE_TAG('C', 'P'),
"CircuitPython",
RESERVED_FLASH,
(1 * 1024 * 1024), // This is a minimum. We can't set it dynamically.
TOTAL_FLASH_MINIMUM - RESERVED_FLASH, // This is a minimum. We can't set it dynamically.
NULL,
BINARY_INFO_BLOCK_DEV_FLAG_READ |
BINARY_INFO_BLOCK_DEV_FLAG_WRITE |