Ensure flash address is set before obtaining memory mapped address.

Before this change the struck member add_phys would contain random data and the call to spi_flash_phys2cache
could return an incorrect memory address.
This commit is contained in:
h2zero 2022-05-22 21:51:47 -06:00 committed by Johny Mattsson
parent c75ec760aa
commit 484a7721b5
1 changed files with 1 additions and 1 deletions

View File

@ -31,8 +31,8 @@ bool lfs_get_location(lfs_location_info_t *out)
return false; // Nothing to do if no LFS partition available
out->size = part->size; // in bytes
out->addr_mem = spi_flash_phys2cache(out->addr_phys, SPI_FLASH_MMAP_DATA);
out->addr_phys = part->address;
out->addr_mem = spi_flash_phys2cache(out->addr_phys, SPI_FLASH_MMAP_DATA);
if (!out->addr_mem) { // not already mmap'd, have to do it ourselves
spi_flash_mmap_handle_t ignored;
esp_err_t err = spi_flash_mmap(