Merge rss_comm support.

RSS Comm is a new protocol used to between the SPs and security
subsystems like the Secure Enclave on Corstone-1000 or RSS on Kronos.

This change deprecates the OpenAMP based original solution. This will
be removed in a future release.

Change-Id: Ic9038bd5e185a41ae41c4d95316e7a28eb45adf4
Signed-Off-By: Gyorgy Szing <gyorgy.szing@arm.com>
diff --git a/external/nanopb/0001-Fix-race-condition-in-directory-creation.patch b/external/nanopb/0001-Fix-race-condition-in-directory-creation.patch
new file mode 100644
index 0000000..2559203
--- /dev/null
+++ b/external/nanopb/0001-Fix-race-condition-in-directory-creation.patch
@@ -0,0 +1,32 @@
+From 388b2d044d3cdab89b7e5e6de94436ca78e1a13b Mon Sep 17 00:00:00 2001
+From: Imre Kis <imre.kis@arm.com>
+Date: Thu, 11 Apr 2024 14:20:16 +0200
+Subject: [PATCH] Fix race condition in directory creation
+
+nanopb_generator.py tests if the output directory exists and creates it
+if not. Because of these two steps are not atomic, there's a chance of
+multiple processes trying to create the directory. One process will
+succeed but the other will fail because the directory already exists.
+Allow existing directory on makedirs call to prevent this issue.
+
+Signed-off-by: Imre Kis <imre.kis@arm.com>
+---
+ generator/nanopb_generator.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/generator/nanopb_generator.py b/generator/nanopb_generator.py
+index c11f6fa..999aaf7 100755
+--- a/generator/nanopb_generator.py
++++ b/generator/nanopb_generator.py
+@@ -2597,7 +2597,7 @@ def main_cli():
+         for path, data in to_write:
+             dirname = os.path.dirname(path)
+             if dirname and not os.path.exists(dirname):
+-                os.makedirs(dirname)
++                os.makedirs(dirname, exist_ok=True)
+ 
+             with open(path, 'w', encoding='utf-8') as f:
+                 f.write(data)
+-- 
+2.25.1
+
diff --git a/external/nanopb/nanopb.cmake b/external/nanopb/nanopb.cmake
index f41b710..d196538 100644
--- a/external/nanopb/nanopb.cmake
+++ b/external/nanopb/nanopb.cmake
@@ -1,5 +1,5 @@
 #-------------------------------------------------------------------------------
-# Copyright (c) 2020-2023, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2024, Arm Limited and Contributors. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-3-Clause
 #
@@ -44,6 +44,9 @@
 	GIT_REPOSITORY ${NANOPB_URL}
 	GIT_TAG ${NANOPB_REFSPEC}
 	GIT_SHALLOW FALSE
+	#See the .patch file for details on why it is needed.
+	PATCH_COMMAND git stash
+		COMMAND git apply ${CMAKE_CURRENT_LIST_DIR}/0001-Fix-race-condition-in-directory-creation.patch
   )
 
 # Only pass libc settings to nanopb if needed. For environments where the standard