mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-12 05:17:38 +00:00
feat(examples): Get offsets for efuses from espefuse.py
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
# SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
@@ -162,23 +160,12 @@ def test_examples_efuse_with_virt_flash_enc_pre_loaded(dut: Dut) -> None:
|
||||
dut.expect('example: Done')
|
||||
|
||||
if dut.app.target == 'esp32':
|
||||
print(' - Flash emul_efuse with pre-loaded efuses (FLASH_CRYPT_CNT 1 -> 0)')
|
||||
# offset of this eFuse is taken from components/efuse/esp32/esp_efuse_table.csv
|
||||
FLASH_CRYPT_CNT = 20
|
||||
# Resets eFuse, which enables Flash encryption feature
|
||||
dut.serial.erase_field_on_emul_efuse([FLASH_CRYPT_CNT])
|
||||
elif dut.app.target == 'esp32c2':
|
||||
FLASH_CRYPT_CNT = 39
|
||||
dut.serial.erase_field_on_emul_efuse([FLASH_CRYPT_CNT])
|
||||
CRYPT_CNT_EFUSE_NAME = 'FLASH_CRYPT_CNT'
|
||||
else:
|
||||
# offset of this eFuse is taken from components/efuse/{target}/esp_efuse_table.csv
|
||||
print(' - Flash emul_efuse with pre-loaded efuses (SPI_BOOT_CRYPT_CNT 1 -> 0)')
|
||||
if dut.app.target == 'esp32c61':
|
||||
SPI_BOOT_CRYPT_CNT = 55
|
||||
else:
|
||||
SPI_BOOT_CRYPT_CNT = 82
|
||||
# Resets eFuse, which enables Flash encryption feature
|
||||
dut.serial.erase_field_on_emul_efuse([SPI_BOOT_CRYPT_CNT])
|
||||
CRYPT_CNT_EFUSE_NAME = 'SPI_BOOT_CRYPT_CNT'
|
||||
print(f' - Flash emul_efuse with pre-loaded efuses ({CRYPT_CNT_EFUSE_NAME} 1 -> 0)')
|
||||
# Resets eFuse, which enables Flash encryption feature
|
||||
dut.serial.erase_field_on_emul_efuse_by_name([CRYPT_CNT_EFUSE_NAME])
|
||||
|
||||
print(' - Start app (flash partition_table and app)')
|
||||
dut.serial.write_flash_no_enc()
|
||||
@@ -336,10 +323,8 @@ def test_examples_efuse_with_virt_secure_boot_v1_pre_loaded(dut: Dut) -> None:
|
||||
dut.expect('example: Done')
|
||||
|
||||
print(' - Flash emul_efuse with pre-loaded efuses (ABS_DONE_0 1 -> 0)')
|
||||
# offset of this eFuse is taken from components/efuse/esp32/esp_efuse_table.csv
|
||||
ABS_DONE_0 = 196
|
||||
# Resets eFuse, which enables Secure boot (V1) feature
|
||||
dut.serial.erase_field_on_emul_efuse([ABS_DONE_0])
|
||||
dut.serial.erase_field_on_emul_efuse_by_name(['ABS_DONE_0'])
|
||||
|
||||
print(' - Start app (flash partition_table and app)')
|
||||
dut.serial.flash()
|
||||
@@ -442,10 +427,8 @@ def test_examples_efuse_with_virt_secure_boot_v2(dut: Dut) -> None:
|
||||
dut.expect('example: Done')
|
||||
|
||||
print(' - Flash emul_efuse with pre-loaded efuses (ABS_DONE_1 1 -> 0)')
|
||||
# offset of this eFuse is taken from components/efuse/esp32/esp_efuse_table.csv
|
||||
ABS_DONE_1 = 197
|
||||
# Resets eFuse, which enables Secure boot (V2) feature
|
||||
dut.serial.erase_field_on_emul_efuse([ABS_DONE_1])
|
||||
dut.serial.erase_field_on_emul_efuse_by_name(['ABS_DONE_1'])
|
||||
|
||||
print(' - Start app (flash partition_table and app)')
|
||||
dut.serial.flash()
|
||||
@@ -507,10 +490,8 @@ def test_examples_efuse_with_virt_secure_boot_v2_pre_loaded(dut: Dut) -> None:
|
||||
dut.expect('example: Done')
|
||||
|
||||
print(' - Flash emul_efuse with pre-loaded efuses (ABS_DONE_1 1 -> 0)')
|
||||
# offset of this eFuse is taken from components/efuse/esp32/esp_efuse_table.csv
|
||||
ABS_DONE_1 = 197
|
||||
# Resets eFuse, which enables Secure boot (V2) feature
|
||||
dut.serial.erase_field_on_emul_efuse([ABS_DONE_1])
|
||||
dut.serial.erase_field_on_emul_efuse_by_name(['ABS_DONE_1'])
|
||||
|
||||
print(' - Start app (flash partition_table and app)')
|
||||
dut.serial.flash()
|
||||
@@ -651,17 +632,12 @@ def test_example_efuse_with_virt_secure_boot_v2_esp32xx_pre_loaded(dut: Dut) ->
|
||||
|
||||
print(' - Flash emul_efuse with pre-loaded efuses (SECURE_BOOT_EN 1 -> 0, SECURE_BOOT_KEY_REVOKE[0..2] -> 0)')
|
||||
# offsets of eFuses are taken from components/efuse/{target}/esp_efuse_table.csv
|
||||
if dut.app.target == 'esp32c2':
|
||||
SECURE_BOOT_EN = 53
|
||||
dut.serial.erase_field_on_emul_efuse([SECURE_BOOT_EN])
|
||||
# Resets eFuse, which enables Secure boot feature
|
||||
# Resets eFuses, which control digest slots
|
||||
if dut.app.sdkconfig.get('SOC_EFUSE_REVOKE_BOOT_KEY_DIGESTS'):
|
||||
dut.serial.erase_field_on_emul_efuse_by_name(['SECURE_BOOT_EN', 'SECURE_BOOT_KEY_REVOKE0', 'SECURE_BOOT_KEY_REVOKE1', 'SECURE_BOOT_KEY_REVOKE2'])
|
||||
else:
|
||||
SECURE_BOOT_EN = 116
|
||||
SECURE_BOOT_KEY_REVOKE0 = 85
|
||||
SECURE_BOOT_KEY_REVOKE1 = 86
|
||||
SECURE_BOOT_KEY_REVOKE2 = 87
|
||||
# Resets eFuse, which enables Secure boot feature
|
||||
# Resets eFuses, which control digest slots
|
||||
dut.serial.erase_field_on_emul_efuse([SECURE_BOOT_EN, SECURE_BOOT_KEY_REVOKE0, SECURE_BOOT_KEY_REVOKE1, SECURE_BOOT_KEY_REVOKE2])
|
||||
dut.serial.erase_field_on_emul_efuse_by_name(['SECURE_BOOT_EN'])
|
||||
|
||||
print(' - Start app (flash partition_table and app)')
|
||||
dut.serial.flash()
|
||||
|
Reference in New Issue
Block a user