Skip to content

Commit 3400dc9

Browse files
committed
efuse: add virtual support
Changes required for virtual efuse support and removal of redundancies Signed-off-by: Marcio Ribeiro <marcio.ribeiro@espressif.com>
1 parent 5f0a5ec commit 3400dc9

File tree

10 files changed

+60
-117
lines changed

10 files changed

+60
-117
lines changed

components/efuse/include/esp_efuse.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#include "sdkconfig.h"
1616
#include "esp_efuse_chip.h"
1717

18+
#include "zephyr_compat.h"
19+
1820
#ifdef __cplusplus
1921
extern "C" {
2022
#endif
@@ -390,7 +392,7 @@ bool esp_efuse_check_secure_version(uint32_t secure_version);
390392
*/
391393
esp_err_t esp_efuse_update_secure_version(uint32_t secure_version);
392394

393-
#if defined(BOOTLOADER_BUILD) && defined(CONFIG_EFUSE_VIRTUAL) && !defined(CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH)
395+
#if defined(CONFIG_EFUSE_VIRTUAL) && !defined(CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH)
394396
/**
395397
* @brief Initializes eFuses API to keep eFuses in RAM.
396398
*

components/efuse/src/esp_efuse_utility.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ uint32_t esp_efuse_utility_get_read_register_address(esp_efuse_block_t block)
418418

419419
}
420420

421-
#if defined(BOOTLOADER_BUILD) && defined(CONFIG_EFUSE_VIRTUAL) && !defined(CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH)
421+
#if defined(CONFIG_EFUSE_VIRTUAL) && !defined(CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH)
422422
void esp_efuse_init_virtual_mode_in_ram(void)
423423
{
424424
esp_efuse_utility_update_virt_blocks();

zephyr/Kconfig

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,6 @@
33

44
if SOC_FAMILY_ESPRESSIF_ESP32
55

6-
if MCUBOOT
7-
8-
config EFUSE_VIRTUAL_OFFSET
9-
hex
10-
default 0x250000 if SOC_SERIES_ESP32
11-
default 0x250000 if SOC_SERIES_ESP32S2
12-
default 0x250000 if SOC_SERIES_ESP32S3
13-
default 0x250000 if SOC_SERIES_ESP32C3
14-
default 0x250000 if SOC_SERIES_ESP32C6
15-
16-
config EFUSE_VIRTUAL_SIZE
17-
hex
18-
default 0x2000 if SOC_SERIES_ESP32
19-
default 0x2000 if SOC_SERIES_ESP32S2
20-
default 0x2000 if SOC_SERIES_ESP32S3
21-
default 0x2000 if SOC_SERIES_ESP32C3
22-
default 0x2000 if SOC_SERIES_ESP32C6
23-
24-
config EFUSE_MAX_BLK_LEN
25-
int
26-
default 192 if SOC_SERIES_ESP32
27-
default 256 if SOC_SERIES_ESP32S2
28-
default 256 if SOC_SERIES_ESP32S3
29-
default 256 if SOC_SERIES_ESP32C3
30-
default 256 if SOC_SERIES_ESP32C6
31-
32-
endif # MCUBOOT
33-
346
config BOOTLOADER_LOG_LEVEL
357
int
368
default 3

zephyr/esp32/CMakeLists.txt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,14 @@ if(CONFIG_SOC_SERIES_ESP32)
125125

126126
zephyr_sources(src/hal/windowspill_asm.S)
127127

128+
zephyr_sources(
129+
../../components/efuse/src/esp_efuse_api.c
130+
../../components/efuse/src/esp_efuse_utility.c
131+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
132+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
133+
../../components/efuse/src/efuse_controller/keys/without_key_purposes/three_key_blocks/esp_efuse_api_key.c
134+
)
135+
128136
if(CONFIG_SOC_FLASH_ESP32 OR NOT CONFIG_BOOTLOADER_MCUBOOT)
129137
zephyr_sources(
130138
../../components/bootloader_support/src/flash_encrypt.c
@@ -355,18 +363,6 @@ if(CONFIG_SOC_SERIES_ESP32)
355363
src/soc_flash_init.c
356364
)
357365

358-
## shared WIFI/BT/ETH resources
359-
if (CONFIG_BT OR CONFIG_WIFI_ESP32 OR CONFIG_ESP32_EMAC)
360-
set(efuse_key_type "without_key_purposes/three_key_blocks")
361-
zephyr_sources(
362-
../../components/efuse/src/esp_efuse_utility.c
363-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
364-
../../components/efuse/src/esp_efuse_api.c
365-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
366-
../../components/efuse/src/efuse_controller/keys/${efuse_key_type}/esp_efuse_api_key.c
367-
)
368-
endif()
369-
370366
## shared WIFI/BT resources
371367
if (CONFIG_BT OR CONFIG_WIFI_ESP32)
372368
zephyr_sources(

zephyr/esp32c2/CMakeLists.txt

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,14 @@ if(CONFIG_SOC_SERIES_ESP32C2)
280280

281281
zephyr_compile_definitions(ESP_PLATFORM)
282282

283+
zephyr_sources(
284+
../../components/efuse/src/esp_efuse_api.c
285+
../../components/efuse/src/esp_efuse_utility.c
286+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
287+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
288+
../../components/efuse/src/efuse_controller/keys/without_key_purposes/one_key_block/esp_efuse_api_key.c
289+
)
290+
283291
zephyr_sources_ifdef(
284292
CONFIG_UART_ESP32
285293
../../components/hal/uart_hal.c
@@ -297,10 +305,6 @@ if(CONFIG_SOC_SERIES_ESP32C2)
297305
../../components/driver/deprecated/rtc_temperature_legacy.c
298306
../../components/soc/${CONFIG_SOC_SERIES}/temperature_sensor_periph.c
299307
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
300-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
301-
../../components/efuse/src/esp_efuse_api.c
302-
../../components/efuse/src/esp_efuse_utility.c
303-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
304308
)
305309

306310
if (CONFIG_ADC_ESP32)
@@ -319,11 +323,7 @@ if(CONFIG_SOC_SERIES_ESP32C2)
319323
../../components/esp_adc/adc_cali.c
320324
../../components/esp_adc/${CONFIG_SOC_SERIES}/adc_cali_line_fitting.c
321325
../../components/soc/${CONFIG_SOC_SERIES}/adc_periph.c
322-
../../components/efuse/src/esp_efuse_api.c
323-
../../components/efuse/src/esp_efuse_utility.c
324326
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
325-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
326-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
327327
)
328328
endif()
329329

@@ -337,11 +337,6 @@ if(CONFIG_SOC_SERIES_ESP32C2)
337337

338338
zephyr_sources(
339339
../../components/esp_hw_support/sleep_modes.c
340-
../../components/efuse/src/esp_efuse_utility.c
341-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
342-
../../components/efuse/src/esp_efuse_api.c
343-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
344-
../../components/efuse/src/efuse_controller/keys/without_key_purposes/one_key_block/esp_efuse_api_key.c
345340
)
346341

347342
if (CONFIG_ESP32_SW_COEXIST_ENABLE)

zephyr/esp32c3/CMakeLists.txt

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,14 @@ if(CONFIG_SOC_SERIES_ESP32C3)
129129

130130
zephyr_compile_definitions(ESP_PLATFORM)
131131

132+
zephyr_sources(
133+
../../components/efuse/src/esp_efuse_api.c
134+
../../components/efuse/src/esp_efuse_utility.c
135+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
136+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
137+
../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
138+
)
139+
132140
zephyr_sources_ifdef(
133141
CONFIG_ESP32_SPIM
134142
../../components/hal/spi_hal.c
@@ -216,10 +224,6 @@ if(CONFIG_SOC_SERIES_ESP32C3)
216224
../../components/driver/deprecated/rtc_temperature_legacy.c
217225
../../components/soc/${CONFIG_SOC_SERIES}/temperature_sensor_periph.c
218226
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
219-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
220-
../../components/efuse/src/esp_efuse_api.c
221-
../../components/efuse/src/esp_efuse_utility.c
222-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
223227
../../components/esp_hw_support/adc_share_hw_ctrl.c
224228
)
225229

@@ -241,11 +245,7 @@ if(CONFIG_SOC_SERIES_ESP32C3)
241245
../../components/esp_adc/adc_cali_curve_fitting.c
242246
../../components/esp_adc/${CONFIG_SOC_SERIES}/curve_fitting_coefficients.c
243247
../../components/soc/${CONFIG_SOC_SERIES}/adc_periph.c
244-
../../components/efuse/src/esp_efuse_api.c
245-
../../components/efuse/src/esp_efuse_utility.c
246248
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
247-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
248-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
249249
)
250250
endif()
251251

@@ -362,14 +362,6 @@ if(CONFIG_SOC_SERIES_ESP32C3)
362362
../../components/esp_phy/src/phy_common.c
363363
)
364364

365-
zephyr_sources(
366-
../../components/efuse/src/esp_efuse_utility.c
367-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
368-
../../components/efuse/src/esp_efuse_api.c
369-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
370-
../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
371-
)
372-
373365
if (CONFIG_ESP32_SW_COEXIST_ENABLE)
374366
if (CONFIG_BUILD_ONLY_NO_BLOBS)
375367
zephyr_sources(

zephyr/esp32c6/CMakeLists.txt

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ if(CONFIG_SOC_SERIES_ESP32C6)
126126

127127
zephyr_compile_definitions(ESP_PLATFORM)
128128

129+
zephyr_sources(
130+
../../components/efuse/src/esp_efuse_api.c
131+
../../components/efuse/src/esp_efuse_utility.c
132+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
133+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
134+
../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
135+
)
136+
129137
zephyr_sources_ifdef(
130138
CONFIG_ESP32_SPIM
131139
../../components/hal/spi_hal.c
@@ -333,10 +341,6 @@ if(CONFIG_SOC_SERIES_ESP32C6)
333341
../../components/driver/deprecated/rtc_temperature_legacy.c
334342
../../components/soc/${CONFIG_SOC_SERIES}/temperature_sensor_periph.c
335343
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
336-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
337-
../../components/efuse/src/esp_efuse_api.c
338-
../../components/efuse/src/esp_efuse_utility.c
339-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
340344
../../components/esp_hw_support/adc_share_hw_ctrl.c
341345
)
342346

@@ -357,11 +361,7 @@ if(CONFIG_SOC_SERIES_ESP32C6)
357361
../../components/esp_adc/adc_cali_curve_fitting.c
358362
../../components/esp_adc/${CONFIG_SOC_SERIES}/curve_fitting_coefficients.c
359363
../../components/soc/${CONFIG_SOC_SERIES}/adc_periph.c
360-
../../components/efuse/src/esp_efuse_api.c
361-
../../components/efuse/src/esp_efuse_utility.c
362364
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
363-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
364-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
365365
)
366366
endif()
367367

@@ -402,14 +402,6 @@ if(CONFIG_SOC_SERIES_ESP32C6)
402402
../../components/esp_phy/src/phy_override.c
403403
)
404404

405-
zephyr_sources(
406-
../../components/efuse/src/esp_efuse_utility.c
407-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
408-
../../components/efuse/src/esp_efuse_api.c
409-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
410-
../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
411-
)
412-
413405
if (CONFIG_ESP32_SW_COEXIST_ENABLE)
414406
if (CONFIG_BUILD_ONLY_NO_BLOBS)
415407
zephyr_sources(

zephyr/esp32s2/CMakeLists.txt

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,14 @@ if(CONFIG_SOC_SERIES_ESP32S2)
118118

119119
zephyr_compile_definitions(ESP_PLATFORM)
120120

121+
zephyr_sources(
122+
../../components/efuse/src/esp_efuse_api.c
123+
../../components/efuse/src/esp_efuse_utility.c
124+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
125+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
126+
../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
127+
)
128+
121129
if(CONFIG_SOC_FLASH_ESP32 OR NOT CONFIG_BOOTLOADER_MCUBOOT)
122130
zephyr_sources(
123131
../../components/bootloader_support/src/flash_encrypt.c
@@ -222,11 +230,8 @@ if(CONFIG_SOC_SERIES_ESP32S2)
222230
../../components/esp_adc/adc_cali.c
223231
../../components/esp_adc/${CONFIG_SOC_SERIES}/adc_cali_line_fitting.c
224232
../../components/soc/${CONFIG_SOC_SERIES}/adc_periph.c
225-
../../components/efuse/src/esp_efuse_api.c
226-
../../components/efuse/src/esp_efuse_utility.c
227233
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
228234
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_table.c
229-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
230235
)
231236
endif()
232237

@@ -258,9 +263,6 @@ if(CONFIG_SOC_SERIES_ESP32S2)
258263
../../components/soc/${CONFIG_SOC_SERIES}/temperature_sensor_periph.c
259264
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
260265
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_table.c
261-
../../components/efuse/src/esp_efuse_api.c
262-
../../components/efuse/src/esp_efuse_utility.c
263-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
264266
../../components/esp_hw_support/adc_share_hw_ctrl.c
265267
)
266268

@@ -385,14 +387,6 @@ if(CONFIG_SOC_SERIES_ESP32S2)
385387
../../components/esp_phy/src/phy_common.c
386388
)
387389

388-
zephyr_sources(
389-
../../components/efuse/src/esp_efuse_utility.c
390-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
391-
../../components/efuse/src/esp_efuse_api.c
392-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
393-
../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
394-
)
395-
396390
set(WPA_SUPPLICANT_COMPONENT_DIR "../../components/wpa_supplicant")
397391
#TODO: Additional WPA supplicant feature like Enterprise mode etc. are yet to be supported.
398392
set(WPA_SUPPLICANT_SRCS "../port/wifi/wpa_supplicant/os_xtensa.c"

zephyr/esp32s3/CMakeLists.txt

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,14 @@ if(CONFIG_SOC_SERIES_ESP32S3)
120120

121121
zephyr_compile_definitions(ESP_PLATFORM)
122122

123+
zephyr_sources(
124+
../../components/efuse/src/esp_efuse_api.c
125+
../../components/efuse/src/esp_efuse_utility.c
126+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
127+
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
128+
../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
129+
)
130+
123131
if(CONFIG_SOC_FLASH_ESP32 OR NOT CONFIG_BOOTLOADER_MCUBOOT)
124132
zephyr_sources(
125133
../../components/bootloader_support/src/flash_encrypt.c
@@ -209,11 +217,7 @@ if(CONFIG_SOC_SERIES_ESP32S3)
209217
../../components/esp_adc/adc_cali_curve_fitting.c
210218
../../components/esp_adc/${CONFIG_SOC_SERIES}/curve_fitting_coefficients.c
211219
../../components/soc/${CONFIG_SOC_SERIES}/adc_periph.c
212-
../../components/efuse/src/esp_efuse_api.c
213-
../../components/efuse/src/esp_efuse_utility.c
214220
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
215-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
216-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
217221
)
218222
endif()
219223

@@ -294,10 +298,6 @@ if(CONFIG_SOC_SERIES_ESP32S3)
294298
../../components/esp_hw_support/sar_periph_ctrl_common.c
295299
../../components/soc/${CONFIG_SOC_SERIES}/temperature_sensor_periph.c
296300
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_rtc_calib.c
297-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
298-
../../components/efuse/src/esp_efuse_api.c
299-
../../components/efuse/src/esp_efuse_utility.c
300-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
301301
../../components/esp_hw_support/adc_share_hw_ctrl.c
302302
)
303303

@@ -409,14 +409,6 @@ if(CONFIG_SOC_SERIES_ESP32S3)
409409
../../components/esp_phy/src/phy_common.c
410410
)
411411

412-
zephyr_sources(
413-
../../components/efuse/src/esp_efuse_utility.c
414-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_table.c
415-
../../components/efuse/src/esp_efuse_api.c
416-
../../components/efuse/${CONFIG_SOC_SERIES}/esp_efuse_utility.c
417-
../../components/efuse/src/efuse_controller/keys/with_key_purposes/esp_efuse_api_key.c
418-
)
419-
420412
if (CONFIG_ESP32_SW_COEXIST_ENABLE)
421413
if (CONFIG_BUILD_ONLY_NO_BLOBS)
422414
zephyr_sources(

zephyr/port/include/zephyr_compat.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,12 @@
124124
#define CONFIG_SW_COEXIST_ENABLE CONFIG_ESP32_SW_COEXIST_ENABLE
125125
#endif
126126

127+
#ifdef CONFIG_ESP32_EFUSE_VIRTUAL
128+
#define CONFIG_EFUSE_VIRTUAL CONFIG_ESP32_EFUSE_VIRTUAL
129+
#endif
130+
131+
#ifdef CONFIG_ESP32_EFUSE_VIRTUAL_KEEP_IN_FLASH
132+
#define CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH CONFIG_ESP32_EFUSE_VIRTUAL_KEEP_IN_FLASH
133+
#endif
134+
127135
#endif /* ZEPHYR_COMPAT_H */

0 commit comments

Comments
 (0)