mirror of
https://github.com/raspberrypi/pico-sdk.git
synced 2026-01-28 01:47:21 +01:00
Flash functions in PICO_NO_FLASH binaries
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. Fixes #2796
This commit is contained in:
parent
9c6713a8ed
commit
e3087ddd99
3 changed files with 8 additions and 3 deletions
|
|
@ -248,7 +248,7 @@ void __no_inline_not_in_flash_func(flash_range_program)(uint32_t flash_offs, con
|
|||
//-----------------------------------------------------------------------------
|
||||
// Lower-level flash access functions
|
||||
|
||||
#if !PICO_NO_FLASH
|
||||
#if !PICO_NO_FLASH || PICO_INCLUDE_FLASH_FUNCTIONS
|
||||
// Bitbanging the chip select using IO overrides, in case RAM-resident IRQs
|
||||
// are still running, and the FIFO bottoms out. (the bootrom does the same)
|
||||
static void __no_inline_not_in_flash_func(flash_cs_force)(bool high) {
|
||||
|
|
@ -334,7 +334,7 @@ void __no_inline_not_in_flash_func(flash_do_cmd)(const uint8_t *txbuf, uint8_t *
|
|||
static_assert(FLASH_UNIQUE_ID_SIZE_BYTES == FLASH_RUID_DATA_BYTES, "");
|
||||
|
||||
void flash_get_unique_id(uint8_t *id_out) {
|
||||
#if PICO_NO_FLASH
|
||||
#if PICO_NO_FLASH && !PICO_INCLUDE_FLASH_FUNCTIONS
|
||||
__unused uint8_t *ignore = id_out;
|
||||
panic_unsupported();
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -52,6 +52,11 @@
|
|||
|
||||
// PICO_CONFIG: PICO_FLASH_SIZE_BYTES, size of primary flash in bytes, type=int, default=Usually provided via board header, group=hardware_flash
|
||||
|
||||
// PICO_CONFIG: PICO_INCLUDE_FLASH_FUNCTIONS, Force inclusion of flash functions in PICO_NO_FLASH binaries. Has no effect in flash binaries, type=bool, default=0, group=hardware_flash
|
||||
#ifndef PICO_INCLUDE_FLASH_FUNCTIONS
|
||||
#define PICO_INCLUDE_FLASH_FUNCTIONS 0
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ static pico_unique_board_id_t retrieved_id;
|
|||
|
||||
static void __attribute__((PICO_UNIQUE_BOARD_ID_INIT_ATTRIBUTES)) _retrieve_unique_id_on_boot(void) {
|
||||
#if PICO_RP2040
|
||||
#if PICO_NO_FLASH
|
||||
#if PICO_NO_FLASH && !PICO_INCLUDE_FLASH_FUNCTIONS
|
||||
// The hardware_flash call will panic() if called directly on a NO_FLASH
|
||||
// build. Since this constructor is pre-main it would be annoying to
|
||||
// debug, so just produce something well-defined and obviously wrong.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue