mcauser / WEACT_F411CEU6

MicroPython board definition for the WeAct STM32F411CEU6 board
121 stars 33 forks source link

Build error with use external Flash. #14

Open water5 opened 1 year ago

water5 commented 1 year ago

When I modify micropython/ports/stm32/boards/WEACT_F411CEU6/mpconfigboard.h

#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (0)

Then build with make BOARD=WEACT_F411CEU6, appear error:

...

CC boards/WEACT_F411CEU6/bdev.c boards/WEACT_F411CEU6/bdev.c:16:8: error: unknown type name 'mp_spiflash_cache_t' 16 | STATIC mp_spiflash_cache_t spi_bdev_cache; | ^~~~~~~ boards/WEACT_F411CEU6/bdev.c:23:6: error: 'const struct _mp_spiflash_config_t' has no member named 'cache' 23 | .cache = &spi_bdev_cache, | ^~~~~ boards/WEACT_F411CEU6/bdev.c:23:14: error: excess elements in struct initializer [-Werror] 23 | .cache = &spi_bdev_cache, | ^ boards/WEACT_F411CEU6/bdev.c:23:14: note: (near initialization for 'spiflash_config') cc1: all warnings being treated as errors See https://github.com/micropython/micropython/wiki/Build-Troubleshooting make: *** [../../py/mkrules.mk:83: build-WEACT_F411CEU6/boards/WEACT_F411CEU6/bdev.o] Error 1

When use

#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1)

have not this issue.

water5 commented 1 year ago

Seems these boards have similar issue, BLACK_F407VE BLACK_F407ZE BLACK_F407ZG

in mpconfigboard.h

#define MICROPY_HW_BDEV_IOCTL(op, arg) ( \
    (op) == BDEV_IOCTL_NUM_BLOCKS ? (MICROPY_HW_SPIFLASH_SIZE_BITS / 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)) \
)
#define MICROPY_HW_BDEV_READBLOCKS(dest, bl, n) spi_bdev_readblocks(&spi_bdev, (dest), (bl), (n))
#define MICROPY_HW_BDEV_WRITEBLOCKS(src, bl, n) spi_bdev_writeblocks(&spi_bdev, (src), (bl), (n))

refer VCC_GND_F407ZG board's mpconfigboard.h and change to:

#define MICROPY_HW_SPIFLASH_ENABLE_CACHE (1)
#define MICROPY_HW_BDEV_SPIFLASH    (&spi_bdev)
#define MICROPY_HW_BDEV_SPIFLASH_CONFIG (&spiflash_config)
#define MICROPY_HW_BDEV_SPIFLASH_SIZE_BYTES (MICROPY_HW_SPIFLASH_SIZE_BITS / 8)

build success. These boards use similar SPI Flash, what different/why between two code block above?