fix(efuse): do not abort startup when ROM log eFuse burn fails

If the UART_PRINT_CONTROL eFuse could not be burned (already burned to
a different scheme, or write-protected, e.g. via the WR_DIS bit shared
with DIS_DOWNLOAD_MODE), the error propagated out of the startup init
function and the device aborted into a permanent boot loop. This is
especially harmful when CONFIG_BOOT_ROM_LOG_ALWAYS_OFF is first enabled
on provisioned devices via an OTA update.

The ROM log scheme only affects ROM console output, so a failed burn
now logs a warning and boot continues, restoring the behavior from
before commit 75c92c3a66.
This commit is contained in:
Aditya Patwardhan
2026-09-21 11:42:11 +05:30
parent 8b1ad80381
commit 1a50b7d8c3
+10 -6
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2024 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -142,15 +142,19 @@ static esp_err_t init_efuse_secure(void)
#endif
#ifdef ROM_LOG_MODE
static esp_err_t init_efuse_rom_log(void)
static void init_efuse_rom_log(void)
{
// Applicable for any chips except ESP32: Permanently disable ROM startup logs
if (ets_efuse_get_uart_print_control() != ROM_LOG_MODE) {
// The ROM log scheme only affects the ROM console output, so a failure to
// burn it must not prevent the device from booting.
esp_err_t error = esp_efuse_set_rom_log_scheme(ROM_LOG_MODE);
error = (error == ESP_ERR_NOT_SUPPORTED) ? ESP_OK : error;
ESP_RETURN_ON_ERROR(error, TAG, "Failed to set ROM log scheme");
if (error == ESP_ERR_INVALID_STATE) {
ESP_LOGW(TAG, "ROM log scheme is already burned to a different value or write protected, ignoring");
} else if (error != ESP_OK && error != ESP_ERR_NOT_SUPPORTED) {
ESP_LOGW(TAG, "Failed to set ROM log scheme (%s), continuing boot", esp_err_to_name(error));
}
}
return ESP_OK;
}
#endif // ROM_LOG_MODE
@@ -166,7 +170,7 @@ ESP_SYSTEM_INIT_FN(init_efuse, CORE, BIT(0), 140)
ESP_RETURN_ON_ERROR(error, TAG, "Failed in secure eFuse init");
#ifdef ROM_LOG_MODE
error = init_efuse_rom_log();
init_efuse_rom_log();
#endif
return error;