From c719e2cbb746d702a69210db4640237f5eb2f043 Mon Sep 17 00:00:00 2001 From: Francois Ramu Date: Fri, 25 Apr 2025 11:13:06 +0200 Subject: [PATCH] tests: drivers: flash testing stm32 flash size Add a special testcase to test any stm32 target The expected flash size is given by the config FLASH_SIZE (in bytes) and stm32 flash driver API function should return the same value Do not run on the stm32wb55 nucleo as 216K are reserved among the 1MB (only 808K declared but mcu has 1MB) Signed-off-by: Francois Ramu --- tests/drivers/flash/common/Kconfig | 4 ++++ tests/drivers/flash/common/testcase.yaml | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/tests/drivers/flash/common/Kconfig b/tests/drivers/flash/common/Kconfig index 817d0da2f5a..4cf79fc6d8b 100644 --- a/tests/drivers/flash/common/Kconfig +++ b/tests/drivers/flash/common/Kconfig @@ -4,11 +4,15 @@ # Device/scenario dependent information that is not available in # other ways. +DT_CHOSEN_Z_FLASH := zephyr,flash + config TEST_DRIVER_FLASH_SIZE int "Size of flash device under test" + default $(dt_chosen_reg_size_int,$(DT_CHOSEN_Z_FLASH),0) if SOC_FAMILY_STM32 default -1 help Expected flash device size the test will validate against. If the flash driver does not support the get_size() API, leave this set as -1 to skip the test. + For the STM32 devices, the flash size is direclty given by the soc DTSI. source "Kconfig.zephyr" diff --git a/tests/drivers/flash/common/testcase.yaml b/tests/drivers/flash/common/testcase.yaml index 7606281fd87..c1adeeeaaba 100644 --- a/tests/drivers/flash/common/testcase.yaml +++ b/tests/drivers/flash/common/testcase.yaml @@ -117,6 +117,14 @@ tests: extra_configs: - CONFIG_DMA=y - CONFIG_SOC_FLASH_SILABS_S2_DMA_READ=y + drivers.flash.common.stm32: + filter: ((CONFIG_FLASH_HAS_DRIVER_ENABLED and not CONFIG_TRUSTED_EXECUTION_NONSECURE) + and CONFIG_SOC_FAMILY_STM32 + and dt_label_with_parent_compat_enabled("storage_partition", "fixed-partitions")) + integration_platforms: + - nucleo_g474re + platform_exclude: + - nucleo_wb55rg drivers.flash.common.non_quad_mode: extra_args: - EXTRA_DTC_OVERLAY_FILE=boards/mx25r64_non_quad.overlay