Skip to content

Commit 88ca001

Browse files
committed
Only use flash caching for info
It only offers a performance improvement when the same flash is read multiple times, such as with block searches in `info` It can degrade performance in other situations such as `save` which have no need for a cache
1 parent 3c12226 commit 88ca001

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

main.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,7 @@ struct _settings {
412412
uint32_t family_id = 0;
413413
bool quiet = false;
414414
bool verbose = false;
415+
bool use_flash_cache = false;
415416

416417
struct {
417418
int redundancy = -1;
@@ -1867,7 +1868,7 @@ struct picoboot_memory_access : public memory_access {
18671868
}
18681869

18691870
void read(uint32_t address, uint8_t *buffer, unsigned int size, __unused bool zero_fill) override {
1870-
if (flash == get_memory_type(address, model)) {
1871+
if (flash == get_memory_type(address, model) && settings.use_flash_cache) {
18711872
read_cached(address, buffer, size);
18721873
} else {
18731874
read_raw(address, buffer, size);
@@ -3024,6 +3025,8 @@ void info_guts(memory_access &raw_access, picoboot::connection *con) {
30243025
#else
30253026
void info_guts(memory_access &raw_access, void *con) {
30263027
#endif
3028+
// Use flash caching
3029+
settings.use_flash_cache = true;
30273030
try {
30283031
struct group {
30293032
explicit group(string name, bool enabled = true, int min_tab = 0) : name(std::move(name)), enabled(enabled), min_tab(min_tab) {}

0 commit comments

Comments
 (0)