Function esp_idf_svc::hal::sys::esp_flash_erase_region
source · pub unsafe extern "C" fn esp_flash_erase_region(
chip: *mut esp_flash_t,
start: u32,
len: u32,
) -> i32
Expand description
@brief Erase a region of the 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 start Address to start erasing flash. Must be sector aligned. @param len Length of region to erase. Must also be sector aligned.
Sector size is specifyed in chip->drv->sector_size field (typically 4096 bytes.) ESP_ERR_INVALID_ARG will be returned if the start & length are not a multiple of this size.
Erase is performed using block (multi-sector) erases where possible (block size is specified in chip->drv->block_erase_size field, typically 65536 bytes). Remaining sectors are erased using individual sector erase commands.
@return - ESP_OK on success, - 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 (start – start + len) overlaps with a read-only partition address space - Other flash error code if operation failed.