diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYTFM_064B0S2_4343W/cytfm_flash_info.c b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYTFM_064B0S2_4343W/cytfm_flash_info.c index 3fc889ad59..841b2ff26a 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYTFM_064B0S2_4343W/cytfm_flash_info.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/TARGET_CYTFM_064B0S2_4343W/cytfm_flash_info.c @@ -26,7 +26,7 @@ #include "region_defs.h" #include "cytfm_flash_info.h" -#if DEVICE_FLASH +#if DEVICE_FLASH && defined(TARGET_TFM) && MBED_CONF_PSA_PRESENT #ifdef __cplusplus extern "C" { diff --git a/targets/TARGET_Cypress/TARGET_PSOC6/cy_flash_api.c b/targets/TARGET_Cypress/TARGET_PSOC6/cy_flash_api.c index c9d01d6e7a..3a95e2d4ac 100644 --- a/targets/TARGET_Cypress/TARGET_PSOC6/cy_flash_api.c +++ b/targets/TARGET_Cypress/TARGET_PSOC6/cy_flash_api.c @@ -17,7 +17,7 @@ #include "flash_api.h" #include "cyhal_flash.h" -#ifdef TARGET_TFM +#if defined(TARGET_TFM) && MBED_CONF_PSA_PRESENT #include "cytfm_flash_info.h" #endif @@ -32,7 +32,7 @@ int32_t flash_init(flash_t *obj) if (CY_RSLT_SUCCESS != cyhal_flash_init(&(obj->flash))) { return -1; } -#ifdef TARGET_TFM +#if defined(TARGET_TFM) && MBED_CONF_PSA_PRESENT cytfm_flash_get_info(&(obj->flash), &(obj->info)); #else /* TARGET_TFM */ cyhal_flash_get_info(&(obj->flash), &(obj->info));