Merge branch 'bugfix/fix_phy_data_partition_restoring_default_fails_issue_v5.0' into 'release/v5.0'

fix(phy): fix phy data partition restoring default fails issue(Backport v5.0)

See merge request espressif/esp-idf!38552
This commit is contained in:
Jiang Jiang Jian
2025-04-21 11:06:31 +08:00

View File

@@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2015-2025 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@@ -478,6 +478,13 @@ const esp_phy_init_data_t* esp_phy_get_init_data(void)
assert(memcmp(init_data_store + init_data_store_length - sizeof(phy_init_magic_post), assert(memcmp(init_data_store + init_data_store_length - sizeof(phy_init_magic_post),
PHY_INIT_MAGIC, sizeof(phy_init_magic_post)) == 0); PHY_INIT_MAGIC, sizeof(phy_init_magic_post)) == 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) {