mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-01 18:50:34 +03:00
Merge branch 'test/peripheral_drivers_on_real_encryption_runner' into 'master'
test(drivers): run flash encryption apps on real hardware Closes IDFCI-10377 See merge request espressif/esp-idf!50510
This commit is contained in:
@@ -58,4 +58,4 @@ components/esp_lcd/test_apps/spi_lcd:
|
||||
- esp_driver_spi
|
||||
disable:
|
||||
- if: SOC_GPSPI_SUPPORTED != 1
|
||||
- if: CONFIG_NAME == "virt_flash_enc" and SOC_FLASH_ENC_SUPPORTED != 1
|
||||
- if: CONFIG_NAME == "flash_enc" and SOC_FLASH_ENC_SUPPORTED != 1
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import pytest
|
||||
from _pytest.fixtures import FixtureRequest
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from pytest_embedded_idf.serial import IdfSerial
|
||||
|
||||
|
||||
# This is a custom IdfSerial class to support custom functionality
|
||||
# which is required only for this test
|
||||
class EfuseFlashEncSerial(IdfSerial):
|
||||
@IdfSerial.use_esptool()
|
||||
def write_flash_no_enc(self) -> None:
|
||||
self.app.flash_settings['encrypt'] = False
|
||||
flash_files = []
|
||||
for file in self.app.flash_files:
|
||||
# Set encrypted flag to false for each file.
|
||||
flash_files.append(file._replace(encrypted=False))
|
||||
# Replace the original tuple with modified tuple with all the files marked as unencrypted.
|
||||
self.app.flash_files = tuple(flash_files)
|
||||
# Now flash the files
|
||||
self.flash()
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def monkeypatch_module(request: FixtureRequest) -> MonkeyPatch:
|
||||
mp = MonkeyPatch()
|
||||
request.addfinalizer(mp.undo)
|
||||
return mp
|
||||
|
||||
|
||||
@pytest.fixture(scope='module', autouse=True)
|
||||
def replace_dut_class(monkeypatch_module: MonkeyPatch) -> None:
|
||||
monkeypatch_module.setattr('pytest_embedded_idf.IdfSerial', EfuseFlashEncSerial)
|
||||
@@ -1,7 +0,0 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
bootloader, bootloader, primary, N/A, N/A,
|
||||
partition_table, partition_table, primary, N/A, N/A,
|
||||
nvs, data, nvs, , 0x4000,
|
||||
phy_init, data, phy, , 0x1000,
|
||||
emul_efuse, data, efuse, , 0x2000,
|
||||
factory, app, factory, , 1M,
|
||||
|
@@ -19,27 +19,36 @@ def test_i80_lcd(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.flash_encryption_f4r8
|
||||
@pytest.mark.parametrize(
|
||||
'config, skip_autoflash',
|
||||
'config',
|
||||
[
|
||||
('virt_flash_enc', 'y'),
|
||||
'flash_enc',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
|
||||
def test_i80_lcd_with_flash_encryption_esp32s3_f4r8(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.flash_encryption
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'flash_enc',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
soc_filtered_targets('SOC_LCD_I80_SUPPORTED == 1 and SOC_FLASH_ENC_SUPPORTED == 1'),
|
||||
soc_filtered_targets(
|
||||
'SOC_LCD_I80_SUPPORTED == 1 and '
|
||||
'SOC_PSRAM_DMA_CAPABLE == 1 and '
|
||||
'SOC_FLASH_ENC_SUPPORTED == 1 and '
|
||||
'IDF_TARGET not in ["esp32s3"]'
|
||||
),
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_i80_lcd_with_virt_flash_enc(dut: Dut) -> None:
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
|
||||
print(' - Start app (flash partition_table and app)')
|
||||
dut.serial.write_flash_no_enc()
|
||||
dut.expect('Loading virtual efuse blocks from real efuses')
|
||||
dut.expect('Checking flash encryption...')
|
||||
dut.expect('Generating new flash encryption key...')
|
||||
|
||||
def test_i80_lcd_with_flash_encryption(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x9000
|
||||
CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
||||
CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT=y
|
||||
CONFIG_SECURE_BOOT_ALLOW_ROM_BASIC=y
|
||||
CONFIG_SECURE_BOOT_ALLOW_JTAG=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_DEC=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE=y
|
||||
CONFIG_SECURE_FLASH_REQUIRE_ALREADY_ENABLED=y
|
||||
@@ -1,12 +0,0 @@
|
||||
# FLASH_ENCRYPTION with EFUSE_VIRTUAL_KEEP_IN_FLASH
|
||||
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0xC000
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_efuse_emul.csv"
|
||||
|
||||
CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
||||
|
||||
# Virtual eFuse mode is enough for driver behaviour test.
|
||||
# Real encryption tests are guaranteed by DMA tests
|
||||
CONFIG_EFUSE_VIRTUAL=y
|
||||
CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH=y
|
||||
@@ -1,35 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import pytest
|
||||
from _pytest.fixtures import FixtureRequest
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from pytest_embedded_idf.serial import IdfSerial
|
||||
|
||||
|
||||
# This is a custom IdfSerial class to support custom functionality
|
||||
# which is required only for this test
|
||||
class EfuseFlashEncSerial(IdfSerial):
|
||||
@IdfSerial.use_esptool()
|
||||
def write_flash_no_enc(self) -> None:
|
||||
self.app.flash_settings['encrypt'] = False
|
||||
flash_files = []
|
||||
for file in self.app.flash_files:
|
||||
# Set encrypted flag to false for each file.
|
||||
flash_files.append(file._replace(encrypted=False))
|
||||
# Replace the original tuple with modified tuple with all the files marked as unencrypted.
|
||||
self.app.flash_files = tuple(flash_files)
|
||||
# Now flash the files
|
||||
self.flash()
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def monkeypatch_module(request: FixtureRequest) -> MonkeyPatch:
|
||||
mp = MonkeyPatch()
|
||||
request.addfinalizer(mp.undo)
|
||||
return mp
|
||||
|
||||
|
||||
@pytest.fixture(scope='module', autouse=True)
|
||||
def replace_dut_class(monkeypatch_module: MonkeyPatch) -> None:
|
||||
monkeypatch_module.setattr('pytest_embedded_idf.IdfSerial', EfuseFlashEncSerial)
|
||||
@@ -1,7 +0,0 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
bootloader, bootloader, primary, N/A, N/A,
|
||||
partition_table, partition_table, primary, N/A, N/A,
|
||||
nvs, data, nvs, , 0x4000,
|
||||
phy_init, data, phy, , 0x1000,
|
||||
emul_efuse, data, efuse, , 0x2000,
|
||||
factory, app, factory, , 1M,
|
||||
|
@@ -3,6 +3,7 @@
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
from pytest_embedded_idf.utils import soc_filtered_targets
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@@ -20,26 +21,21 @@ def test_dsi_lcd(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.flash_encryption
|
||||
@pytest.mark.parametrize(
|
||||
'config, skip_autoflash',
|
||||
'config',
|
||||
[
|
||||
('virt_flash_enc', 'y'),
|
||||
'flash_enc',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32p4'], indirect=['target'])
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
soc_filtered_targets('SOC_MIPI_DSI_SUPPORTED == 1 and SOC_FLASH_ENC_SUPPORTED == 1'),
|
||||
indirect=['target'],
|
||||
)
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32p4'], reason='no runner')
|
||||
def test_dsi_lcd_with_virt_flash_enc(dut: Dut) -> None:
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
|
||||
print(' - Start app (flash partition_table and app)')
|
||||
dut.serial.write_flash_no_enc()
|
||||
dut.expect('Loading virtual efuse blocks from real efuses')
|
||||
dut.expect('Checking flash encryption...')
|
||||
dut.expect('Generating new flash encryption key...')
|
||||
|
||||
def test_dsi_lcd_with_flash_encryption(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x9000
|
||||
CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
||||
CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT=y
|
||||
CONFIG_SECURE_BOOT_ALLOW_ROM_BASIC=y
|
||||
CONFIG_SECURE_BOOT_ALLOW_JTAG=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_DEC=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE=y
|
||||
CONFIG_SECURE_FLASH_REQUIRE_ALREADY_ENABLED=y
|
||||
@@ -1,12 +0,0 @@
|
||||
# FLASH_ENCRYPTION with EFUSE_VIRTUAL_KEEP_IN_FLASH
|
||||
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0xC000
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_efuse_emul.csv"
|
||||
|
||||
CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
||||
|
||||
# Virtual eFuse mode is enough for driver behaviour test.
|
||||
# Real encryption tests are guaranteed by DMA tests
|
||||
CONFIG_EFUSE_VIRTUAL=y
|
||||
CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH=y
|
||||
@@ -1,35 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import pytest
|
||||
from _pytest.fixtures import FixtureRequest
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from pytest_embedded_idf.serial import IdfSerial
|
||||
|
||||
|
||||
# This is a custom IdfSerial class to support custom functionality
|
||||
# which is required only for this test
|
||||
class EfuseFlashEncSerial(IdfSerial):
|
||||
@IdfSerial.use_esptool()
|
||||
def write_flash_no_enc(self) -> None:
|
||||
self.app.flash_settings['encrypt'] = False
|
||||
flash_files = []
|
||||
for file in self.app.flash_files:
|
||||
# Set encrypted flag to false for each file.
|
||||
flash_files.append(file._replace(encrypted=False))
|
||||
# Replace the original tuple with modified tuple with all the files marked as unencrypted.
|
||||
self.app.flash_files = tuple(flash_files)
|
||||
# Now flash the files
|
||||
self.flash()
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def monkeypatch_module(request: FixtureRequest) -> MonkeyPatch:
|
||||
mp = MonkeyPatch()
|
||||
request.addfinalizer(mp.undo)
|
||||
return mp
|
||||
|
||||
|
||||
@pytest.fixture(scope='module', autouse=True)
|
||||
def replace_dut_class(monkeypatch_module: MonkeyPatch) -> None:
|
||||
monkeypatch_module.setattr('pytest_embedded_idf.IdfSerial', EfuseFlashEncSerial)
|
||||
@@ -1,7 +0,0 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
bootloader, bootloader, primary, N/A, N/A,
|
||||
partition_table, partition_table, primary, N/A, N/A,
|
||||
nvs, data, nvs, , 0x4000,
|
||||
phy_init, data, phy, , 0x1000,
|
||||
emul_efuse, data, efuse, , 0x2000,
|
||||
factory, app, factory, , 1M,
|
||||
|
@@ -19,27 +19,21 @@ def test_parlio_lcd(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.flash_encryption
|
||||
@pytest.mark.parametrize(
|
||||
'config, skip_autoflash',
|
||||
'config',
|
||||
[
|
||||
('virt_flash_enc', 'y'),
|
||||
'flash_enc',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
soc_filtered_targets('SOC_PARLIO_LCD_SUPPORTED == 1 and SOC_FLASH_ENC_SUPPORTED == 1'),
|
||||
soc_filtered_targets(
|
||||
'SOC_PARLIO_LCD_SUPPORTED == 1 and SOC_PSRAM_DMA_CAPABLE == 1 and SOC_FLASH_ENC_SUPPORTED == 1'
|
||||
),
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_parlio_lcd_with_virt_flash_enc(dut: Dut) -> None:
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
|
||||
print(' - Start app (flash partition_table and app)')
|
||||
dut.serial.write_flash_no_enc()
|
||||
dut.expect('Loading virtual efuse blocks from real efuses')
|
||||
dut.expect('Checking flash encryption...')
|
||||
dut.expect('Generating new flash encryption key...')
|
||||
|
||||
@pytest.mark.temp_skip_ci(targets=['esp32h4'], reason='no runner yet')
|
||||
def test_parlio_lcd_with_flash_encryption(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x9000
|
||||
CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
||||
CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT=y
|
||||
CONFIG_SECURE_BOOT_ALLOW_ROM_BASIC=y
|
||||
CONFIG_SECURE_BOOT_ALLOW_JTAG=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_DEC=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE=y
|
||||
CONFIG_SECURE_FLASH_REQUIRE_ALREADY_ENABLED=y
|
||||
@@ -1,12 +0,0 @@
|
||||
# FLASH_ENCRYPTION with EFUSE_VIRTUAL_KEEP_IN_FLASH
|
||||
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0xC000
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_efuse_emul.csv"
|
||||
|
||||
CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
||||
|
||||
# Virtual eFuse mode is enough for driver behaviour test.
|
||||
# Real encryption tests are guaranteed by DMA tests
|
||||
CONFIG_EFUSE_VIRTUAL=y
|
||||
CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH=y
|
||||
@@ -1,35 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import pytest
|
||||
from _pytest.fixtures import FixtureRequest
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from pytest_embedded_idf.serial import IdfSerial
|
||||
|
||||
|
||||
# This is a custom IdfSerial class to support custom functionality
|
||||
# which is required only for this test
|
||||
class EfuseFlashEncSerial(IdfSerial):
|
||||
@IdfSerial.use_esptool()
|
||||
def write_flash_no_enc(self) -> None:
|
||||
self.app.flash_settings['encrypt'] = False
|
||||
flash_files = []
|
||||
for file in self.app.flash_files:
|
||||
# Set encrypted flag to false for each file.
|
||||
flash_files.append(file._replace(encrypted=False))
|
||||
# Replace the original tuple with modified tuple with all the files marked as unencrypted.
|
||||
self.app.flash_files = tuple(flash_files)
|
||||
# Now flash the files
|
||||
self.flash()
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def monkeypatch_module(request: FixtureRequest) -> MonkeyPatch:
|
||||
mp = MonkeyPatch()
|
||||
request.addfinalizer(mp.undo)
|
||||
return mp
|
||||
|
||||
|
||||
@pytest.fixture(scope='module', autouse=True)
|
||||
def replace_dut_class(monkeypatch_module: MonkeyPatch) -> None:
|
||||
monkeypatch_module.setattr('pytest_embedded_idf.IdfSerial', EfuseFlashEncSerial)
|
||||
@@ -219,6 +219,10 @@ TEST_CASE("lcd_rgb_panel_update_pclk", "[lcd]")
|
||||
|
||||
TEST_CASE("lcd_rgb_panel_restart", "[lcd]")
|
||||
{
|
||||
#if CONFIG_IDF_TARGET_ESP32S31 // IDF-15960
|
||||
TEST_IGNORE_MESSAGE("Known issue: lcd_rgb_panel_restart underruns on flash-encrypted runners");
|
||||
#endif // CONFIG_IDF_TARGET_ESP32S31
|
||||
|
||||
uint8_t *img = malloc(TEST_IMG_SIZE);
|
||||
TEST_ASSERT_NOT_NULL(img);
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
bootloader, bootloader, primary, N/A, N/A,
|
||||
partition_table, partition_table, primary, N/A, N/A,
|
||||
nvs, data, nvs, , 0x4000,
|
||||
phy_init, data, phy, , 0x1000,
|
||||
emul_efuse, data, efuse, , 0x2000,
|
||||
factory, app, factory, , 1M,
|
||||
|
@@ -20,28 +20,6 @@ def test_rgb_lcd_esp32s3(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.octal_psram
|
||||
@pytest.mark.parametrize(
|
||||
'config, skip_autoflash',
|
||||
[
|
||||
('virt_flash_enc', 'y'),
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
|
||||
def test_rgb_lcd_esp32s3_with_virt_flash_enc(dut: Dut) -> None:
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
|
||||
print(' - Start app (flash partition_table and app)')
|
||||
dut.serial.write_flash_no_enc()
|
||||
dut.expect('Loading virtual efuse blocks from real efuses')
|
||||
dut.expect('Checking flash encryption...')
|
||||
dut.expect('Generating new flash encryption key...')
|
||||
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
@@ -51,32 +29,42 @@ def test_rgb_lcd_esp32s3_with_virt_flash_enc(dut: Dut) -> None:
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32p4', 'esp32s31'], indirect=['target'])
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
soc_filtered_targets('SOC_LCD_RGB_SUPPORTED == 1 and IDF_TARGET not in ["esp32s3"]'),
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_rgb_lcd(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.flash_encryption_f4r8
|
||||
@pytest.mark.parametrize(
|
||||
'config, skip_autoflash',
|
||||
'config',
|
||||
[
|
||||
('virt_flash_enc', 'y'),
|
||||
'flash_enc',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['esp32s3'], indirect=['target'])
|
||||
def test_rgb_lcd_with_flash_encryption_esp32s3_f4r8(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.flash_encryption
|
||||
@pytest.mark.parametrize(
|
||||
'config',
|
||||
[
|
||||
'flash_enc',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
soc_filtered_targets('IDF_TARGET in ["esp32p4", "esp32s31"] and SOC_FLASH_ENC_SUPPORTED == 1'),
|
||||
soc_filtered_targets(
|
||||
'SOC_LCD_RGB_SUPPORTED == 1 and SOC_FLASH_ENC_SUPPORTED == 1 and IDF_TARGET not in ["esp32s3"]'
|
||||
),
|
||||
indirect=['target'],
|
||||
)
|
||||
def test_rgb_lcd_with_virt_flash_enc(dut: Dut) -> None:
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
|
||||
print(' - Start app (flash partition_table and app)')
|
||||
dut.serial.write_flash_no_enc()
|
||||
dut.expect('Loading virtual efuse blocks from real efuses')
|
||||
dut.expect('Checking flash encryption...')
|
||||
dut.expect('Generating new flash encryption key...')
|
||||
|
||||
def test_rgb_lcd_with_flash_encryption(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x9000
|
||||
CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
||||
CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT=y
|
||||
CONFIG_SECURE_BOOT_ALLOW_ROM_BASIC=y
|
||||
CONFIG_SECURE_BOOT_ALLOW_JTAG=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_DEC=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE=y
|
||||
CONFIG_SECURE_FLASH_REQUIRE_ALREADY_ENABLED=y
|
||||
@@ -1,12 +0,0 @@
|
||||
# FLASH_ENCRYPTION with EFUSE_VIRTUAL_KEEP_IN_FLASH
|
||||
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0xC000
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_efuse_emul.csv"
|
||||
|
||||
CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
||||
|
||||
# Virtual eFuse mode is enough for driver behaviour test.
|
||||
# Real encryption tests are guaranteed by DMA tests
|
||||
CONFIG_EFUSE_VIRTUAL=y
|
||||
CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH=y
|
||||
@@ -1,35 +0,0 @@
|
||||
# SPDX-FileCopyrightText: 2026 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import pytest
|
||||
from _pytest.fixtures import FixtureRequest
|
||||
from _pytest.monkeypatch import MonkeyPatch
|
||||
from pytest_embedded_idf.serial import IdfSerial
|
||||
|
||||
|
||||
# This is a custom IdfSerial class to support custom functionality
|
||||
# which is required only for this test
|
||||
class EfuseFlashEncSerial(IdfSerial):
|
||||
@IdfSerial.use_esptool()
|
||||
def write_flash_no_enc(self) -> None:
|
||||
self.app.flash_settings['encrypt'] = False
|
||||
flash_files = []
|
||||
for file in self.app.flash_files:
|
||||
# Set encrypted flag to false for each file.
|
||||
flash_files.append(file._replace(encrypted=False))
|
||||
# Replace the original tuple with modified tuple with all the files marked as unencrypted.
|
||||
self.app.flash_files = tuple(flash_files)
|
||||
# Now flash the files
|
||||
self.flash()
|
||||
|
||||
|
||||
@pytest.fixture(scope='module')
|
||||
def monkeypatch_module(request: FixtureRequest) -> MonkeyPatch:
|
||||
mp = MonkeyPatch()
|
||||
request.addfinalizer(mp.undo)
|
||||
return mp
|
||||
|
||||
|
||||
@pytest.fixture(scope='module', autouse=True)
|
||||
def replace_dut_class(monkeypatch_module: MonkeyPatch) -> None:
|
||||
monkeypatch_module.setattr('pytest_embedded_idf.IdfSerial', EfuseFlashEncSerial)
|
||||
@@ -1,7 +0,0 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
bootloader, bootloader, primary, N/A, N/A,
|
||||
partition_table, partition_table, primary, N/A, N/A,
|
||||
nvs, data, nvs, , 0x4000,
|
||||
phy_init, data, phy, , 0x1000,
|
||||
emul_efuse, data, efuse, , 0x2000,
|
||||
factory, app, factory, , 1M,
|
||||
|
@@ -3,6 +3,7 @@
|
||||
import pytest
|
||||
from pytest_embedded import Dut
|
||||
from pytest_embedded_idf.utils import idf_parametrize
|
||||
from pytest_embedded_idf.utils import soc_filtered_targets
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@@ -18,23 +19,27 @@ def test_spi_lcd(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
|
||||
@pytest.mark.generic
|
||||
@pytest.mark.flash_encryption
|
||||
@pytest.mark.parametrize(
|
||||
'config, skip_autoflash',
|
||||
'config',
|
||||
[
|
||||
('virt_flash_enc', 'y'),
|
||||
'flash_enc',
|
||||
],
|
||||
indirect=True,
|
||||
)
|
||||
@idf_parametrize('target', ['supported_targets'], indirect=['target'])
|
||||
def test_spi_lcd_with_virt_flash_enc(dut: Dut) -> None:
|
||||
print(' - Erase flash')
|
||||
dut.serial.erase_flash()
|
||||
|
||||
print(' - Start app (flash partition_table and app)')
|
||||
dut.serial.write_flash_no_enc()
|
||||
dut.expect('Loading virtual efuse blocks from real efuses')
|
||||
dut.expect('Checking flash encryption...')
|
||||
dut.expect('Generating new flash encryption key...')
|
||||
|
||||
@idf_parametrize(
|
||||
'target',
|
||||
soc_filtered_targets('SOC_GPSPI_SUPPORTED == 1 and SOC_PSRAM_DMA_CAPABLE == 1 and SOC_FLASH_ENC_SUPPORTED == 1'),
|
||||
indirect=['target'],
|
||||
)
|
||||
@pytest.mark.temp_skip_ci(
|
||||
targets=[
|
||||
'esp32c61',
|
||||
'esp32h4',
|
||||
'esp32s2',
|
||||
'esp32s3',
|
||||
],
|
||||
reason='no runner yet',
|
||||
)
|
||||
def test_spi_lcd_with_flash_encryption(dut: Dut) -> None:
|
||||
dut.run_all_single_board_cases()
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0x9000
|
||||
CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
||||
CONFIG_SECURE_FLASH_ENCRYPTION_MODE_DEVELOPMENT=y
|
||||
CONFIG_SECURE_BOOT_ALLOW_ROM_BASIC=y
|
||||
CONFIG_SECURE_BOOT_ALLOW_JTAG=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_ENC=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_DEC=y
|
||||
CONFIG_SECURE_FLASH_UART_BOOTLOADER_ALLOW_CACHE=y
|
||||
CONFIG_SECURE_FLASH_REQUIRE_ALREADY_ENABLED=y
|
||||
@@ -1,12 +0,0 @@
|
||||
# FLASH_ENCRYPTION with EFUSE_VIRTUAL_KEEP_IN_FLASH
|
||||
|
||||
CONFIG_PARTITION_TABLE_OFFSET=0xC000
|
||||
CONFIG_PARTITION_TABLE_CUSTOM=y
|
||||
CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_efuse_emul.csv"
|
||||
|
||||
CONFIG_SECURE_FLASH_ENC_ENABLED=y
|
||||
|
||||
# Virtual eFuse mode is enough for driver behaviour test.
|
||||
# Real encryption tests are guaranteed by DMA tests
|
||||
CONFIG_EFUSE_VIRTUAL=y
|
||||
CONFIG_EFUSE_VIRTUAL_KEEP_IN_FLASH=y
|
||||
Reference in New Issue
Block a user