Need a way to reserve flash sectors #1378

Open
opened 2023-05-17 04:12:33 -05:00 by peterharperuk · 2 comments
peterharperuk commented 2023-05-17 04:12:33 -05:00 (Migrated from github.com)

The BT code uses two sectors at the end of flash for saving pairing info. As more people need to use flash it will get harder to coordinate flash allocations. We need some sort of API that allocates flash memory at runtime to avoid clashes?

The BT code uses two sectors at the end of flash for saving pairing info. As more people need to use flash it will get harder to coordinate flash allocations. We need some sort of API that allocates flash memory at runtime to avoid clashes?
peterharperuk commented 2023-05-17 04:12:59 -05:00 (Migrated from github.com)

@kilograham

@kilograham
geurtv commented 2023-05-31 03:09:01 -05:00 (Migrated from github.com)

Alternatively or additionally maybe provide a more generalized storage callback interface, with some default implementations. This way the user can decide where and how stuff should be stored. For instance if a filesystem is already used (like littlefs or fatfs) the user might want to store configuration values in files. Something like:

struct storage_interface {
    void* user_data;
    size_t (*load_value)(void* udata, const char* key, void* buffer, size_t size);
    void (*store_value)(void* udata, const char* key, const void* buffer, size_t size);
    // ... more? get_value_size?
};
Alternatively or additionally maybe provide a more generalized storage callback interface, with some default implementations. This way the user can decide where and how stuff should be stored. For instance if a filesystem is already used (like littlefs or fatfs) the user might want to store configuration values in files. Something like: ```c struct storage_interface { void* user_data; size_t (*load_value)(void* udata, const char* key, void* buffer, size_t size); void (*store_value)(void* udata, const char* key, const void* buffer, size_t size); // ... more? get_value_size? }; ```
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1378
No description provided.