Function esp_idf_svc::sys::esp_flash_write

source ·
pub unsafe extern "C" fn esp_flash_write(
    chip: *mut esp_flash_t,
    buffer: *const c_void,
    address: u32,
    length: u32,
) -> i32
Expand description

@brief Write data to the SPI flash chip

@param chip Pointer to identify flash chip. If NULL, esp_flash_default_chip is substituted. Must have been successfully initialised via esp_flash_init() @param address Address on flash to write to. Must be previously erased (SPI NOR flash can only write bits 1->0). @param buffer Pointer to a buffer with the data to write. To get better performance, this should be in the DRAM and word aligned. @param length Length (in bytes) of data to write.

There are no alignment constraints on buffer, address or length.

@return - ESP_OK on success - ESP_FAIL, bad write, this will be detected only when CONFIG_SPI_FLASH_VERIFY_WRITE is enabled - ESP_ERR_NOT_SUPPORTED if the chip is not able to perform the operation. This is indicated by WREN = 1 after the command is sent. - ESP_ERR_NOT_ALLOWED if the address range (address – address + length) overlaps with a read-only partition address space - Other flash error code if operation failed.