From 2b9900380ad2d0ab232e5e3a93c64aaddf90c55a Mon Sep 17 00:00:00 2001 From: Damien George Date: Fri, 12 Jun 2020 10:15:25 +1000 Subject: [PATCH] stm32/boards/STM32F769DISC: Use macro instead of const for flash size. So that the flash size can be changed in just one place. Also remove the duplicate cache entry. --- ports/stm32/boards/STM32F769DISC/board_init.c | 1 - ports/stm32/boards/STM32F769DISC/mpconfigboard.h | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/ports/stm32/boards/STM32F769DISC/board_init.c b/ports/stm32/boards/STM32F769DISC/board_init.c index 67fad407a0..6bb3dfb1f6 100644 --- a/ports/stm32/boards/STM32F769DISC/board_init.c +++ b/ports/stm32/boards/STM32F769DISC/board_init.c @@ -9,7 +9,6 @@ const mp_spiflash_config_t spiflash_config = { .bus_kind = MP_SPIFLASH_BUS_QSPI, .bus.u_qspi.data = NULL, .bus.u_qspi.proto = &qspi_proto, - .cache = NULL, .cache = &spi_bdev_cache, }; diff --git a/ports/stm32/boards/STM32F769DISC/mpconfigboard.h b/ports/stm32/boards/STM32F769DISC/mpconfigboard.h index 8dbac2d015..e1fe93bb0e 100644 --- a/ports/stm32/boards/STM32F769DISC/mpconfigboard.h +++ b/ports/stm32/boards/STM32F769DISC/mpconfigboard.h @@ -41,7 +41,7 @@ extern struct _spi_bdev_t spi_bdev; #if !USE_QSPI_XIP #define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0) #define MICROPY_HW_BDEV_IOCTL(op, arg) ( \ - (op) == BDEV_IOCTL_NUM_BLOCKS ? (64 * 1024 * 1024 / FLASH_BLOCK_SIZE) : \ + (op) == BDEV_IOCTL_NUM_BLOCKS ? ((1 << MICROPY_HW_QSPIFLASH_SIZE_BITS_LOG2) / 8 / FLASH_BLOCK_SIZE) : \ (op) == BDEV_IOCTL_INIT ? spi_bdev_ioctl(&spi_bdev, (op), (uint32_t)&spiflash_config) : \ spi_bdev_ioctl(&spi_bdev, (op), (arg)) \ )