[PATCH 04/13] arm-bsp: corstone1000: Add PLATFORM_IS_FVP toggle for FVP/FPGA builds

Harsimran Singh Tungal <[email protected]>
Newsgroups org.yoctoproject.lists.meta-arm
Message-ID <[email protected]>
Introduces PLATFORM_IS_FVP to differentiate between FVP and FPGA builds.
Adds platform-specific CMake files for corstone1000-fvp and corstone1000-mps3,
and updates platform.cmake to use this toggle.

This commit also adds the TS_PLATFORM variable to corstone1000-fvp.conf
and corstone1000-mps3.conf, explicitly defining platform identifiers
for Trusted Services. This ensures a consistent and clear distinction
between the FVP and MPS3 builds within the build system.

These changes improve maintainability and platform-specific handling
by making it easier to reference the correct target platform
in configurations and scripts.

Signed-off-by: Ali Can Ozaslan <[email protected]>
Signed-off-by: Harsimran Singh Tungal <[email protected]>
---
 .../conf/machine/corstone1000-fvp.conf        |  2 +
 .../conf/machine/corstone1000-mps3.conf       |  2 +
 ...e1000-Add-PLATFORM_IS_FVP-toggle-for.patch | 77 +++++++++++++++++++
 .../trusted-services/ts-arm-platforms.inc     |  1 +
 4 files changed, 82 insertions(+)
 create mode 100644 meta-arm-bsp/recipes-security/trusted-services/corstone1000/0017-Platform-Corstone1000-Add-PLATFORM_IS_FVP-toggle-for.patch

diff --git a/meta-arm-bsp/conf/machine/corstone1000-fvp.conf b/meta-arm-bsp/conf/machine/corstone1000-fvp.conf
index df0275ef..632bd028 100644
--- a/meta-arm-bsp/conf/machine/corstone1000-fvp.conf
+++ b/meta-arm-bsp/conf/machine/corstone1000-fvp.conf
@@ -7,6 +7,8 @@ TFA_TARGET_PLATFORM = "fvp"
 
 TFM_PLATFORM_IS_FVP = "TRUE"
 
+TS_PLATFORM = "arm/corstone1000-fvp"
+
 # testimage config
 TEST_TARGET = "OEFVPTarget"
 TEST_TARGET_IP = "127.0.0.1:2222"
diff --git a/meta-arm-bsp/conf/machine/corstone1000-mps3.conf b/meta-arm-bsp/conf/machine/corstone1000-mps3.conf
index 88f3d9dd..88d01b09 100644
--- a/meta-arm-bsp/conf/machine/corstone1000-mps3.conf
+++ b/meta-arm-bsp/conf/machine/corstone1000-mps3.conf
@@ -7,3 +7,5 @@ require conf/machine/include/corstone1000.inc
 TFA_TARGET_PLATFORM = "fpga"
 
 PLATFORM_IS_FVP = "FALSE"
+
+TS_PLATFORM = "arm/corstone1000-mps3"
diff --git a/meta-arm-bsp/recipes-security/trusted-services/corstone1000/0017-Platform-Corstone1000-Add-PLATFORM_IS_FVP-toggle-for.patch b/meta-arm-bsp/recipes-security/trusted-services/corstone1000/0017-Platform-Corstone1000-Add-PLATFORM_IS_FVP-toggle-for.patch
new file mode 100644
index 00000000..b4c027cc
--- /dev/null
+++ b/meta-arm-bsp/recipes-security/trusted-services/corstone1000/0017-Platform-Corstone1000-Add-PLATFORM_IS_FVP-toggle-for.patch
@@ -0,0 +1,77 @@
+From 00cbde17d3e38de385a6f0897cdd6d9bfe8250c7 Mon Sep 17 00:00:00 2001
+From: Ali Can Ozaslan <[email protected]>
+Date: Thu, 27 Feb 2025 14:06:07 +0000
+Subject: [PATCH 03/10] Platform: Corstone1000: Add PLATFORM_IS_FVP toggle for
+ FVP/FPGA builds
+
+Introduces PLATFORM_IS_FVP to differentiate between FVP and FPGA builds.
+Adds platform-specific CMake files for corstone1000-fvp and corstone1000-mps3,
+and updates platform.cmake to use this toggle.
+
+Upstream-Status: Pending
+Signed-off-by: Ali Can Ozaslan <[email protected]>
+Signed-off-by: Harsimran Singh Tungal <[email protected]>
+---
+ .../providers/arm/corstone1000-fvp/platform.cmake     | 11 +++++++++++
+ .../providers/arm/corstone1000-mps3/platform.cmake    | 11 +++++++++++
+ platform/providers/arm/corstone1000/platform.cmake    |  3 ++-
+ 3 files changed, 24 insertions(+), 1 deletion(-)
+ create mode 100644 platform/providers/arm/corstone1000-fvp/platform.cmake
+ create mode 100644 platform/providers/arm/corstone1000-mps3/platform.cmake
+
+diff --git a/platform/providers/arm/corstone1000-fvp/platform.cmake b/platform/providers/arm/corstone1000-fvp/platform.cmake
+new file mode 100644
+index 00000000..9a281e7a
+--- /dev/null
++++ b/platform/providers/arm/corstone1000-fvp/platform.cmake
+@@ -0,0 +1,11 @@
++#-------------------------------------------------------------------------------
++# Copyright (c) 2025, Arm Limited and Contributors. All rights reserved.
++#
++# SPDX-License-Identifier: BSD-3-Clause
++#
++# Platform definition for the Corstone-1000-MPS3 platform.
++#-------------------------------------------------------------------------------
++
++set(PLATFORM_IS_FVP 1 CACHE BOOL "Whether to enable FVP or FPGA build of the platform.")
++
++include(${TS_PLATFORM_ROOT}/arm/corstone1000/platform.cmake)
+diff --git a/platform/providers/arm/corstone1000-mps3/platform.cmake b/platform/providers/arm/corstone1000-mps3/platform.cmake
+new file mode 100644
+index 00000000..ec92d1e5
+--- /dev/null
++++ b/platform/providers/arm/corstone1000-mps3/platform.cmake
+@@ -0,0 +1,11 @@
++#-------------------------------------------------------------------------------
++# Copyright (c) 2025, Arm Limited and Contributors. All rights reserved.
++#
++# SPDX-License-Identifier: BSD-3-Clause
++#
++# Platform definition for the Corstone-1000-FVP platform.
++#-------------------------------------------------------------------------------
++
++set(PLATFORM_IS_FVP 0 CACHE BOOL "Whether to enable FVP or FPGA build of the platform.")
++
++include(${TS_PLATFORM_ROOT}/arm/corstone1000/platform.cmake)
+diff --git a/platform/providers/arm/corstone1000/platform.cmake b/platform/providers/arm/corstone1000/platform.cmake
+index 04c8138f..60bc208b 100644
+--- a/platform/providers/arm/corstone1000/platform.cmake
++++ b/platform/providers/arm/corstone1000/platform.cmake
+@@ -1,5 +1,5 @@
+ #-------------------------------------------------------------------------------
+-# Copyright (c) 2021-2024, Arm Limited and Contributors. All rights reserved.
++# Copyright (c) 2021-2025, Arm Limited and Contributors. All rights reserved.
+ #
+ # SPDX-License-Identifier: BSD-3-Clause
+ #
+@@ -17,6 +17,7 @@ target_compile_definitions(${TGT} PRIVATE
+ 	PLAT_RSE_COMMS_PAYLOAD_MAX_SIZE=${PLAT_RSE_COMMS_PAYLOAD_MAX_SIZE}
+  	COMMS_MHU_MSG_SIZE=${COMMS_MHU_MSG_SIZE}
+ 	MBEDTLS_ECP_DP_SECP521R1_ENABLED
++	PLATFORM_IS_FVP=${PLATFORM_IS_FVP}
+ )
+ 
+ get_property(_platform_driver_dependencies TARGET ${TGT}
+-- 
+2.34.1
+
diff --git a/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc b/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc
index 543413ea..ed40ca7f 100644
--- a/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc
+++ b/meta-arm-bsp/recipes-security/trusted-services/ts-arm-platforms.inc
@@ -19,6 +19,7 @@ SRC_URI:append:corstone1000  = " \
     file://0015-se-proxy-protobuf-change.patch \
     file://0021-Align-PSA-Crypto-structs-with-TF-Mv2.1.1.patch \
     file://0016-Add-the-com-buffer-address-and-page-count.patch \
+    file://0017-Platform-Corstone1000-Add-PLATFORM_IS_FVP-toggle-for.patch \
     "
 # The patches above introduce errors with GCC 14.1, silence them for now
 CFLAGS:append:corstone1000 = " -Wno-int-conversion -Wno-implicit-function-declaration"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.