raspberrypi / pico-examples

BSD 3-Clause "New" or "Revised" License
2.84k stars 820 forks source link

Read size of current program #438

Closed yspreen closed 10 months ago

yspreen commented 10 months ago

If I want to use the flash, how can I know which bytes are writeable? How can I tell where my program ends / how big it is? The nuke program just hard-codes 256k but that's not enough for a larger program. I can start writing at 1M but it'd be good to actually know the right spot? The uf2 is 900k but apparently that's not one to one

peterharperuk commented 10 months ago

flash size:

PICO_FLASH_SIZE_BYTES

where your program ends:

extern char __flash_binary_end; uintptr_t program_end = ((uintptr_t)&__flash_binary_end - XIP_BASE;

Please use the forum for questions https://forums.raspberrypi.com/viewforum.php?f=145