@ -26,7 +26,7 @@ void board_early_init(void);
# define MICROPY_HW_FLASH_LATENCY FLASH_LATENCY_7 // 210-216 MHz needs 7 wait states
// 512MBit external QSPI flash, to be memory mapped
// 512MBit external QSPI flash, used for either the filesystem or XIP memory mapped
# define MICROPY_HW_QSPIFLASH_SIZE_BITS_LOG2 (29)
# define MICROPY_HW_QSPIFLASH_CS (pin_B6)
# define MICROPY_HW_QSPIFLASH_SCK (pin_B2)
@ -35,6 +35,21 @@ void board_early_init(void);
# define MICROPY_HW_QSPIFLASH_IO2 (pin_E2)
# define MICROPY_HW_QSPIFLASH_IO3 (pin_D13)
// SPI flash, block device config (when used as the filesystem)
extern const struct _mp_spiflash_config_t spiflash_config ;
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_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))
# define MICROPY_HW_BDEV_SPIFLASH_EXTENDED (&spi_bdev) // for extended block protocol
# endif
// UART config
# define MICROPY_HW_UART1_TX (pin_A9)
# define MICROPY_HW_UART1_RX (pin_A10)
@ -199,11 +214,9 @@ void board_early_init(void);
// Bootloader configuration
// Give Mboot access to the external QSPI flash
extern const struct _mp_spiflash_config_t spiflash_config ;
extern struct _mp_spiflash_t spiflash_instance ;
# define MBOOT_SPIFLASH_ADDR (0x90000000)
# define MBOOT_SPIFLASH_BYTE_SIZE (512 * 128 * 1024)
# define MBOOT_SPIFLASH_LAYOUT " / 0x90000000 / 512*128Kg"
# define MBOOT_SPIFLASH_ERASE_BLOCKS_PER_PAGE (128 / 4) // 128k page, 4k erase block
# define MBOOT_SPIFLASH_CONFIG (&spiflash_config)
# define MBOOT_SPIFLASH_SPIFLASH (&spiflash_instance )
# define MBOOT_SPIFLASH_SPIFLASH (&spi_bdev.spi flash)