How to set Flash parameters for RP2040 board?

I’m trying to use an external flash chip as a FAT storage, to expose through USB CSC

Adafruit SPIFlash for the RP2040 requires you to set the flash size “through the Arduino IDE Tools->Flash menu”

I’ve found the entries in the boards.txt, e.g.

challenger_2040_wifi_ble.menu.flash.16777216_15728640.upload.maximum_size=1044480
challenger_2040_wifi_ble.menu.flash.16777216_15728640.build.flash_total=16777216
challenger_2040_wifi_ble.menu.flash.16777216_15728640.build.flash_length=1044480
challenger_2040_wifi_ble.menu.flash.16777216_15728640.build.eeprom_start=285208576
challenger_2040_wifi_ble.menu.flash.16777216_15728640.build.fs_start=269479936
challenger_2040_wifi_ble.menu.flash.16777216_15728640.build.fs_end=285208576

But what do I do with these?

the pico board json doesnt mention flash size/FS size at all.

Doing board_ overrides in platformio.ini using the names from boards.txt has no effect.

I can see this block inside Adafruit_FlashTransport_RP2040.cpp

// symbol from linker that matches 'Tools->Flash Size' menu selection for
// filesystem
extern uint8_t _FS_start;
extern uint8_t _FS_end;

Am I supposed to overwrite/define these in code?

What values do I give them, they are uint8_ts, and the code does this:

// FS Size determined by menu selection
#define MENU_FS_SIZE ((uint32_t)(&_FS_end - &_FS_start))

i.e gets the address of the variables, as though they already exist in ram, but at the flash locations… How do I set this in CPP (if necessary)?

Any other tips on my objective greatly received.

Thanks

Andrew

Per documentation:

To set “Filesystem size”: https://arduino-pico.readthedocs.io/en/latest/platformio.html#flash-size

To set the “Flash Size”: Override the maximum_size in the "upload" section of the board. In general see https://docs.platformio.org/en/latest/boards/raspberrypi/pico.html#configuration.

In total, e.g.,

; 2 MByte of Flash, 1MByte of which is reserved for filesystem
board_upload.maximum_size = 2097152
board_build.filesystem_size = 1m

Given that you should already chose a board = .. that has the correct flash size of the board you physically have, you only need to set the filesystem size.

Ughh i missed that. Will try tomorrow, thanks.

My board is a pico, but has a 16mb qspi flash on it.

How come the standard pico.json doesnt mention any fs size at all?

Thanks

16 Megabit or 16 Megabyte? The standard Pico comes with 2MByte (W25Q16 = 16Mbit). Meaning, board = pico or board = rpipico is already correct to set up the base amount of flash.

Doh. Yeah its MBit

Thanks