diff --git a/bdev.c b/bdev.c index 18b5b85..308d3bb 100644 --- a/bdev.c +++ b/bdev.c @@ -13,14 +13,18 @@ STATIC const mp_soft_spi_obj_t soft_spi_bus = { .miso = MICROPY_HW_SPIFLASH_MISO, }; +#if MICROPY_HW_SPIFLASH_ENABLE_CACHE STATIC mp_spiflash_cache_t spi_bdev_cache; +#endif const mp_spiflash_config_t spiflash_config = { .bus_kind = MP_SPIFLASH_BUS_SPI, .bus.u_spi.cs = MICROPY_HW_SPIFLASH_CS, .bus.u_spi.data = (void*)&soft_spi_bus, .bus.u_spi.proto = &mp_soft_spi_proto, +#if MICROPY_HW_SPIFLASH_ENABLE_CACHE .cache = &spi_bdev_cache, +#endif }; spi_bdev_t spi_bdev; diff --git a/mpconfigboard.h b/mpconfigboard.h index f439be3..0cd99b7 100644 --- a/mpconfigboard.h +++ b/mpconfigboard.h @@ -4,7 +4,10 @@ // 1 = use internal flash (1 MByte) // 0 = use onboard SPI flash (2 MByte) Winbond W25Q16 -#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1) +#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0) +#if !BUILDING_MBOOT +#define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1) +#endif #define MICROPY_HW_HAS_SWITCH (1) // has 1 button KEY0 #define MICROPY_HW_HAS_FLASH (1) @@ -12,7 +15,7 @@ #define MICROPY_HW_ENABLE_RTC (1) #define MICROPY_HW_ENABLE_DAC (1) #define MICROPY_HW_ENABLE_USB (1) -#define MICROPY_HW_ENABLE_SDCARD (0) // it has a sd scard, but i am not sure what the detect pin is, yet +#define MICROPY_HW_ENABLE_SDCARD (1) // HSE is 8MHz #define MICROPY_HW_CLK_PLLM (8) // divide external clock by this to get 1MHz