FlashIAP class hierarchy
The flash in application programming provides an interface for access to MCU internal flash memory.
Flash IAP devices have different sized blocks for different operations. They allow you to read and program in defined-sized pages, but you must erase them in defined-sized sectors. The sector size must be a multiple of the page size. Sector sizes can differ within a device.
Flash IAP provides the following functionality:
- Read from a flash device.
- Program data to flash device pages.
- Erase flash device sectors.
- Get sector/flash or page sizes.
- Get the start address of the flash device.
Flash devices have some requirements and limitations based on the operation. Please read the documentation for each operation.
Be aware that Flash IAP might disable interrupts for a long time. This can affect the application latency.
This class is thread-safe.
Flash IAP class reference
View the full C++ API:
|Public Member Functions|
|Initialize a flash IAP device. More...|
|Deinitialize a flash IAP device. More...|
|int||read (void *buffer, uint32_t addr, uint32_t size)|
|Read data from a flash device. More...|
|int||program (const void *buffer, uint32_t addr, uint32_t size)|
|Program data to pages. More...|
|int||erase (uint32_t addr, uint32_t size)|
|Erase sectors. More...|
|uint32_t||get_sector_size (uint32_t addr) const|
|Get the sector size at the defined address. More...|
|uint32_t||get_flash_start () const|
|Get the flash start address. More...|
|uint32_t||get_flash_size () const|
|Get the flash size. More...|
|uint32_t||get_page_size () const|
|Get the program page size. More...|
|uint8_t||get_erase_value () const|
|Get the flash erase value. More...|
Flash IAP example
For a program that uses the
FlashIAP driver, please see the Mbed Stress Test.