feat(bootloader): Support recovery bootloader for ESP32P4/C61

This commit is contained in:
Konstantin Kondrashov
2026-05-13 10:18:15 +03:00
parent 98d74cb7e6
commit a742bd519a
17 changed files with 109 additions and 74 deletions
+21 -1
View File
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2022-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -44,6 +44,8 @@ typedef enum {
#define EFUSE_LL_HAS_ECDSA_KEY_P384 (1)
#define EFUSE_LL_HAS_PSRAM_ENCRYPTION_XTS_AES_128 (1)
#define EFUSE_LL_HAS_PSRAM_ENCRYPTION_XTS_AES_256 (1)
// Rev 3.00+: Recovery bootloader eFuse field is present.
#define EFUSE_LL_HAS_RECOVERY_BOOTLOADER (1)
#endif
// Always inline these functions even no gcc optimization is applied.
@@ -112,6 +114,24 @@ __attribute__((always_inline)) static inline uint32_t efuse_ll_get_chip_ver_pkg(
return EFUSE.rd_mac_sys_2.pkg_version;
}
#if EFUSE_LL_HAS_RECOVERY_BOOTLOADER
__attribute__((always_inline)) static inline uint32_t efuse_ll_get_recovery_bootloader_sector(void)
{
return ((uint32_t)EFUSE.rd_repeat_data1.recovery_bootloader_flash_sector_11_11 << 11) |
((uint32_t)EFUSE.rd_repeat_data1.recovery_bootloader_flash_sector_8_10 << 8) |
((uint32_t)EFUSE.rd_repeat_data0.recovery_bootloader_flash_sector_7_7 << 7) |
((uint32_t)EFUSE.rd_repeat_data0.recovery_bootloader_flash_sector_3_6 << 3) |
((uint32_t)EFUSE.rd_repeat_data0.recovery_bootloader_flash_sector_2_2 << 2) |
((uint32_t)EFUSE.rd_repeat_data0.recovery_bootloader_flash_sector_0_1);
}
#else
__attribute__((always_inline)) static inline uint32_t efuse_ll_get_recovery_bootloader_sector(void)
{
// Rev < 3.0 has no recovery bootloader eFuse field.
return 0;
}
#endif
/******************* eFuse control functions *************************/
__attribute__((always_inline)) static inline bool efuse_ll_get_read_cmd(void)