fix(phy): fix phy data partition restoring default fails issue

Closes https://github.com/espressif/esp-idf/issues/14698
This commit is contained in:
muhaidong
2025-04-10 21:17:05 +08:00
parent fcd5c75e3a
commit 57fd0fe836

View File

@ -611,6 +611,13 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
assert(memcmp(init_data_store + init_data_store_length - PHY_INIT_MAGIC_LEN, assert(memcmp(init_data_store + init_data_store_length - PHY_INIT_MAGIC_LEN,
PHY_INIT_MAGIC, PHY_INIT_MAGIC_LEN) == 0); PHY_INIT_MAGIC, PHY_INIT_MAGIC_LEN) == 0);
err = esp_partition_erase_range(partition, 0, partition->size);
if (err != ESP_OK) {
ESP_LOGE(TAG, "failed to erase partition (0x%x)!", err);
free(init_data_store);
return NULL;
}
// write default data // write default data
err = esp_partition_write(partition, 0, init_data_store, init_data_store_length); err = esp_partition_write(partition, 0, init_data_store, init_data_store_length);
if (err != ESP_OK) { if (err != ESP_OK) {