Add support for Cortex-M85

Rely on CMSIS code for initializing Cortex-M85 devices.

Fallback to mcpu=cortex-m55 for gcc until support for cortex-m85 is
available.

Change-Id: I8b47563c3f0f44e35735a569f2abf8a308948e67
diff --git a/cmake/toolchain/arm-none-eabi-gcc.cmake b/cmake/toolchain/arm-none-eabi-gcc.cmake
index d37a3dc..ec10b2f 100644
--- a/cmake/toolchain/arm-none-eabi-gcc.cmake
+++ b/cmake/toolchain/arm-none-eabi-gcc.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2020-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2020-2022 Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -40,9 +40,16 @@
 set(CMAKE_C_STANDARD 11)
 set(CMAKE_CXX_STANDARD 14)
 
+set(GCC_CPU "${TARGET_CPU}")
+if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "cortex-m85")
+    set(GCC_CPU "cortex-m55")
+    list(APPEND GCC_CPU ${TARGET_CPU_FEATURES})
+    list(JOIN GCC_CPU "+" GCC_CPU)
+endif()
+
 # Compile options
 add_compile_options(
-    -mcpu=${TARGET_CPU}
+    -mcpu=${GCC_CPU}
     -mthumb
     "$<$<CONFIG:DEBUG>:-gdwarf-3>"
     "$<$<COMPILE_LANGUAGE:CXX>:-fno-unwind-tables;-fno-rtti;-fno-exceptions>")
@@ -53,7 +60,7 @@
 
 # Link options
 add_link_options(
-    -mcpu=${TARGET_CPU}
+    -mcpu=${GCC_CPU}
     -mthumb
     --specs=nosys.specs)
 
@@ -63,7 +70,8 @@
 elseif("${TARGET_CPU}" MATCHES "\\+nofp")
     set(FLOAT soft)
 elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "cortex-m33" OR
-       "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "cortex-m55")
+       "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "cortex-m55" OR
+       "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "cortex-m85")
     set(FLOAT hard)
 elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "cortex-m4" OR
         "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "cortex-m7")
@@ -97,4 +105,4 @@
     -Wunused
 
     -Wno-redundant-decls
-)
\ No newline at end of file
+)
diff --git a/cmake/toolchain/armclang.cmake b/cmake/toolchain/armclang.cmake
index f65b9a5..aa19ff4 100644
--- a/cmake/toolchain/armclang.cmake
+++ b/cmake/toolchain/armclang.cmake
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2020-2021 Arm Limited. All rights reserved.
+# Copyright (c) 2020-2022 Arm Limited. All rights reserved.
 #
 # SPDX-License-Identifier: Apache-2.0
 #
@@ -42,7 +42,7 @@
     string(APPEND __LINK_TARGET ".no_fp")
 endif()
 
-if (CMAKE_SYSTEM_PROCESSOR STREQUAL "cortex-m55")
+if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "cortex-m55")
     set(__LINK_TARGET 8.1-M.Main.dsp)
 endif()
 
diff --git a/targets/corstone-310/CMakeLists.txt b/targets/corstone-310/CMakeLists.txt
index 446a424..5583e3c 100644
--- a/targets/corstone-310/CMakeLists.txt
+++ b/targets/corstone-310/CMakeLists.txt
@@ -20,8 +20,7 @@
 # Default parameters
 #############################################################################
 
-# TODO Olympus CPU is backwards compatible with Cortex-M55
-set(TARGET_CPU "cortex-m55" CACHE INTERNAL "")
+set(TARGET_CPU "cortex-m85" CACHE INTERNAL "")
 
 if (NOT CMAKE_TOOLCHAIN_FILE)
     set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/toolchain/armclang.cmake")
diff --git a/targets/corstone-310/platform.ld b/targets/corstone-310/platform.ld
index 9d41f8f..a854afb 100644
--- a/targets/corstone-310/platform.ld
+++ b/targets/corstone-310/platform.ld
@@ -145,8 +145,8 @@
   {
     KEEP(*(.vectors))
     *crt* (.text*)
-    *startup_ARMCM55.c.obj (.text*)
-    *system_ARMCM55.c.obj (.text*)
+    *startup_ARMCM85.c.obj (.text*)
+    *system_ARMCM85.c.obj (.text*)
     *target.cpp.obj (.text*)
 
     KEEP(*(.init))
diff --git a/targets/corstone-310/platform.scatter b/targets/corstone-310/platform.scatter
index f23f3a3..94d34e1 100644
--- a/targets/corstone-310/platform.scatter
+++ b/targets/corstone-310/platform.scatter
@@ -115,8 +115,8 @@
     {
         *.o (RESET, +First)
         *(InRoot$$Sections)
-        startup_ARMCM55.o
-        system_ARMCM55.o
+        startup_ARMCM85.o
+        system_ARMCM85.o
         target.o
         .ANY1 (+RO +RW +ZI)
     }