Function esp_idf_sys::esp_flash_write_encrypted

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

@brief Encrypted and write data to the SPI flash chip using on-chip hardware flash encryption

@param chip Pointer to identify flash chip. Must be NULL (the main flash chip). For other chips, encrypted write is not supported. @param address Address on flash to write to. 16 byte aligned. Must be previously erased (SPI NOR flash can only write bits 1->0). @param buffer Pointer to a buffer with the data to write. @param length Length (in bytes) of data to write. 16 byte aligned.

@note Both address & length must be 16 byte aligned, as this is the encryption block size

@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: encrypted write not supported for this chip.
  • ESP_ERR_INVALID_ARG: Either the address, buffer or length is invalid.
  • ESP_ERR_NOT_ALLOWED if the address range (address – address + length) overlaps with a read-only partition address space