fix(examples): Use another efuse block for custom efuse table on ESP32H2

This commit is contained in:
Konstantin Kondrashov
2026-01-20 16:21:26 +02:00
parent 996d6d7056
commit bb8a5cfe36
3 changed files with 18 additions and 9 deletions
+3 -3
View File
@@ -115,9 +115,9 @@ static void write_efuse_fields(device_desc_t *desc, esp_efuse_coding_scheme_t co
static esp_efuse_coding_scheme_t get_coding_scheme(void)
{
// The coding scheme is used for EFUSE_BLK1, EFUSE_BLK2 and EFUSE_BLK3.
// We use EFUSE_BLK3 (custom block) to verify it.
esp_efuse_coding_scheme_t coding_scheme = esp_efuse_get_coding_scheme(EFUSE_BLK3);
// The coding scheme is used for EFUSE_BLK1, EFUSE_BLK2, and EFUSE_BLK3, etc.
// We use efuse block number of ESP_EFUSE_MODULE_VERSION (custom field) to verify it.
esp_efuse_coding_scheme_t coding_scheme = esp_efuse_get_coding_scheme(ESP_EFUSE_MODULE_VERSION[0]->efuse_block);
if (coding_scheme == EFUSE_CODING_SCHEME_NONE) {
ESP_LOGI(TAG, "Coding Scheme NONE");
#if CONFIG_IDF_TARGET_ESP32
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2017-2026 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
@@ -17,29 +17,36 @@
#define MAX_BLK_LEN CONFIG_EFUSE_MAX_BLK_LEN
#if CONFIG_IDF_TARGET_ESP32 || CONFIG_IDF_TARGET_ESP32C2
#define CUSTOM_EFUSE_BLOCK EFUSE_BLK3
#else
// This is for chips that have BLOCK3 occupied
#define CUSTOM_EFUSE_BLOCK EFUSE_BLK8
#endif
// The last free bit in the block is counted over the entire file.
#define LAST_FREE_BIT_BLK3 94
_Static_assert(LAST_FREE_BIT_BLK3 <= MAX_BLK_LEN, "The eFuse table does not match the coding scheme. Edit the table and restart the efuse_common_table or efuse_custom_table command to regenerate the new files.");
static const esp_efuse_desc_t MODULE_VERSION[] = {
{EFUSE_BLK3, 56, 8}, // Module version,
{CUSTOM_EFUSE_BLOCK, 56, 8}, // Module version,
};
static const esp_efuse_desc_t DEVICE_ROLE[] = {
{EFUSE_BLK3, 64, 3}, // Device role,
{CUSTOM_EFUSE_BLOCK, 64, 3}, // Device role,
};
static const esp_efuse_desc_t SETTING_1[] = {
{EFUSE_BLK3, 67, 6}, // Setting 1,
{CUSTOM_EFUSE_BLOCK, 67, 6}, // Setting 1,
};
static const esp_efuse_desc_t SETTING_2[] = {
{EFUSE_BLK3, 73, 5}, // Setting 2,
{CUSTOM_EFUSE_BLOCK, 73, 5}, // Setting 2,
};
static const esp_efuse_desc_t CUSTOM_SECURE_VERSION[] = {
{EFUSE_BLK3, 78, 16}, // Custom secure version,
{CUSTOM_EFUSE_BLOCK, 78, 16}, // Custom secure version,
};
@@ -10,6 +10,8 @@
# this will generate new source files, next rebuild all the sources.
# !!!!!!!!!!! #
# Note that EFUSE_BLK3 can be overwritten in esp_efuse_custom_table.c file for custom efuse fields, it is made for testing purposes!
# After re-generating the custom efuse table, the overwritten efuse block will be lost.
MODULE_VERSION, EFUSE_BLK3, 56, 8, Module version
DEVICE_ROLE, EFUSE_BLK3, 64, 3, Device role
Can't render this file because it contains an unexpected character in line 7 and column 87.