Skip to content

Commit 23dce02

Browse files
committed
soc: esp32: virtual e-fuses support
Adds support for virtual e-fuses on esp32 socs Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
1 parent 05c7fad commit 23dce02

File tree

6 files changed

+54
-0
lines changed

6 files changed

+54
-0
lines changed

soc/espressif/esp32/soc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <soc.h>
99
#include <soc_init.h>
1010
#include <flash_init.h>
11+
#include <esp_efuse.h>
1112
#include <esp_private/cache_utils.h>
1213
#include <esp_private/system_internal.h>
1314
#include <esp_timer.h>
@@ -26,6 +27,14 @@ void IRAM_ATTR __esp_platform_app_start(void)
2627

2728
esp_flash_config();
2829

30+
#if CONFIG_EFUSE_VIRTUAL
31+
#if CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH
32+
esp_efuse_init_virtual_mode_in_flash(CONFIG_EFUSE_VIRTUAL_OFFSET, CONFIG_EFUSE_VIRTUAL_SIZE);
33+
#else
34+
esp_efuse_init_virtual_mode_in_ram();
35+
#endif
36+
#endif
37+
2938
#if CONFIG_ESP_SPIRAM
3039
esp_init_psram();
3140

soc/espressif/esp32c2/soc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <soc.h>
88
#include <soc_init.h>
99
#include <flash_init.h>
10+
#include <esp_efuse.h>
1011
#include <esp_private/cache_utils.h>
1112
#include <esp_private/system_internal.h>
1213
#include <esp_timer.h>
@@ -24,6 +25,14 @@ void IRAM_ATTR __esp_platform_app_start(void)
2425

2526
esp_flash_config();
2627

28+
#if CONFIG_EFUSE_VIRTUAL
29+
#if CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH
30+
esp_efuse_init_virtual_mode_in_flash(CONFIG_EFUSE_VIRTUAL_OFFSET, CONFIG_EFUSE_VIRTUAL_SIZE);
31+
#else
32+
esp_efuse_init_virtual_mode_in_ram();
33+
#endif
34+
#endif
35+
2736
/* Start Zephyr */
2837
z_cstart();
2938

soc/espressif/esp32c3/soc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <soc.h>
99
#include <soc_init.h>
1010
#include <flash_init.h>
11+
#include <esp_efuse.h>
1112
#include <esp_private/cache_utils.h>
1213
#include <esp_private/system_internal.h>
1314
#include <esp_timer.h>
@@ -25,6 +26,14 @@ void IRAM_ATTR __esp_platform_app_start(void)
2526

2627
esp_flash_config();
2728

29+
#if CONFIG_EFUSE_VIRTUAL
30+
#if CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH
31+
esp_efuse_init_virtual_mode_in_flash(CONFIG_EFUSE_VIRTUAL_OFFSET, CONFIG_EFUSE_VIRTUAL_SIZE);
32+
#else
33+
esp_efuse_init_virtual_mode_in_ram();
34+
#endif
35+
#endif
36+
2837
/* Start Zephyr */
2938
z_cstart();
3039

soc/espressif/esp32c6/soc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <soc.h>
88
#include <soc_init.h>
99
#include <flash_init.h>
10+
#include <esp_efuse.h>
1011
#include <esp_private/cache_utils.h>
1112
#include <esp_private/system_internal.h>
1213
#include <esp_timer.h>
@@ -24,6 +25,14 @@ void IRAM_ATTR __esp_platform_app_start(void)
2425

2526
esp_flash_config();
2627

28+
#if CONFIG_EFUSE_VIRTUAL
29+
#if CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH
30+
esp_efuse_init_virtual_mode_in_flash(CONFIG_EFUSE_VIRTUAL_OFFSET, CONFIG_EFUSE_VIRTUAL_SIZE);
31+
#else
32+
esp_efuse_init_virtual_mode_in_ram();
33+
#endif
34+
#endif
35+
2736
/* Start Zephyr */
2837
z_cstart();
2938

soc/espressif/esp32s2/soc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <soc.h>
88
#include <soc_init.h>
99
#include <flash_init.h>
10+
#include <esp_efuse.h>
1011
#include <esp_private/cache_utils.h>
1112
#include <esp_private/system_internal.h>
1213
#include <esp_timer.h>
@@ -41,6 +42,14 @@ void IRAM_ATTR __esp_platform_app_start(void)
4142

4243
esp_flash_config();
4344

45+
#if CONFIG_EFUSE_VIRTUAL
46+
#if CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH
47+
esp_efuse_init_virtual_mode_in_flash(CONFIG_EFUSE_VIRTUAL_OFFSET, CONFIG_EFUSE_VIRTUAL_SIZE);
48+
#else
49+
esp_efuse_init_virtual_mode_in_ram();
50+
#endif
51+
#endif
52+
4453
#if CONFIG_ESP_SPIRAM
4554
esp_init_psram();
4655

soc/espressif/esp32s3/soc.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <soc.h>
99
#include <soc_init.h>
1010
#include <flash_init.h>
11+
#include <esp_efuse.h>
1112
#include <esp_private/cache_utils.h>
1213
#include <esp_private/system_internal.h>
1314
#include <esp_timer.h>
@@ -54,6 +55,14 @@ void IRAM_ATTR __esp_platform_app_start(void)
5455

5556
esp_flash_config();
5657

58+
#if CONFIG_EFUSE_VIRTUAL
59+
#if CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH
60+
esp_efuse_init_virtual_mode_in_flash(CONFIG_EFUSE_VIRTUAL_OFFSET, CONFIG_EFUSE_VIRTUAL_SIZE);
61+
#else
62+
esp_efuse_init_virtual_mode_in_ram();
63+
#endif
64+
#endif
65+
5766
#if CONFIG_ESP_SPIRAM
5867
esp_init_psram();
5968

0 commit comments

Comments
 (0)