Flash#
Interface to internal flash.
Used for writing application images to the main flash.
Used for writing/reading/erasing data to the main flash.
Functions#
Erase a flash page.
Write buffer to internal flash.
Write buffer to internal flash.
Erase the raw storage.
Write a number of words to raw storage.
Read number of words from raw storage.
Macros#
DMA Channel for MSC write.
Function Documentation#
flash_erasePage#
bool flash_erasePage (uint32_t address)
Erase a flash page.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint32_t | [in] | address | Start address of the flash page to erase. |
Returns
True if operation was successful
flash_writeBuffer_dma#
bool flash_writeBuffer_dma (uint32_t address, const void * data, size_t length, int ch)
Write buffer to internal flash.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint32_t | N/A | address | Starting address to write data to. Must be half-word aligned. |
| const void * | N/A | data | Data buffer to write to internal flash |
| size_t | N/A | length | Amount of bytes in the data buffer to write |
| int | N/A | ch | DMA channel to use |
Returns
True if operation was successful
flash_writeBuffer#
bool flash_writeBuffer (uint32_t address, const void * data, size_t length)
Write buffer to internal flash.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint32_t | N/A | address | Starting address to write data to. Must be half-word aligned. |
| const void * | N/A | data | Data buffer to write to internal flash |
| size_t | N/A | length | Amount of bytes in the data buffer to write |
Returns
True if operation was successful
storage_eraseRaw#
int32_t storage_eraseRaw (uint32_t address, size_t length)
Erase the raw storage.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint32_t | N/A | address | Start address of the region to erase |
| size_t | N/A | length | Number of bytes to erase |
Note
Some devices, such as Flash-based storages, have restrictions on the alignment and size of erased regions. The details of the limitations of a particular storage can be found by reading the BootloaderStorageInformation_t struct using storage_getInfo.
Returns
BOOTLOADER_OK on success, else error code in BOOTLOADER_ERROR_STORAGE_BASE range
storage_writeRaw#
int32_t storage_writeRaw (uint32_t address, const uint8_t * buffer, size_t length)
Write a number of words to raw storage.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint32_t | N/A | address | The raw address of the storage. |
| const uint8_t * | N/A | buffer | Pointer to data to write. |
| size_t | N/A | length | Length of data to write. Must be a multiple of 4. |
Returns
BOOTLOADER_OK on success, else error code in BOOTLOADER_ERROR_STORAGE_BASE range
storage_readRaw#
int32_t storage_readRaw (uint32_t address, uint8_t * buffer, size_t length)
Read number of words from raw storage.
| Type | Direction | Argument Name | Description |
|---|---|---|---|
| uint32_t | N/A | address | The raw address of the storage. |
| uint8_t * | N/A | buffer | Pointer to the buffer to store read data in. |
| size_t | N/A | length | Number of bytes to read. |
Returns
BOOTLOADER_OK on success, else error code in BOOTLOADER_ERROR_STORAGE_BASE range