mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
efuse: When Virtual eFuses are enabled, seed the virtual values as part of startup code
This commit is contained in:
parent
f42ae05d1e
commit
af1ea9b1b9
@ -32,6 +32,10 @@ static const char *TAG = "efuse";
|
||||
// Array for emulate efuse registers.
|
||||
#ifdef CONFIG_EFUSE_VIRTUAL
|
||||
static uint32_t virt_blocks[COUNT_EFUSE_BLOCKS][COUNT_EFUSE_REG_PER_BLOCK];
|
||||
|
||||
/* Call the update function to seed virtual efuses during initialization */
|
||||
__attribute__((constructor)) void esp_efuse_utility_update_virt_blocks();
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
@ -181,7 +185,7 @@ void esp_efuse_utility_reset(void)
|
||||
void esp_efuse_utility_burn_efuses(void)
|
||||
{
|
||||
#ifdef CONFIG_EFUSE_VIRTUAL
|
||||
ESP_LOGE(TAG, "Not really burning any efuses!");
|
||||
ESP_LOGW(TAG, "Virtual efuses enabled: Not really burning eFuses");
|
||||
for (int num_block = 0; num_block < COUNT_EFUSE_BLOCKS; num_block++) {
|
||||
esp_efuse_coding_scheme_t scheme = esp_efuse_get_coding_scheme(num_block);
|
||||
if (scheme == EFUSE_CODING_SCHEME_3_4) {
|
||||
@ -229,7 +233,7 @@ void esp_efuse_utility_erase_virt_blocks()
|
||||
void esp_efuse_utility_update_virt_blocks()
|
||||
{
|
||||
#ifdef CONFIG_EFUSE_VIRTUAL
|
||||
ESP_LOGI(TAG, "Emulate efuse is enabled");
|
||||
ESP_LOGI(TAG, "Loading virtual efuse blocks from real efuses");
|
||||
for (int num_block = 0; num_block < COUNT_EFUSE_BLOCKS; num_block++) {
|
||||
int subblock = 0;
|
||||
for (uint32_t addr_rd_block = range_read_addr_blocks[num_block].start; addr_rd_block <= range_read_addr_blocks[num_block].end; addr_rd_block += 4) {
|
||||
|
@ -248,9 +248,15 @@ The number of bits not included in square brackets is free (bits in EFUSE_BLK0 a
|
||||
Debug eFuse & Unit tests
|
||||
------------------------
|
||||
|
||||
eFuse manager have option :envvar:`CONFIG_EFUSE_VIRTUAL` in Kconfig which will make an operation write is virtual. It can help to debug app and unit tests.
|
||||
Virtual eFuses
|
||||
^^^^^^^^^^^^^^
|
||||
|
||||
esptool have an useful tool for reading/writing ESP32 eFuse bits - `espefuse.py <https://github.com/espressif/esptool/wiki/espefuse>`_.
|
||||
The Kconfig option :envvar:`CONFIG_EFUSE_VIRTUAL` will virtualize eFuse values inside the eFuse Manager, so writes are emulated and no eFuse values are permanently changed. This can be useful for debugging app and unit tests.
|
||||
|
||||
espefuse.py
|
||||
^^^^^^^^^^^
|
||||
|
||||
esptool includes a useful tool for reading/writing ESP32 eFuse bits - `espefuse.py <https://github.com/espressif/esptool/wiki/espefuse>`_.
|
||||
|
||||
::
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user