Flash memory size
The RP2040 auto-detects its flash memory size on powerup (assuming you are using an IC that supports the method it uses).
Max flash size: 16MB (128Mbit)
Using flash memory for data storage
The entire memory is readable and writable from code. Your program is stored from address 0x00000000. The free area after it is available for data storage.
Writing flash memory
FLASH_SECTOR_SIZE is 4K / 4096 bytes (min amount to erase)
FLASH_PAGE_SIZE is 256 bytes (min write size)
Erasing resets all bits to 1 (0xFF bytes). Programming is the act of flipping zero bits from 1 to 0. So in theory, you could program a page multiple times to program less than 256 byte values at once, and simply have all bytes you are not attempting to program set to 0xFF in the buffer you are programming from. As you are not re-writing previously written 0’s, no additional wear will occur for each additional write on the same page.