Platform: Add support for AN519 FPGA

 - Add platform specific files to an519 platform directory:
      drivers, register definitions, startup codes, scatter files
 - Add Config*.cmake files for the new target
 - Update documentation of supported platforms
 - Update compiler flags necessary for Cortex-M23 build
 - Add core_cm23.h to cmsis directory

Change-Id: I1519e1ed284dc4f3bc321a0f119d75168e200656
Signed-off-by: Mate Toth-Pal <mate.toth-pal@arm.com>
diff --git a/cmake/Common/CompilerArmClang67.cmake b/cmake/Common/CompilerArmClang67.cmake
index 2bfd1db..c4a5703 100644
--- a/cmake/Common/CompilerArmClang67.cmake
+++ b/cmake/Common/CompilerArmClang67.cmake
@@ -18,6 +18,8 @@
 elseif (${ARM_CPU_ARHITECTURE} STREQUAL "ARM8-M-BASE")
 	string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "--target=" VAL "--target=arm-arm-none-eabi")
 	string_append_unique_item(STRING CMAKE_C_FLAGS_CPU KEY "-march=" VAL "-march=armv8-m.base")
+	#following is to work around an armclang compiler bug that is fixed in 6.10
+	string_append_unique_item(STRING CMAKE_C_FLAGS KEY "-fno-optimize-sibling-calls" VAL "-fno-optimize-sibling-calls")
 	string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "--target=" VAL "--target=arm-arm-none-eabi")
 	string_append_unique_item(STRING CMAKE_CXX_FLAGS_CPU KEY "-march=" VAL "-march=armv8-m.base")
 	string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "--cpu=" VAL "--cpu=8-M.Base")
@@ -43,22 +45,24 @@
 #Prefer arhitecture definition over cpu type.
 if(NOT DEFINED ARM_CPU_ARHITECTURE)
 	if(NOT DEFINED ARM_CPU_TYPE)
-		set(_NO_ARM_CPU_TYPE true)
+		string_append_unique_item(_NO_ARM_CPU_TYPE true)
 	elseif(${ARM_CPU_TYPE} STREQUAL "Cortex-M3")
-		set (CMAKE_C_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m3")
-		set (CMAKE_CXX_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m3")
-		set (CMAKE_ASM_FLAGS_CPU "--cpu=Cortex-M3")
-		set (CMAKE_LINK_FLAGS_CPU "--cpu=Cortex-M3")
+		string_append_unique_item (CMAKE_C_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m3")
+		string_append_unique_item (CMAKE_CXX_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m3")
+		string_append_unique_item (CMAKE_ASM_FLAGS_CPU "--cpu=Cortex-M3")
+		string_append_unique_item (CMAKE_LINK_FLAGS_CPU "--cpu=Cortex-M3")
 	elseif(${ARM_CPU_TYPE} STREQUAL "Cortex-M33")
-		set (CMAKE_C_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m33")
-		set (CMAKE_CXX_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m33")
-		set (CMAKE_ASM_FLAGS_CPU "--cpu=Cortex-M33")
-		set (CMAKE_LINK_FLAGS_CPU "--cpu=Cortex-M33")
+		string_append_unique_item (CMAKE_C_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m33")
+		string_append_unique_item (CMAKE_CXX_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m33")
+		string_append_unique_item (CMAKE_ASM_FLAGS_CPU "--cpu=Cortex-M33")
+		string_append_unique_item (CMAKE_LINK_FLAGS_CPU "--cpu=Cortex-M33")
 	elseif(${ARM_CPU_TYPE} STREQUAL "Cortex-M23")
-		set (CMAKE_C_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m23")
-		set (CMAKE_CXX_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m23")
-		set (CMAKE_ASM_FLAGS_CPU "--cpu=Cortex-M23")
-		set (CMAKE_LINK_FLAGS_CPU "--cpu=Cortex-M23")
+		#-fno-optimize-sibling-calls is here to work around an armclang compiler
+		#bug that is fixed in 6.10
+		string_append_unique_item (CMAKE_C_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m23 -fno-optimize-sibling-calls")
+		string_append_unique_item (CMAKE_CXX_FLAGS_CPU "--target=arm-arm-none-eabi -mcpu=cortex-m23 -fno-optimize-sibling-calls")
+		string_append_unique_item (CMAKE_ASM_FLAGS_CPU "--cpu=Cortex-M23")
+		string_append_unique_item (CMAKE_LINK_FLAGS_CPU "--cpu=Cortex-M23")
 	else()
 		message(FATAL_ERROR "Unknown ARM cpu setting.")
 	endif()