Fix compilation warnings for OpenAMP

Add support for ArmClang including the correct errno.h.

Silence warnings about unsupported pragma.

Change-Id: Ieb88938399679ddc39f7b8c390e41afef2b46606
diff --git a/.gitignore b/.gitignore
index c58c1f4..7c5676a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,6 @@
 /core_driver
 /cmsis
 /cmsis-nn
-/openamp
 /rtos/freertos
 /rtos/threadx
 /rtos/zephyr
diff --git a/openamp/CMakeLists.txt b/openamp/CMakeLists.txt
index 801c0c8..62abbdd 100644
--- a/openamp/CMakeLists.txt
+++ b/openamp/CMakeLists.txt
@@ -30,10 +30,8 @@
         src/system/${PROJECT_SYSTEM}/${PROJECT_MACHINE}/*.c
 
         # OpenAMP
-#        openamp/lib/proxy/*.c
         openamp/lib/remoteproc/*.c
         openamp/lib/rpmsg/*.c
-#        openamp/lib/service/*.c
         openamp/lib/virtio/*.c)
 
     add_library(openamp-${PROJECT_SYSTEM} STATIC
@@ -50,19 +48,25 @@
         OPENAMP_VERSION_MINOR=0
         OPENAMP_VERSION_PATCH=0
         OPENAMP_VERSION=0
-        $<$<STREQUAL:${CMAKE_CXX_COMPILER_ID},ARMClang>:__ICCARM__>
         METAL_INTERNAL)
 
     target_link_libraries(openamp-${PROJECT_SYSTEM} PRIVATE
         cmsis_device
         $<$<STREQUAL:${PROJECT_SYSTEM},freertos>:freertos_kernel>)
 
+    target_compile_options(openamp-${PROJECT_SYSTEM} PRIVATE
+        -Wno-unknown-pragmas
+    )
+
     # Generate libmetal headers
     file(GLOB_RECURSE HDRS RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/libmetal/lib" "libmetal/lib/*.h")
 
     foreach(HDR ${HDRS})
         configure_file("libmetal/lib/${HDR}" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_SYSTEM}/metal/${HDR}")
     endforeach()
+
+    # Override errno.h adding support for ArmClang
+    configure_file("src/libmetal/errno.h" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_SYSTEM}/metal/errno.h")
 endfunction()
 
 build_openamp(generic)
diff --git a/openamp/src/libmetal/errno.h b/openamp/src/libmetal/errno.h
new file mode 100644
index 0000000..c933a0c
--- /dev/null
+++ b/openamp/src/libmetal/errno.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2020 STMicroelectronnics. All rights reserved.
+ * SPDX-FileCopyrightText: Copyright 2023 Arm Limited and/or its affiliates <open-source-office@arm.com>
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+/*
+ * @file      metal/errno.h
+ * @brief     error specific primitives for libmetal.
+ */
+
+#ifndef __METAL_ERRNO__H__
+#define __METAL_ERRNO__H__
+
+#if defined(__ICCARM__)
+# include <metal/compiler/iar/errno.h>
+#elif defined(__CC_ARM) || defined (__ARMCC_VERSION)
+# include <metal/compiler/armcc/errno.h>
+#else
+# include <errno.h>
+#endif
+
+#endif /* __METAL_ERRNO__H__ */