drivers/memory/spiflash: Add MICROPY_HW_SPIFLASH_ENABLE_CACHE option.

This only needs to be enabled if a board uses FAT FS on external SPI flash.
When disabled (and using external SPI flash) 4k of RAM can be saved.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2020-12-17 16:59:54 +11:00
parent 061cb1a73a
commit e43a74a4db
7 changed files with 27 additions and 0 deletions

View File

@@ -287,6 +287,8 @@ int mp_spiflash_write(mp_spiflash_t *self, uint32_t addr, size_t len, const uint
/******************************************************************************/
// Interface functions that use the cache
#if MICROPY_HW_SPIFLASH_ENABLE_CACHE
void mp_spiflash_cached_read(mp_spiflash_t *self, uint32_t addr, size_t len, uint8_t *dest) {
if (len == 0) {
return;
@@ -509,3 +511,5 @@ int mp_spiflash_cached_write(mp_spiflash_t *self, uint32_t addr, size_t len, con
mp_spiflash_release_bus(self);
return 0;
}
#endif // MICROPY_HW_SPIFLASH_ENABLE_CACHE