stm32/storage: Introduce MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE cfg.
This config variable controls whether to support storage on the internal flash of the MCU. It is enabled by default and should be explicitly disabled by boards that don't want internal flash storage.
This commit is contained in:
parent
d1c4bd69df
commit
626d6c9756
|
@ -34,7 +34,7 @@
|
|||
#include "flash.h"
|
||||
#include "storage.h"
|
||||
|
||||
#if !defined(MICROPY_HW_SPIFLASH_SIZE_BITS)
|
||||
#if MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
|
||||
|
||||
// Here we try to automatically configure the location and size of the flash
|
||||
// pages to use for the internal storage. We also configure the location of the
|
||||
|
@ -265,4 +265,4 @@ bool flash_bdev_writeblock(const uint8_t *src, uint32_t block) {
|
|||
return true;
|
||||
}
|
||||
|
||||
#endif // !defined(MICROPY_HW_SPIFLASH_SIZE_BITS)
|
||||
#endif // MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
|
||||
|
|
|
@ -32,6 +32,11 @@
|
|||
/*****************************************************************************/
|
||||
// Feature settings with defaults
|
||||
|
||||
// Whether to enable storage on the internal flash of the MCU
|
||||
#ifndef MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
|
||||
#define MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE (1)
|
||||
#endif
|
||||
|
||||
// Whether to enable the RTC, exposed as pyb.RTC
|
||||
#ifndef MICROPY_HW_ENABLE_RTC
|
||||
#define MICROPY_HW_ENABLE_RTC (0)
|
||||
|
@ -136,6 +141,13 @@
|
|||
#error Unsupported MCU series
|
||||
#endif
|
||||
|
||||
#if MICROPY_HW_ENABLE_INTERNAL_FLASH_STORAGE
|
||||
// Provide block device macros if internal flash storage is enabled
|
||||
#define MICROPY_HW_BDEV_IOCTL flash_bdev_ioctl
|
||||
#define MICROPY_HW_BDEV_READBLOCK flash_bdev_readblock
|
||||
#define MICROPY_HW_BDEV_WRITEBLOCK flash_bdev_writeblock
|
||||
#endif
|
||||
|
||||
// Enable hardware I2C if there are any peripherals defined
|
||||
#if defined(MICROPY_HW_I2C1_SCL) || defined(MICROPY_HW_I2C2_SCL) \
|
||||
|| defined(MICROPY_HW_I2C3_SCL) || defined(MICROPY_HW_I2C4_SCL)
|
||||
|
|
|
@ -34,15 +34,6 @@
|
|||
#include "storage.h"
|
||||
#include "irq.h"
|
||||
|
||||
#if !defined(MICROPY_HW_SPIFLASH_SIZE_BITS)
|
||||
|
||||
// Use internal flash as the storage medium
|
||||
#define MICROPY_HW_BDEV_IOCTL flash_bdev_ioctl
|
||||
#define MICROPY_HW_BDEV_READBLOCK flash_bdev_readblock
|
||||
#define MICROPY_HW_BDEV_WRITEBLOCK flash_bdev_writeblock
|
||||
|
||||
#endif
|
||||
|
||||
#define FLASH_PART1_START_BLOCK (0x100)
|
||||
|
||||
static bool storage_is_initialised = false;
|
||||
|
|
Loading…
Reference in New Issue