diff --git a/components/esp_driver_dma/src/gdma.c b/components/esp_driver_dma/src/gdma.c index 86f58f39add..4991d93cf6a 100644 --- a/components/esp_driver_dma/src/gdma.c +++ b/components/esp_driver_dma/src/gdma.c @@ -484,6 +484,16 @@ esp_err_t gdma_config_transfer(gdma_channel_handle_t dma_chan, const gdma_transf ext_mem_alignment = BIT(31); } +#if CONFIG_IDF_TARGET_ESP32S31 && SOC_HAS(LP_AHB_GDMA) + // ESP32-S31 LP AHB GDMA can't burst-access encrypted external memory. + // Keep configuration/installation permissive for callers that only intend to + // use internal buffers, but poison the external-memory alignment so any + // later PSRAM use fails the caller-side validation. + if (config->access_ext_mem && group->bus_id == SOC_GDMA_BUS_LP && esp_efuse_is_flash_encryption_enabled()) { + ext_mem_alignment = BIT(31); + } +#endif + dma_chan->int_mem_alignment = int_mem_alignment; dma_chan->ext_mem_alignment = ext_mem_alignment; return ESP_OK; diff --git a/components/esp_driver_dma/src/gdma_priv.h b/components/esp_driver_dma/src/gdma_priv.h index 6f268f5c811..e9785438e70 100644 --- a/components/esp_driver_dma/src/gdma_priv.h +++ b/components/esp_driver_dma/src/gdma_priv.h @@ -41,7 +41,7 @@ #if CI_TEST_SW_RETENTION #define GDMA_RETENTION_ENTRY REGDMA_SW_TRIGGER_ENTRY #else -#if SOC_PHY_SUPPORTED +#if SOC_PM_SUPPORT_PMU_MODEM_STATE #define GDMA_RETENTION_ENTRY (ENTRY(0) | ENTRY(2)) #else #define GDMA_RETENTION_ENTRY (ENTRY(0)) diff --git a/components/esp_driver_dma/test_apps/dma/main/gdma_test_utils.h b/components/esp_driver_dma/test_apps/dma/main/gdma_test_utils.h index b8ddac4d80b..7b6aec209d6 100644 --- a/components/esp_driver_dma/test_apps/dma/main/gdma_test_utils.h +++ b/components/esp_driver_dma/test_apps/dma/main/gdma_test_utils.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2024-2026 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -7,8 +7,18 @@ #pragma once #include +#include "sdkconfig.h" #include "esp_private/gdma.h" +#if CONFIG_IDF_TARGET_ESP32S31 +// ESP32-S31 LP AHB GDMA can't burst-access external PSRAM. Skip the +// flash-encrypted PSRAM test paths because encrypted PSRAM requires burst +// accesses aligned to the encryption block size. +#define GDMA_TEST_LP_AHB_BURST_PSRAM_SUPPORTED 0 +#else +#define GDMA_TEST_LP_AHB_BURST_PSRAM_SUPPORTED 1 +#endif + #ifdef __cplusplus extern "C" { #endif diff --git a/components/esp_driver_dma/test_apps/dma/main/test_async_memcpy.c b/components/esp_driver_dma/test_apps/dma/main/test_async_memcpy.c index dafb8841f66..a1da0bf3336 100644 --- a/components/esp_driver_dma/test_apps/dma/main/test_async_memcpy.c +++ b/components/esp_driver_dma/test_apps/dma/main/test_async_memcpy.c @@ -17,6 +17,7 @@ #include "esp_async_memcpy.h" #include "hal/efuse_hal.h" #include "esp_efuse.h" +#include "gdma_test_utils.h" #if SOC_GDMA_SUPPORTED #include "hal/gdma_ll.h" @@ -409,10 +410,14 @@ TEST_CASE("memory copy performance 40KB: PSRAM->PSRAM", "[async mcp]") #if SOC_HAS(LP_AHB_GDMA) #if GDMA_LL_GET(LP_AHB_PSRAM_CAPABLE) - printf("Testing memcpy by LP AHB GDMA\r\n"); - TEST_ESP_OK(esp_async_memcpy_install_gdma_lp_ahb(&driver_config, &driver)); - test_memcpy_performance(driver, 40 * 1024, true, true); - TEST_ESP_OK(esp_async_memcpy_uninstall(driver)); + if (esp_efuse_is_flash_encryption_enabled() && !GDMA_TEST_LP_AHB_BURST_PSRAM_SUPPORTED) { + TEST_IGNORE_MESSAGE("Skipping LP AHB GDMA PSRAM->PSRAM under flash encryption"); + } else { + printf("Testing memcpy by LP AHB GDMA\r\n"); + TEST_ESP_OK(esp_async_memcpy_install_gdma_lp_ahb(&driver_config, &driver)); + test_memcpy_performance(driver, 40 * 1024, true, true); + TEST_ESP_OK(esp_async_memcpy_uninstall(driver)); + } #endif // GDMA_LL_GET(LP_AHB_PSRAM_CAPABLE) #endif // SOC_HAS(LP_AHB_GDMA) } diff --git a/components/esp_driver_dma/test_apps/dma/main/test_gdma.c b/components/esp_driver_dma/test_apps/dma/main/test_gdma.c index 3cad88ee2dc..0a73afbbcb3 100644 --- a/components/esp_driver_dma/test_apps/dma/main/test_gdma.c +++ b/components/esp_driver_dma/test_apps/dma/main/test_gdma.c @@ -399,6 +399,7 @@ static void test_gdma_m2m_mode(bool trig_retention_backup) gdma_channel_alloc_config_t chan_alloc_config = {}; #if SOC_HAS(AHB_GDMA) + printf("Testing GDMA M2M Mode by AHB GDMA%s\n", trig_retention_backup ? " with retention backup" : ""); TEST_ESP_OK(gdma_new_ahb_channel(&chan_alloc_config, &tx_chan, &rx_chan)); test_gdma_m2m_transaction(tx_chan, rx_chan, false, trig_retention_backup); @@ -408,6 +409,7 @@ static void test_gdma_m2m_mode(bool trig_retention_backup) #endif // SOC_HAS(AHB_GDMA) #if SOC_HAS(AXI_GDMA) + printf("Testing GDMA M2M Mode by AXI GDMA%s\n", trig_retention_backup ? " with retention backup" : ""); TEST_ESP_OK(gdma_new_axi_channel(&chan_alloc_config, &tx_chan, &rx_chan)); bool lli_in_ext_mem = false; @@ -422,12 +424,17 @@ static void test_gdma_m2m_mode(bool trig_retention_backup) #endif // SOC_HAS(AXI_GDMA) #if SOC_HAS(LP_AHB_GDMA) - TEST_ESP_OK(gdma_new_lp_ahb_channel(&chan_alloc_config, &tx_chan, &rx_chan)); + if (esp_efuse_is_flash_encryption_enabled() && !GDMA_TEST_LP_AHB_BURST_PSRAM_SUPPORTED) { + TEST_IGNORE_MESSAGE("Skip LP-AHB-GDMA GDMA M2M Mode under flash encryption"); + } else { + printf("Testing GDMA M2M Mode by LP-AHB GDMA%s\n", trig_retention_backup ? " with retention backup" : ""); + TEST_ESP_OK(gdma_new_lp_ahb_channel(&chan_alloc_config, &tx_chan, &rx_chan)); - test_gdma_m2m_transaction(tx_chan, rx_chan, false, trig_retention_backup); + test_gdma_m2m_transaction(tx_chan, rx_chan, false, trig_retention_backup); - TEST_ESP_OK(gdma_del_channel(tx_chan)); - TEST_ESP_OK(gdma_del_channel(rx_chan)); + TEST_ESP_OK(gdma_del_channel(tx_chan)); + TEST_ESP_OK(gdma_del_channel(rx_chan)); + } #endif // SOC_HAS(LP_AHB_GDMA) } @@ -837,13 +844,19 @@ TEST_CASE("GDMA memory copy SRAM->PSRAM->SRAM", "[GDMA][M2M]") #endif // SOC_HAS(AXI_GDMA) #if SOC_HAS(LP_AHB_GDMA) - printf("Testing LP-AHB-GDMA memory copy SRAM->PSRAM->SRAM\n"); - TEST_ESP_OK(gdma_new_lp_ahb_channel(&chan_alloc_config, &tx_chan, &rx_chan)); +#if GDMA_LL_GET(LP_AHB_PSRAM_CAPABLE) + if (esp_efuse_is_flash_encryption_enabled() && !GDMA_TEST_LP_AHB_BURST_PSRAM_SUPPORTED) { + TEST_IGNORE_MESSAGE("Skipping LP-AHB-GDMA SRAM->PSRAM->SRAM under flash encryption"); + } else { + printf("Testing LP-AHB-GDMA memory copy SRAM->PSRAM->SRAM\n"); + TEST_ESP_OK(gdma_new_lp_ahb_channel(&chan_alloc_config, &tx_chan, &rx_chan)); - test_gdma_memcpy_from_to_psram(tx_chan, rx_chan); + test_gdma_memcpy_from_to_psram(tx_chan, rx_chan); - TEST_ESP_OK(gdma_del_channel(tx_chan)); - TEST_ESP_OK(gdma_del_channel(rx_chan)); + TEST_ESP_OK(gdma_del_channel(tx_chan)); + TEST_ESP_OK(gdma_del_channel(rx_chan)); + } +#endif // GDMA_LL_GET(LP_AHB_PSRAM_CAPABLE) #endif // SOC_HAS(LP_AHB_GDMA) } #endif // SOC_SPIRAM_SUPPORTED diff --git a/components/esp_driver_dma/test_apps/dma/pytest_dma.py b/components/esp_driver_dma/test_apps/dma/pytest_dma.py index 28f9d14b156..fc1f8693e36 100644 --- a/components/esp_driver_dma/test_apps/dma/pytest_dma.py +++ b/components/esp_driver_dma/test_apps/dma/pytest_dma.py @@ -71,7 +71,17 @@ def test_dma_weighted_arbitration(dut: Dut) -> None: ], indirect=True, ) -@idf_parametrize('target', ['esp32p4', 'esp32c5'], indirect=['target']) +@idf_parametrize( + 'target', + soc_filtered_targets( + 'SOC_GDMA_SUPPORTED == 1 and ' + 'SOC_PSRAM_DMA_CAPABLE == 1 and ' + 'SOC_FLASH_ENC_SUPPORTED == 1 and ' + 'IDF_TARGET not in ["esp32s3"]' + ), + indirect=['target'], +) +@pytest.mark.temp_skip_ci(targets=['esp32h4', 'esp32c61'], reason='no runner yet') def test_dma_flash_encryption(dut: Dut) -> None: dut.run_all_single_board_cases() diff --git a/components/esp_driver_dma/test_apps/dma2d/pytest_dma2d.py b/components/esp_driver_dma/test_apps/dma2d/pytest_dma2d.py index 73e93613075..57ebaffde78 100644 --- a/components/esp_driver_dma/test_apps/dma2d/pytest_dma2d.py +++ b/components/esp_driver_dma/test_apps/dma2d/pytest_dma2d.py @@ -41,7 +41,8 @@ def test_dma2d_esp32p4_rev1(dut: Dut) -> None: ], indirect=True, ) -@idf_parametrize('target', soc_filtered_targets('SOC_DMA2D_SUPPORTED == 1'), indirect=['target']) -@pytest.mark.temp_skip_ci(targets=['esp32s31'], reason='TODO: IDFCI-10377 no runner yet') +@idf_parametrize( + 'target', soc_filtered_targets('SOC_DMA2D_SUPPORTED == 1 and SOC_FLASH_ENC_SUPPORTED == 1'), indirect=['target'] +) def test_dma2d_flash_encryption(dut: Dut) -> None: dut.run_all_single_board_cases() diff --git a/components/esp_driver_parlio/test_apps/parlio/conftest.py b/components/esp_driver_parlio/test_apps/parlio/conftest.py deleted file mode 100644 index 7b54db3b766..00000000000 --- a/components/esp_driver_parlio/test_apps/parlio/conftest.py +++ /dev/null @@ -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) diff --git a/components/esp_driver_parlio/test_apps/parlio/partitions_efuse_emul.csv b/components/esp_driver_parlio/test_apps/parlio/partitions_efuse_emul.csv deleted file mode 100644 index c4c8330ef55..00000000000 --- a/components/esp_driver_parlio/test_apps/parlio/partitions_efuse_emul.csv +++ /dev/null @@ -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, diff --git a/components/esp_driver_parlio/test_apps/parlio/pytest_parlio_unity.py b/components/esp_driver_parlio/test_apps/parlio/pytest_parlio_unity.py index e1f0575d3c6..f4cb6144b30 100644 --- a/components/esp_driver_parlio/test_apps/parlio/pytest_parlio_unity.py +++ b/components/esp_driver_parlio/test_apps/parlio/pytest_parlio_unity.py @@ -36,27 +36,21 @@ def test_parlio(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_SUPPORTED == 1 and SOC_FLASH_ENC_SUPPORTED == 1'), indirect=['target'] + 'target', + soc_filtered_targets('SOC_PARLIO_SUPPORTED == 1 and SOC_PSRAM_DMA_CAPABLE == 1 and SOC_FLASH_ENC_SUPPORTED == 1'), + indirect=['target'], ) -def test_parlio_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_with_flash_encryption(dut: Dut) -> None: dut.run_all_single_board_cases(group='!release_only') diff --git a/components/esp_driver_parlio/test_apps/parlio/sdkconfig.ci.flash_enc b/components/esp_driver_parlio/test_apps/parlio/sdkconfig.ci.flash_enc new file mode 100644 index 00000000000..5be9651c381 --- /dev/null +++ b/components/esp_driver_parlio/test_apps/parlio/sdkconfig.ci.flash_enc @@ -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 diff --git a/components/esp_driver_parlio/test_apps/parlio/sdkconfig.ci.virt_flash_enc b/components/esp_driver_parlio/test_apps/parlio/sdkconfig.ci.virt_flash_enc deleted file mode 100644 index b0b4e5681a5..00000000000 --- a/components/esp_driver_parlio/test_apps/parlio/sdkconfig.ci.virt_flash_enc +++ /dev/null @@ -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 diff --git a/components/esp_driver_ppa/test_apps/pytest_ppa.py b/components/esp_driver_ppa/test_apps/pytest_ppa.py index 797e50d36d9..928f446b364 100644 --- a/components/esp_driver_ppa/test_apps/pytest_ppa.py +++ b/components/esp_driver_ppa/test_apps/pytest_ppa.py @@ -41,7 +41,8 @@ def test_ppa_esp32p4_rev1(dut: Dut) -> None: ], indirect=True, ) -@idf_parametrize('target', soc_filtered_targets('SOC_PPA_SUPPORTED == 1'), indirect=['target']) -@pytest.mark.temp_skip_ci(targets=['esp32s31'], reason='TODO: IDFCI-10377 no runner yet') +@idf_parametrize( + 'target', soc_filtered_targets('SOC_PPA_SUPPORTED == 1 and SOC_FLASH_ENC_SUPPORTED == 1'), indirect=['target'] +) def test_ppa_flash_encryption(dut: Dut) -> None: dut.run_all_single_board_cases() diff --git a/components/esp_driver_rmt/test_apps/rmt/conftest.py b/components/esp_driver_rmt/test_apps/rmt/conftest.py deleted file mode 100644 index 7b54db3b766..00000000000 --- a/components/esp_driver_rmt/test_apps/rmt/conftest.py +++ /dev/null @@ -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) diff --git a/components/esp_driver_rmt/test_apps/rmt/partitions_efuse_emul.csv b/components/esp_driver_rmt/test_apps/rmt/partitions_efuse_emul.csv deleted file mode 100644 index c4c8330ef55..00000000000 --- a/components/esp_driver_rmt/test_apps/rmt/partitions_efuse_emul.csv +++ /dev/null @@ -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, diff --git a/components/esp_driver_rmt/test_apps/rmt/pytest_rmt.py b/components/esp_driver_rmt/test_apps/rmt/pytest_rmt.py index af2479efcb5..b40e9e439d9 100644 --- a/components/esp_driver_rmt/test_apps/rmt/pytest_rmt.py +++ b/components/esp_driver_rmt/test_apps/rmt/pytest_rmt.py @@ -24,32 +24,6 @@ def test_rmt(dut: Dut) -> None: dut.run_all_single_board_cases() -@pytest.mark.generic -@pytest.mark.parametrize( - 'config, skip_autoflash', - [ - ('virt_flash_enc', 'y'), - ], - indirect=True, -) -@idf_parametrize( - 'target', - soc_filtered_targets('SOC_RMT_SUPPORTED == 1 and SOC_FLASH_ENC_SUPPORTED == 1 and IDF_TARGET not in ["esp32s3"]'), - indirect=['target'], -) -def test_rmt_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', @@ -91,23 +65,31 @@ def test_rmt_psram(dut: Dut) -> None: dut.run_all_single_board_cases() -@pytest.mark.octal_psram +@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_rmt_psram_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_rmt_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_RMT_SUPPORT_DMA == 1 and SOC_FLASH_ENC_SUPPORTED == 1 and IDF_TARGET not in ["esp32s3"]'), + indirect=['target'], +) +def test_rmt_with_flash_encryption(dut: Dut) -> None: dut.run_all_single_board_cases() diff --git a/components/esp_driver_rmt/test_apps/rmt/sdkconfig.ci.flash_enc b/components/esp_driver_rmt/test_apps/rmt/sdkconfig.ci.flash_enc new file mode 100644 index 00000000000..5be9651c381 --- /dev/null +++ b/components/esp_driver_rmt/test_apps/rmt/sdkconfig.ci.flash_enc @@ -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 diff --git a/components/esp_driver_rmt/test_apps/rmt/sdkconfig.ci.virt_flash_enc b/components/esp_driver_rmt/test_apps/rmt/sdkconfig.ci.virt_flash_enc deleted file mode 100644 index b0b4e5681a5..00000000000 --- a/components/esp_driver_rmt/test_apps/rmt/sdkconfig.ci.virt_flash_enc +++ /dev/null @@ -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 diff --git a/components/esp_lcd/test_apps/.build-test-rules.yml b/components/esp_lcd/test_apps/.build-test-rules.yml index e618bd66512..1575d763f2e 100644 --- a/components/esp_lcd/test_apps/.build-test-rules.yml +++ b/components/esp_lcd/test_apps/.build-test-rules.yml @@ -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 diff --git a/components/esp_lcd/test_apps/i80_lcd/conftest.py b/components/esp_lcd/test_apps/i80_lcd/conftest.py deleted file mode 100644 index 7b54db3b766..00000000000 --- a/components/esp_lcd/test_apps/i80_lcd/conftest.py +++ /dev/null @@ -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) diff --git a/components/esp_lcd/test_apps/i80_lcd/partitions_efuse_emul.csv b/components/esp_lcd/test_apps/i80_lcd/partitions_efuse_emul.csv deleted file mode 100644 index c4c8330ef55..00000000000 --- a/components/esp_lcd/test_apps/i80_lcd/partitions_efuse_emul.csv +++ /dev/null @@ -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, diff --git a/components/esp_lcd/test_apps/i80_lcd/pytest_i80_lcd.py b/components/esp_lcd/test_apps/i80_lcd/pytest_i80_lcd.py index 1f67f8a4959..78511c2ffcf 100644 --- a/components/esp_lcd/test_apps/i80_lcd/pytest_i80_lcd.py +++ b/components/esp_lcd/test_apps/i80_lcd/pytest_i80_lcd.py @@ -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() diff --git a/components/esp_lcd/test_apps/i80_lcd/sdkconfig.ci.flash_enc b/components/esp_lcd/test_apps/i80_lcd/sdkconfig.ci.flash_enc new file mode 100644 index 00000000000..5be9651c381 --- /dev/null +++ b/components/esp_lcd/test_apps/i80_lcd/sdkconfig.ci.flash_enc @@ -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 diff --git a/components/esp_lcd/test_apps/i80_lcd/sdkconfig.ci.virt_flash_enc b/components/esp_lcd/test_apps/i80_lcd/sdkconfig.ci.virt_flash_enc deleted file mode 100644 index b0b4e5681a5..00000000000 --- a/components/esp_lcd/test_apps/i80_lcd/sdkconfig.ci.virt_flash_enc +++ /dev/null @@ -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 diff --git a/components/esp_lcd/test_apps/mipi_dsi_lcd/conftest.py b/components/esp_lcd/test_apps/mipi_dsi_lcd/conftest.py deleted file mode 100644 index 7b54db3b766..00000000000 --- a/components/esp_lcd/test_apps/mipi_dsi_lcd/conftest.py +++ /dev/null @@ -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) diff --git a/components/esp_lcd/test_apps/mipi_dsi_lcd/partitions_efuse_emul.csv b/components/esp_lcd/test_apps/mipi_dsi_lcd/partitions_efuse_emul.csv deleted file mode 100644 index c4c8330ef55..00000000000 --- a/components/esp_lcd/test_apps/mipi_dsi_lcd/partitions_efuse_emul.csv +++ /dev/null @@ -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, diff --git a/components/esp_lcd/test_apps/mipi_dsi_lcd/pytest_mipi_dsi_lcd.py b/components/esp_lcd/test_apps/mipi_dsi_lcd/pytest_mipi_dsi_lcd.py index d722c644eb4..975deac2e07 100644 --- a/components/esp_lcd/test_apps/mipi_dsi_lcd/pytest_mipi_dsi_lcd.py +++ b/components/esp_lcd/test_apps/mipi_dsi_lcd/pytest_mipi_dsi_lcd.py @@ -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() diff --git a/components/esp_lcd/test_apps/mipi_dsi_lcd/sdkconfig.ci.flash_enc b/components/esp_lcd/test_apps/mipi_dsi_lcd/sdkconfig.ci.flash_enc new file mode 100644 index 00000000000..5be9651c381 --- /dev/null +++ b/components/esp_lcd/test_apps/mipi_dsi_lcd/sdkconfig.ci.flash_enc @@ -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 diff --git a/components/esp_lcd/test_apps/mipi_dsi_lcd/sdkconfig.ci.virt_flash_enc b/components/esp_lcd/test_apps/mipi_dsi_lcd/sdkconfig.ci.virt_flash_enc deleted file mode 100644 index b0b4e5681a5..00000000000 --- a/components/esp_lcd/test_apps/mipi_dsi_lcd/sdkconfig.ci.virt_flash_enc +++ /dev/null @@ -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 diff --git a/components/esp_lcd/test_apps/parlio_lcd/conftest.py b/components/esp_lcd/test_apps/parlio_lcd/conftest.py deleted file mode 100644 index 7b54db3b766..00000000000 --- a/components/esp_lcd/test_apps/parlio_lcd/conftest.py +++ /dev/null @@ -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) diff --git a/components/esp_lcd/test_apps/parlio_lcd/partitions_efuse_emul.csv b/components/esp_lcd/test_apps/parlio_lcd/partitions_efuse_emul.csv deleted file mode 100644 index c4c8330ef55..00000000000 --- a/components/esp_lcd/test_apps/parlio_lcd/partitions_efuse_emul.csv +++ /dev/null @@ -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, diff --git a/components/esp_lcd/test_apps/parlio_lcd/pytest_parlio_lcd.py b/components/esp_lcd/test_apps/parlio_lcd/pytest_parlio_lcd.py index 3fec96dedab..406a0a05bdf 100644 --- a/components/esp_lcd/test_apps/parlio_lcd/pytest_parlio_lcd.py +++ b/components/esp_lcd/test_apps/parlio_lcd/pytest_parlio_lcd.py @@ -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() diff --git a/components/esp_lcd/test_apps/parlio_lcd/sdkconfig.ci.flash_enc b/components/esp_lcd/test_apps/parlio_lcd/sdkconfig.ci.flash_enc new file mode 100644 index 00000000000..5be9651c381 --- /dev/null +++ b/components/esp_lcd/test_apps/parlio_lcd/sdkconfig.ci.flash_enc @@ -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 diff --git a/components/esp_lcd/test_apps/parlio_lcd/sdkconfig.ci.virt_flash_enc b/components/esp_lcd/test_apps/parlio_lcd/sdkconfig.ci.virt_flash_enc deleted file mode 100644 index b0b4e5681a5..00000000000 --- a/components/esp_lcd/test_apps/parlio_lcd/sdkconfig.ci.virt_flash_enc +++ /dev/null @@ -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 diff --git a/components/esp_lcd/test_apps/rgb_lcd/conftest.py b/components/esp_lcd/test_apps/rgb_lcd/conftest.py deleted file mode 100644 index 7b54db3b766..00000000000 --- a/components/esp_lcd/test_apps/rgb_lcd/conftest.py +++ /dev/null @@ -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) diff --git a/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c b/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c index 2fd3da4f440..c32cbc95aa4 100644 --- a/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c +++ b/components/esp_lcd/test_apps/rgb_lcd/main/test_rgb_panel.c @@ -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); diff --git a/components/esp_lcd/test_apps/rgb_lcd/partitions_efuse_emul.csv b/components/esp_lcd/test_apps/rgb_lcd/partitions_efuse_emul.csv deleted file mode 100644 index c4c8330ef55..00000000000 --- a/components/esp_lcd/test_apps/rgb_lcd/partitions_efuse_emul.csv +++ /dev/null @@ -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, diff --git a/components/esp_lcd/test_apps/rgb_lcd/pytest_rgb_lcd.py b/components/esp_lcd/test_apps/rgb_lcd/pytest_rgb_lcd.py index 980c9e44464..223cb8a31fd 100644 --- a/components/esp_lcd/test_apps/rgb_lcd/pytest_rgb_lcd.py +++ b/components/esp_lcd/test_apps/rgb_lcd/pytest_rgb_lcd.py @@ -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() diff --git a/components/esp_lcd/test_apps/rgb_lcd/sdkconfig.ci.flash_enc b/components/esp_lcd/test_apps/rgb_lcd/sdkconfig.ci.flash_enc new file mode 100644 index 00000000000..5be9651c381 --- /dev/null +++ b/components/esp_lcd/test_apps/rgb_lcd/sdkconfig.ci.flash_enc @@ -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 diff --git a/components/esp_lcd/test_apps/rgb_lcd/sdkconfig.ci.virt_flash_enc b/components/esp_lcd/test_apps/rgb_lcd/sdkconfig.ci.virt_flash_enc deleted file mode 100644 index b0b4e5681a5..00000000000 --- a/components/esp_lcd/test_apps/rgb_lcd/sdkconfig.ci.virt_flash_enc +++ /dev/null @@ -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 diff --git a/components/esp_lcd/test_apps/spi_lcd/conftest.py b/components/esp_lcd/test_apps/spi_lcd/conftest.py deleted file mode 100644 index 7b54db3b766..00000000000 --- a/components/esp_lcd/test_apps/spi_lcd/conftest.py +++ /dev/null @@ -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) diff --git a/components/esp_lcd/test_apps/spi_lcd/partitions_efuse_emul.csv b/components/esp_lcd/test_apps/spi_lcd/partitions_efuse_emul.csv deleted file mode 100644 index c4c8330ef55..00000000000 --- a/components/esp_lcd/test_apps/spi_lcd/partitions_efuse_emul.csv +++ /dev/null @@ -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, diff --git a/components/esp_lcd/test_apps/spi_lcd/pytest_spi_lcd.py b/components/esp_lcd/test_apps/spi_lcd/pytest_spi_lcd.py index 5df66ea347e..e260a430a9e 100644 --- a/components/esp_lcd/test_apps/spi_lcd/pytest_spi_lcd.py +++ b/components/esp_lcd/test_apps/spi_lcd/pytest_spi_lcd.py @@ -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() diff --git a/components/esp_lcd/test_apps/spi_lcd/sdkconfig.ci.flash_enc b/components/esp_lcd/test_apps/spi_lcd/sdkconfig.ci.flash_enc new file mode 100644 index 00000000000..5be9651c381 --- /dev/null +++ b/components/esp_lcd/test_apps/spi_lcd/sdkconfig.ci.flash_enc @@ -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 diff --git a/components/esp_lcd/test_apps/spi_lcd/sdkconfig.ci.virt_flash_enc b/components/esp_lcd/test_apps/spi_lcd/sdkconfig.ci.virt_flash_enc deleted file mode 100644 index b0b4e5681a5..00000000000 --- a/components/esp_lcd/test_apps/spi_lcd/sdkconfig.ci.virt_flash_enc +++ /dev/null @@ -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