Skip to content

Flash functions in PICO_NO_FLASH binaries#2759

Merged
kilograham merged 2 commits into
raspberrypi:developfrom
peterharperuk:flash_functions_with_pico_no_flash
Jun 23, 2026
Merged

Flash functions in PICO_NO_FLASH binaries#2759
kilograham merged 2 commits into
raspberrypi:developfrom
peterharperuk:flash_functions_with_pico_no_flash

Conversation

@peterharperuk

@peterharperuk peterharperuk commented Dec 12, 2025

Copy link
Copy Markdown
Contributor

We assume that PICO_NO_FLASH binaries means the device does not have a flash chip. But it's possible that you want a ram binary AND want to mess about with flash, e.g. something that uses the unique flash id.

Add PICO_INCLUDE_FLASH_FUNCTIONS which forces some flash functions to be included.

@peterharperuk

Copy link
Copy Markdown
Contributor Author

Needed for this raspberrypi/pico-examples#653

@will-v-pi

Copy link
Copy Markdown
Contributor

Probably would be nicer if PICO_INCLUDE_FLASH_UTILS defaulted to !PICO_NO_FLASH, rather than needing to check both in all the #ifs?

#ifndef PICO_INCLUDE_FLASH_UTILS 
#define PICO_INCLUDE_FLASH_UTILS  !PICO_NO_FLASH
#endif

It would also need a PICO_CONFIG comment, so it appears in the docs

@peterharperuk

Copy link
Copy Markdown
Contributor Author

defaulted to !PICO_NO_FLASH

Then you would be able to remove these functions by setting PICO_INCLUDE_FLASH_UTILS=0 in flash builds. Which will cause odd behaviour?

@peterharperuk peterharperuk force-pushed the flash_functions_with_pico_no_flash branch 2 times, most recently from e3779f5 to 59aa1e7 Compare December 12, 2025 14:02
@peterharperuk peterharperuk force-pushed the flash_functions_with_pico_no_flash branch from 59aa1e7 to e3087dd Compare January 13, 2026 13:10
@lurch lurch linked an issue Jan 13, 2026 that may be closed by this pull request
@kilograham kilograham added this to the 2.2.1 milestone Mar 2, 2026
@kilograham kilograham self-assigned this Mar 2, 2026
@will-v-pi

Copy link
Copy Markdown
Contributor

I've ended up adding the first bit to allow flash_do_cmd in no_flash binaries in my PSRAM PR #2919 - maybe the other half of this would be better expressed as PICO_INCLUDE_FLASH_ID_FUNCTIONS instead?

@kilograham

Copy link
Copy Markdown
Contributor

can we revisit this now with @will-v-pi referenced changes

We assume that PICO_NO_FLASH binaries means the device does not have
a flash chip. But it's possible that you want a ram binary AND want
to use the unique flash id functionality.

Add PICO_INCLUDE_FLASH_ID_FUNCTIONS to force the inclusion of these
flash functions in ram binaries.

Fixes raspberrypi#2796
@peterharperuk peterharperuk force-pushed the flash_functions_with_pico_no_flash branch from e3087dd to 24869d5 Compare June 9, 2026 13:44
@peterharperuk

Copy link
Copy Markdown
Contributor Author

I've updated this.

will-v-pi
will-v-pi previously approved these changes Jun 9, 2026

@kilograham kilograham left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i will come back to this - need to think of a better name i think

@kilograham kilograham self-assigned this Jun 10, 2026
Comment thread src/rp2_common/hardware_flash/include/hardware/flash.h Outdated
To PICO_ALWAYS_INCLUDE_FLASH_ID_FUNCTIONS.
@kilograham kilograham merged commit 9e79881 into raspberrypi:develop Jun 23, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

flash_get_unique_id panic with not supported in no flash builds

4 participants