in components/ota_pal/source/ota_pal.c [700:733]
int16_t otaPal_WriteBlock(OtaFileContext_t *const pFileContext,
uint32_t iOffset,
uint8_t *const pacData,
uint32_t iBlockSize)
{
esp_err_t ret = 0;
if (_esp_ota_ctx_validate(pFileContext))
{
if (prvIsPatchFile((char *)pFileContext->pFilePath))
{
ret = esp_partition_write(ota_ctx.patch_partition, iOffset, pacData, iBlockSize);
}
else
{
ret = esp_ota_write_with_offset(ota_ctx.update_handle, pacData, iBlockSize, iOffset);
}
if (ret != ESP_OK)
{
LogError(("Couldn't flash at the offset %d", iOffset));
return -1;
}
ota_ctx.data_write_len += iBlockSize;
}
else
{
LogInfo(("Invalid OTA Context"));
return -1;
}
return iBlockSize;
}