Skip to content

Commit

Permalink
Clear cache after writes, not before
Browse files Browse the repository at this point in the history
  • Loading branch information
will-v-pi committed Dec 19, 2024
1 parent 1a59599 commit 474d1c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1980,7 +1980,6 @@ struct picoboot_memory_access : public memory_access {
void write(uint32_t address, uint8_t *buffer, unsigned int size) override {
vector<uint8_t> write_data; // used when erasing flash
if (flash == get_memory_type(address, model)) {
clear_cache(); // clear entire flash cache on any write, to be safe
connection.exit_xip();
if (erase) {
// Do automatically erase flash, and make it aligned
Expand Down Expand Up @@ -2014,6 +2013,7 @@ struct picoboot_memory_access : public memory_access {
}
if (is_transfer_aligned(address, model) && is_transfer_aligned(address + size, model)) {
connection.write(address, (uint8_t *) buffer, size);
clear_cache(); // clear entire flash cache after any write, to be safe
} else {
// for write, we must be correctly sized/aligned in 256 byte chunks
std::stringstream sstream;
Expand Down

0 comments on commit 474d1c3

Please sign in to comment.