Write a specified portion of data to SPI Flash.
.
- Parameters
-
[in] | pu8Buf | Pointer to data buffer which contains the required to be written. |
[in] | u32Offset | Address (Offset) to write at the SPI flash. |
[in] | u32Sz | Total number of size of data bytes |
- Note
- It is blocking function
- It is user's responsibility to verify that data has been written successfully by reading data again and compare it with the original.
- Warning
- Address (offset) plus size of data must not exceed flash size.
- No firmware is required for writing to SPI flash.
- In case of there is a running firmware, it is required to pause your firmware first before any trial to access SPI flash to avoid any racing between host and running firmware on bus using m2m_wifi_download_mode.
- Before writing to any section, it is required to erase it first.
- See Also
- m2m_wifi_download_mode, spi_flash_get_size, spi_flash_erase
- Returns
- The function returns M2M_SUCCESS for successful operations and a negative value otherwise.
References BSP_MIN, FLASH_PAGE_SZ, M2M_ERR, M2M_ERR_FAIL, M2M_PRINT, M2M_SUCCESS, and spi_flash_pp().