Build: Cmake build system

 -- Cmake based build system
 -- Only armclang supported currently

Change-Id: I162357439bb1c871cba3a1c614822ef0b7a73e89
Signed-off-by: Abhishek Pandit <abhishek.pandit@arm.com>
diff --git a/cmake/Common/BoardSSE200.cmake b/cmake/Common/BoardSSE200.cmake
new file mode 100644
index 0000000..e4135e5
--- /dev/null
+++ b/cmake/Common/BoardSSE200.cmake
@@ -0,0 +1,11 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Set some global variables our build system uses.
+
+#This board has a Cortex M33 CPU.
+include("Common/CpuM33")
diff --git a/cmake/Common/BuildSys.cmake b/cmake/Common/BuildSys.cmake
new file mode 100644
index 0000000..43e1b90
--- /dev/null
+++ b/cmake/Common/BuildSys.cmake
@@ -0,0 +1,653 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#This file defines project-specific overrides to cmake default behaviour for:
+#	* compiler detection
+#	* target system detection
+cmake_minimum_required(VERSION 3.3) #IN_LIST was introduced in 3.3
+cmake_policy(SET CMP0057 NEW)
+
+Include(CMakeParseArguments)
+
+#The CMAKE_SYSTEM_XXX settings make cmake to stop applying some target system specific settings.
+#Tell cmake we are compiling for ARM chips.
+set (CMAKE_SYSTEM_PROCESSOR "arm" CACHE INTERNAL "Set target processor type to force cmake include some of our scripts." FORCE)
+#Tell cmake this is an "Embedded" system
+set(CMAKE_SYSTEM_NAME "Embedded"  CACHE INTERNAL "Set target system name to force cmake include some of our scripts." FORCE)
+
+#Stop built in CMakeDetermine<lang>.cmake scripts to run.
+set (CMAKE_CXX_COMPILER_ID_RUN 1)
+#Stop cmake run compiler tests.
+set (CMAKE_CXX_COMPILER_FORCED true)
+#Stop built in CMakeDetermine<lang>.cmake scripts to run.
+set (CMAKE_C_COMPILER_ID_RUN 1)
+#Stop cmake run compiler tests.
+set (CMAKE_C_COMPILER_FORCED true)
+
+#This macro is used to enforce the ARM project structure.
+#Inputs: (This macro uses some "global" variables)
+#	global variable PROJ_CONFIG - a global configuration file to be used by all projects.
+#								  It overrides value of CONFIG parameter.
+#	CONFIG - the configuration file which shall be used
+#Examples
+#	To use global project config:
+#		embedded_project_start()
+#	To use config file relative to the top level CmakeLists.txt:
+#		embedded_project_start(./ConfigDefault.cmake)
+#	To use config file relative to the CmakeLists.txt file where this macro is used:
+#		embedded_project_start(${CMAKE_CURRENT_LIST_DIR}/ConfigDefault.cmake)
+macro(embedded_project_start)
+	#Default project configuration file
+	if (DEFINED PROJ_CONFIG) #Take the global setting as default value
+		set(_PROJ_CONFIG ${PROJ_CONFIG})
+	endif()
+
+	set( _OPTIONS_ARGS )					#No option (on/off) arguments
+    set( _ONE_VALUE_ARGS CONFIG)	#Single option arguments (e.g. PROJ_NAME "bubu_project")
+    set( _MULTI_VALUE_ARGS )		#One list argument (e.g. LANGUAGES C ASM CXX)
+    cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+	#Cehck passed parameters
+	if(NOT _MY_PARAMS_CONFIG)
+		if(NOT DEFINED _PROJ_CONFIG)
+			set(_PROJ_CONFIG "./ConfigDefault.cmake")
+			message(STATUS "embedded_project_start: no project configuration file defined, falling back to default.")
+		endif()
+	elseif(NOT DEFINED PROJ_CONFIG)
+		set(_PROJ_CONFIG ${_MY_PARAMS_CONFIG})
+	endif()
+
+	get_filename_component(_ABS_PROJ_CONFIG ${_PROJ_CONFIG} ABSOLUTE)
+	message( STATUS "embedded_project_start: using project specific config file (PROJ_CONFIG = ${_ABS_PROJ_CONFIG})")
+	include("${_PROJ_CONFIG}")
+endmacro()
+
+#Override CMake default behaviour
+macro(embedded_project_fixup)
+	get_property(languages GLOBAL PROPERTY ENABLED_LANGUAGES)
+	if("CXX" IN_LIST languages)
+		include(Common/CompilerDetermineCXX)
+		#since all CMake "built in" scripts already executed, we need fo fix up some things here.
+		embedded_fixup_build_type_vars(CXX)
+	endif()
+	if("C" IN_LIST languages)
+		include(Common/CompilerDetermineC)
+		embedded_fixup_build_type_vars(C)
+	endif()
+
+	#Merge CPU and configuration specific compiler and linker flags.
+	foreach(LNG ${languages})
+		#Apply CPU specific and configuration specific compile flags.
+		if(NOT CMAKE_${LNG}_FLAGS MATCHES ".*${CMAKE_${LNG}_FLAGS_CPU}.*")
+			set(CMAKE_${LNG}_FLAGS "${CMAKE_${LNG}_FLAGS} ${CMAKE_${LNG}_FLAGS_CPU}")
+		endif()
+		#Fix output file extension.
+		set (CMAKE_EXECUTABLE_SUFFIX_${LNG} ".axf")
+		unset(ALL_SRC_${LNG})
+		unset(ALL_SRC_${LNG}_S)
+		unset(ALL_SRC_${LNG}_NS)
+	endforeach()
+	set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_LINK_FLAGS_CPU}")
+endmacro()
+
+#Allow project specific script to do configuration after all targets are specified; it has to be done for each target defined
+macro (embedded_project_end TARGET)
+	get_property(_MAC DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY MACROS)
+	if ("embedded_project_build_config_apply" IN_LIST _MAC)
+		message(WARNING "embedded_project_end(): macro embedded_project_build_config_apply() is defined. Your build config file may be out-dated.")
+	endif()
+
+	#Apply compile flags.
+	_embedded_apply_compile_flags(${TARGET})
+	#Apply macro definitions
+	_embedded_apply_compile_defines(${TARGET})
+	#Apply include paths
+	_embedded_apply_include_directories(${TARGET})
+	#Apply linker flags.
+	_embedded_apply_link_flags(${TARGET})
+	#If target is executable, apply linker command file setting.
+	get_property(_TGT_TYPE TARGET ${TARGET} PROPERTY TYPE)
+	if(_TGT_TYPE STREQUAL "EXECUTABLE")
+		_embedded_apply_linker_cmd_file_setting(${TARGET})
+	endif()
+endmacro()
+
+macro(embedded_fixup_build_type_vars LANG)
+	#since all CMake "built in" scripts already executed, we need fo fix up some things here.
+	set (CMAKE_${LANG}_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT}" CACHE STRING "Flags used by the compiler during debug builds." FORCE)
+	set (CMAKE_${LANG}_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL_INIT}" CACHE STRING "Flags used by the compiler during release builds for minimum size." FORCE)
+	set (CMAKE_${LANG}_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT}" CACHE STRING "Flags used by the compiler during release builds." FORCE)
+	set (CMAKE_${LANG}_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO_INIT}" CACHE STRING "Flags used by the compiler during release builds with debug info." FORCE)
+endmacro()
+
+
+#Convert a CMake list to a string
+#
+#Examples:
+#  list_to_string(my_string 1 2 3 4)
+#  list_to_string(my_string ${CMAKE_C_FLAGS})
+#
+#INPUTS:
+#    RES  - (mandatory) - name of variable to put result in
+#    The list to be converted.
+#
+#OUTPUTS
+#    List items concatenated to a string.
+#
+function(list_to_string RES)
+	foreach(_ITEM ${ARGN})
+		set(_RES "${_RES} ${_ITEM}")
+	endforeach()
+	set(${RES} "${_RES}" PARENT_SCOPE)
+endfunction()
+
+#Ensure current generator is supported.
+#
+# This function takes a list of supported generators (e.g. "Unix Makefiles") and
+# exits with fatal error is the current generator is not on the list.
+#Examples:
+#  assert_generator_is("MSYS Makefiles" "MinGW Makefiles")
+#
+#INPUTS:
+#    The list of supported generators.
+#
+#OUTPUTS
+#    n/a
+#
+function(assert_generator_is)
+		if (NOT CMAKE_GENERATOR IN_LIST ARGN)
+			message(FATAL_ERROR "assert_generator_is(): Generator '${CMAKE_GENERATOR}' is not on the list of supported generators.")
+		endif()
+endfunction()
+
+#Specify an include path for the compiler
+#
+# Specify a global include directory for all non external targets in the current
+# build.
+# The parameter ABSOLUTE can be set to true to ask CMake to convert the PATH to
+# absolute. This gives better looking command line arguments, and also helps
+# removing duplicates.
+#
+#Examples:
+#  embedded_include_directories(PATH "C:/fo/bar/include")
+#  embedded_include_directories(PATH "C:/fo/bar/include" ABSOLUTE)
+#
+#INPUTS:
+#    PATH  - (mandatory) - the include path to add
+#    ABSOLUTE - (optional) - whether the path shall be converted to absolute
+#
+#OUTPUTS
+#    Modified list of include directories.
+#
+function (embedded_include_directories)
+	#Parse our arguments
+	set( _OPTIONS_ARGS ABSOLUTE)		#Option (on/off) arguments (e.g. IGNORE_CASE)
+	set( _ONE_VALUE_ARGS  PATH)		#Single option arguments (e.g. PATH "./foo/bar")
+	set( _MULTI_VALUE_ARGS )		#List arguments (e.g. LANGUAGES C ASM CXX)
+	cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+	#Check mandatory parameters
+	if(NOT _MY_PARAMS_PATH)
+		failure("embedded_include_directories(): Missing PATH parameter!")
+	endif()
+
+	if(DEFINED _MY_PARAMS_ABSOLUTE AND ${_MY_PARAMS_ABSOLUTE})
+		get_filename_component(_MY_PARAMS_PATH ${_MY_PARAMS_PATH} ABSOLUTE)
+	endif()
+
+	include_directories(${_MY_PARAMS_PATH})
+endfunction()
+
+#Return the language of a source file.
+#
+# Language is either specified by the LANGUAGE property of the source file or
+# determined based on the extension of the file.
+# Search is limited for languages enabled in the current project.
+#
+#Examples:
+#  To get language of "foo/bar.c" written into _LNG:
+#  embedded_get_source_language("foo/bar.c" _LNG)
+#
+#INPUTS:
+#   FILE  - (mandatory) - The file to determine language of.
+#   RES   - (mandatory) - Name of the variable to write the result into.
+#
+#OUTPUTS
+#   ${RES} - language string (e.g. "C", "CXX", "ASM"). empty string for files
+#			 with no language.
+#
+function(embedded_get_source_language FILE RES)
+	if (ARGN)
+		message(FATAL_ERROR "embedded_get_source_language(): too many parameters passed.")
+	endif()
+	#If language property is set, use that.
+	get_property(_LNG SOURCE ${_SRC} PROPERTY LANGUAGE)
+	if (NOT ${_LNG} STREQUAL "")
+		set(${RES} ${_LNG} PARENT_SCOPE)
+	else()
+		#Set empty return value.
+		set(${RES} "" PARENT_SCOPE)
+		#Property not set, use extension of the file to determine
+		#language.
+		string(REGEX MATCH "[^.]*$" _EXT "${_SRC}")
+		#Get list of enabled languages.
+		get_property(_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+		foreach(_LNG ${_LANGUAGES})
+			#See if the extension is contained in the list of file extensions
+			#of this language.
+			if(_EXT IN_LIST CMAKE_${_LNG}_SOURCE_FILE_EXTENSIONS)
+				set(${RES} ${_LNG} PARENT_SCOPE)
+				break()
+			endif()
+		endforeach()
+	endif()
+endfunction()
+
+#Set compilation flags for the specified target.
+#
+# Store compilation flags for the specified target and language pair. Flags are
+# stored in a global property and will
+# be applied to source files in the current directory and sub-directories.
+# Property name must follow a specific scheme (see outputs).
+# See: _embedded_apply_compile_flags()
+#
+#Examples:
+#  embedded_set_target_compile_flags(my_app C "-fchar-unsigned")
+#  embedded_set_target_compile_flags(my_lib CXX "-fchar-unsigned")
+#  embedded_set_target_compile_flags(my_app ASM "-fchar-unsigned")
+#
+#INPUTS:
+#   TARGET   - (mandatory) - The target to apply settings to.
+#   LANGUAGE - (mandatory) - Programming language of source files settings shall
+#							 be applied to.
+#	FLAGS    - (mandatory) - List with the compiler flags.
+#	APPEND   - (optional)  - True if FLAGS shall be appended.
+#
+#OUTPUTS
+#	Directory property EMBEDDED_COMPILE_FLAGS_TTT_LLL is set, where TTT is the
+#	target name, and LLL is the language.
+#
+function (embedded_set_target_compile_flags)
+	set( _OPTIONS_ARGS APPEND)		#Option (on/off) arguments (e.g. IGNORE_CASE)
+	set( _ONE_VALUE_ARGS  TARGET LANGUAGE)	#Single option arguments (e.g. PATH "./foo/bar")
+	set( _MULTI_VALUE_ARGS FLAGS)		#List arguments (e.g. LANGUAGES C ASM CXX)
+	cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+	if (NOT DEFINED _MY_PARAMS_TARGET)
+		message(FATAL_ERROR "embedded_set_target_compile_flags(): mandatory parameter 'TARGET' missing.")
+	endif()
+
+	if (NOT DEFINED _MY_PARAMS_LANGUAGE)
+		message(FATAL_ERROR "embedded_set_target_compile_flags(): mandatory parameter 'LANGUAGE' missing.")
+	endif()
+
+	if (NOT DEFINED _MY_PARAMS_FLAGS)
+		message(FATAL_ERROR "embedded_set_target_compile_flags(): mandatory parameter 'FLAGS' missing.")
+	endif()
+
+	if (_MY_PARAMS_APPEND)
+		set_property(GLOBAL APPEND PROPERTY EMBEDDED_COMPILE_FLAGS_${_MY_PARAMS_TARGET}_${_MY_PARAMS_LANGUAGE} ${_MY_PARAMS_FLAGS})
+	else()
+		set_property(GLOBAL PROPERTY EMBEDDED_COMPILE_FLAGS_${_MY_PARAMS_TARGET}_${_MY_PARAMS_LANGUAGE} ${_MY_PARAMS_FLAGS})
+	endif()
+endfunction()
+
+#Apply compilation flag settings for the specified target.
+#
+# Compilation flags stored in a global property and are applied to source files.
+# Note:
+#	- Directory property name must follow a specific scheme.
+#	- This is an internal function.
+#	- This function only supports make and ninja generators.
+#
+# See: embedded_set_target_compile_flags()
+#
+#Examples:
+#  _embedded_apply_compile_flags(my_app)
+#
+#INPUTS:
+#   TARGET  - (mandatory) 			- The target to apply settings to.
+#	Directory property - (optional) - Flags to apply.
+#
+#OUTPUTS
+#    n/a
+#
+function(_embedded_apply_compile_flags TARGET)
+	#Check if the parameter is a target.
+  	if(NOT TARGET ${TARGET})
+		message(FATAL_ERROR "_embedded_apply_compile_flags(): target '${TARGET}' is not defined.")
+	endif()
+	#Get list of enabled languages.
+	get_property(_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+	foreach(_LNG ${_LANGUAGES})
+		#Get the flags for this language.
+		get_property(_FLAGS GLOBAL PROPERTY EMBEDDED_COMPILE_FLAGS_${TARGET}_${_LNG})
+
+		#The generator expression below is only supported by the make and ninja
+		#generators.
+		assert_generator_is(_GENERATORS_OK "MSYS Makefiles" "MinGW Makefiles" "NMake Makefiles" "NMake Makefiles JOM" "Unix Makefiles" "Watcom WMake" "Ninja")
+		target_compile_options(${TARGET} PRIVATE $<$<COMPILE_LANGUAGE:${_LNG}>:${_FLAGS}>)
+	endforeach()
+endfunction()
+
+#Set compilation defines for the specified target.
+#
+# Store compilation defines for the specified target and language pair. Macros
+# are stored in a global property and will
+# be applied to source files in the current directory and sub-directories.
+# Property name must follow a specific scheme (see outputs).
+# See: _embedded_apply_compile_defines()
+#
+#Examples:
+#  embedded_set_target_compile_defines(my_app C "FOO BAR=1")
+#  embedded_set_target_compile_defines(my_lib CXX "FOO BAR=1")
+#  embedded_set_target_compile_defines(my_app ASM "FOO BAR=1")
+#
+#INPUTS:
+#   TARGET   - (mandatory) - The target to apply settings to.
+#   LANGUAGE - (mandatory) - Programming language of source files settings shall
+#							 be applied to.
+#	DEFINES  - (mandatory) - List with the compiler flags.
+#	APPEND   - (optional)  - Present if FLAGS shall be appended.
+#
+#OUTPUTS
+#	Directory property EMBEDDED_COMPILE_DEFINES_TTT_LLL is set, where TTT is the
+#	target name, and LLL is the language.
+#
+function (embedded_set_target_compile_defines)
+	set( _OPTIONS_ARGS APPEND)		#Option (on/off) arguments (e.g. IGNORE_CASE)
+	set( _ONE_VALUE_ARGS  TARGET LANGUAGE)	#Single option arguments (e.g. PATH "./foo/bar")
+	set( _MULTI_VALUE_ARGS DEFINES)		#List arguments (e.g. LANGUAGES C ASM CXX)
+	cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+	if (NOT DEFINED _MY_PARAMS_TARGET)
+		message(FATAL_ERROR "embedded_set_target_compile_defines(): mandatory parameter 'TARGET' missing.")
+	endif()
+
+	if (NOT DEFINED _MY_PARAMS_LANGUAGE)
+		message(FATAL_ERROR "embedded_set_target_compile_defines(): mandatory parameter 'LANGUAGE' missing.")
+	endif()
+
+	if (NOT DEFINED _MY_PARAMS_DEFINES)
+		message(FATAL_ERROR "embedded_set_target_compile_defines(): mandatory parameter 'DEFINES' missing.")
+	endif()
+
+	if (_MY_PARAMS_APPEND)
+		set_property(GLOBAL APPEND PROPERTY EMBEDDED_COMPILE_DEFINES_${_MY_PARAMS_TARGET}_${_MY_PARAMS_LANGUAGE} ${_MY_PARAMS_DEFINES})
+	else()
+		set_property(GLOBAL PROPERTY EMBEDDED_COMPILE_DEFINES_${_MY_PARAMS_TARGET}_${_MY_PARAMS_LANGUAGE} ${_MY_PARAMS_DEFINES})
+	endif()
+endfunction()
+
+#Apply compilation defines for the specified target.
+#
+# Macro definitions are stored in a global property and are applied to
+# source files.
+#
+# Note:
+#	- Directory property name must follow a specific scheme.
+#	- This is an internal function.
+#	- This function only supports make and ninja generators.
+#
+# See: embedded_set_target_compile_defines()
+#
+#Examples:
+#  _embedded_apply_compile_defines(my_app)
+#
+#INPUTS:
+#   TARGET  - (mandatory) 			- The target to apply settings to.
+#	Directory property - (optional) - Flags to apply.
+#
+#OUTPUTS
+#    n/a
+#
+function(_embedded_apply_compile_defines TARGET)
+	#Check if the parameter is a target.
+  	if(NOT TARGET ${TARGET})
+		message(FATAL_ERROR "_embedded_apply_compile_defines(): target '${TARGET}' is not defined.")
+	endif()
+	#Get list of enabled languages.
+	get_property(_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
+	foreach(_LNG ${_LANGUAGES})
+		#Get the flags for this language.
+		get_property(_FLAGS GLOBAL PROPERTY EMBEDDED_COMPILE_DEFINES_${TARGET}_${_LNG})
+		#The generator expression below is only supported by the make and ninja
+		#generators.
+		assert_generator_is(_GENERATORS_OK "MSYS Makefiles" "MinGW Makefiles" "NMake Makefiles" "NMake Makefiles JOM" "Unix Makefiles" "Watcom WMake" "Ninja")
+		target_compile_definitions(${TARGET} PRIVATE $<$<COMPILE_LANGUAGE:${_LNG}>:${_FLAGS}>)
+	endforeach()
+endfunction()
+
+#Specify an include path for the compiler affecting a specific build target (all
+# languages).
+#
+# Store include paths for the specified target. PATH is stored in a global
+# property. The property name must follow a specific scheme (see outputs).
+# See: _embedded_apply_include_directories()
+#
+#Examples:
+#  embedded_target_include_directories(TARGET foo PATH "C:/fo/bar/include")
+#  embedded_target_include_directories(TARGET foo PATH "C:/fo/bar/include" APPEND)
+#  embedded_target_include_directories(TARGET foo PATH "C:/fo/bar/include" ABSOLUTE)
+#
+#INPUTS:
+#    ABSOLUTE - (optional)- whether the path shall be converted to absolute
+#	 APPEND - (optional)  - if set append path to existing values
+#    PATH  - (mandatory)  - the include path to add
+#	 TARGET - (mandatory) - name of target to apply settings to
+#
+#OUTPUTS
+#	Directory property EMBEDDED_COMPILE_INCLUDES_TTT is set, where TTT is
+#	the target name.
+#
+function (embedded_target_include_directories)
+	#Parse our arguments
+	set( _OPTIONS_ARGS ABSOLUTE APPEND)	#Option (on/off) arguments (e.g. IGNORE_CASE)
+	set( _ONE_VALUE_ARGS  PATH TARGET) #Single option arguments (e.g. PATH "./foo/bar")
+	set( _MULTI_VALUE_ARGS )		#List arguments (e.g. LANGUAGES C ASM CXX)
+	cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+	#Check mandatory parameters
+	if(NOT _MY_PARAMS_PATH)
+		failure("embedded_target_include_directories(): Missing PATH parameter!")
+	endif()
+
+	if(NOT _MY_PARAMS_TARGET)
+		failure("embedded_target_include_directories(): Missing TARGET parameter!")
+	endif()
+
+	if(DEFINED _MY_PARAMS_ABSOLUTE AND ${_MY_PARAMS_ABSOLUTE})
+		get_filename_component(_MY_PARAMS_PATH ${_MY_PARAMS_PATH} ABSOLUTE)
+	endif()
+
+	if (_MY_PARAMS_APPEND)
+		set_property(GLOBAL APPEND PROPERTY EMBEDDED_COMPILE_INCLUDES_${_MY_PARAMS_TARGET} ${_MY_PARAMS_PATH})
+	else()
+		set_property(GLOBAL PROPERTY EMBEDDED_COMPILE_INCLUDES_${_MY_PARAMS_TARGET} ${_MY_PARAMS_PATH})
+	endif()
+endfunction()
+
+#Apply include path settings for the specified target.
+#
+# Include paths are stored in a global property and are applied to source files.
+# Note:
+#	- Directory property name must follow a specific scheme.
+#	- This is an internal function.
+#
+# See: embedded_target_include_directories()
+#
+#Examples:
+#  _embedded_apply_include_directories(my_app)
+#
+#INPUTS:
+#   TARGET  - (mandatory) 			- The target to apply settings to.
+#	Directory property - (optional) - Flags to apply.
+#
+#OUTPUTS
+#    n/a
+#
+function(_embedded_apply_include_directories TARGET)
+	#Check if the parameter is a target.
+  	if(NOT TARGET ${TARGET})
+		message(FATAL_ERROR "_embedded_apply_include_directories(): target '${TARGET}' is not defined.")
+	endif()
+	#Get the flags for this language.
+	get_property(_FLAGS GLOBAL PROPERTY EMBEDDED_COMPILE_INCLUDES_${TARGET})
+	#If we have flags to apply for this language.
+	if (NOT _FLAGS STREQUAL "")
+		target_include_directories(${TARGET} PRIVATE ${_FLAGS})
+	endif()
+endfunction()
+
+#Set linker flags for the specified target.
+#
+# Store linker flags for the specified target in a global property.
+# See: _embedded_apply_link_flags()
+#
+#Examples:
+#  embedded_set_target_link_flags(my_app "-M my_map_file.map")
+#
+#INPUTS:
+#   TARGET  - (mandatory) - The target to apply settings to.
+#	FLAGS   - (mandatory) - List with the compiler flags.
+#	APPEND  - (optional)  - True if FLAGS shall be appended.
+#
+#OUTPUTS
+#	Directory property EMBEDDED_LINKER_FLAGS_TTT is set, where TTT is the
+#	target name.
+#
+function(embedded_set_target_link_flags)
+	set( _OPTIONS_ARGS APPEND)		#Option (on/off) arguments (e.g. IGNORE_CASE)
+	set( _ONE_VALUE_ARGS  TARGET)	#Single option arguments (e.g. PATH "./foo/bar")
+	set( _MULTI_VALUE_ARGS FLAGS)		#List arguments (e.g. LANGUAGES C ASM CXX)
+	cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+	if (NOT DEFINED _MY_PARAMS_TARGET)
+		message(FATAL_ERROR "embedded_set_target_link_flags(): mandatory parameter 'TARGET' missing.")
+	endif()
+
+	if (NOT DEFINED _MY_PARAMS_FLAGS)
+		message(FATAL_ERROR "embedded_set_target_link_flags(): mandatory parameter 'FLAGS' missing.")
+	endif()
+
+	if (_MY_PARAMS_APPEND)
+		set_property(GLOBAL APPEND PROPERTY EMBEDDED_LINKER_FLAGS_${_MY_PARAMS_TARGET} ${_MY_PARAMS_FLAGS})
+	else()
+		set_property(GLOBAL PROPERTY EMBEDDED_LINKER_FLAGS_${_MY_PARAMS_TARGET} ${_MY_PARAMS_FLAGS})
+	endif()
+endfunction()
+
+#Apply linker flags for the specified target.
+#
+# Linker flags stored in a global property are applied.
+#
+# Note:
+#	- Directory property name must follow a specific scheme.
+#	- This is an internal function.
+#
+# See: embedded_set_target_link_flags()
+#
+#Examples:
+#  _embedded_apply_link_flags(my_app)
+#
+#INPUTS:
+#   TARGET  - (mandatory) 			- The target to apply settings to.
+#	Directory property - (optional) - Flags to apply.
+#
+#OUTPUTS
+#    n/a
+#
+function(_embedded_apply_link_flags TARGET)
+	#Check if the parameter is a target.
+	if(NOT TARGET ${TARGET})
+		message(FATAL_ERROR "_embedded_apply_link_flags(): target '${TARGET}' is not defined.")
+	endif()
+	#Get the stored flags.
+	get_property(_FLAGS GLOBAL PROPERTY EMBEDDED_LINKER_FLAGS_${TARGET})
+	#Apply flags if defined.
+	if (NOT _FLAGS STREQUAL "")
+		list_to_string(_STR_FLAGS ${_FLAGS})
+		set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS  ${_STR_FLAGS})
+	endif()
+endfunction()
+
+#Set linker command file for the specified target.
+#
+# Store path to linker command file for the specified target in a global
+# property.
+#
+# See: _embedded_apply_linker_cmd_file_setting()
+#
+#Examples:
+#  embedded_set_target_linker_file(my_app "foo/my_linker_cmd.sct")
+#
+#INPUTS:
+#   TARGET  - (mandatory) - The target to apply settings to.
+#	PATH - (mandatory)	  - Path to linker script.
+#
+#OUTPUTS
+#	Directory property EMBEDDED_LINKER_CMD_FILE_TTT is set, where TTT is the
+#	target name.
+#
+function(embedded_set_target_linker_file)
+	set( _OPTIONS_ARGS )				#Option (on/off) arguments (e.g. IGNORE_CASE)
+	set( _ONE_VALUE_ARGS  TARGET PATH)	#Single option arguments (e.g. PATH "./foo/bar")
+	set( _MULTI_VALUE_ARGS )			#List arguments (e.g. LANGUAGES C ASM CXX)
+	cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+	if (NOT DEFINED _MY_PARAMS_TARGET)
+		message(FATAL_ERROR "embedded_set_target_linker_file(): mandatory parameter 'TARGET' missing.")
+	endif()
+
+	if (NOT DEFINED _MY_PARAMS_PATH)
+		message(FATAL_ERROR "embedded_set_target_linker_file(): mandatory parameter 'PATH' missing.")
+	endif()
+
+	set_property(GLOBAL PROPERTY EMBEDDED_LINKER_CMD_FILE_${_MY_PARAMS_TARGET} ${_MY_PARAMS_PATH})
+endfunction()
+
+#Apply linker linker command file setting for the specified target.
+#
+# Path to linker command file stored in a global property is applied.
+#
+# Note:
+#	- Directory property name must follow a specific scheme.
+#	- This is an internal function.
+#
+# See: embedded_set_target_linker_file()
+#
+#Examples:
+#  _embedded_apply_linker_cmd_file_setting(my_app)
+#
+#INPUTS:
+#   TARGET  - (mandatory) 			- The target to apply settings to.
+#	Directory property - (optional) - Flags to apply.
+#
+#OUTPUTS
+#    n/a
+#
+function(_embedded_apply_linker_cmd_file_setting TARGET)
+	#Check if the parameter is a target.
+  	if(NOT TARGET ${TARGET})
+		message(FATAL_ERROR "_embedded_apply_linker_cmd_file_setting(): target '${TARGET}' is not defined.")
+	endif()
+	#Check if target is an executable.
+	get_property(_TGT_TYPE TARGET ${TARGET} PROPERTY TYPE)
+	if(NOT _TGT_TYPE STREQUAL "EXECUTABLE")
+		message(FATAL_ERROR "_embedded_apply_linker_cmd_file_setting(): target '${TARGET}' is not an executable.")
+	endif()
+
+	#Check if executable has a linker command file set.
+	get_property(_LINKER_CMD_FILE GLOBAL PROPERTY EMBEDDED_LINKER_CMD_FILE_${TARGET} SET)
+	if (NOT _LINKER_CMD_FILE)
+		message(FATAL_ERROR "_embedded_apply_linker_cmd_file_setting(): Please set linker command file for target '${TARGET}' using embedded_set_target_linker_file().")
+	endif()
+	#Get the path to the linker command file.
+	get_property(_LINKER_CMD_FILE GLOBAL PROPERTY EMBEDDED_LINKER_CMD_FILE_${TARGET})
+	#Set the path
+	compiler_set_linkercmdfile(${TARGET} ${_LINKER_CMD_FILE})
+endfunction()
diff --git a/cmake/Common/CompilerArmClang67.cmake b/cmake/Common/CompilerArmClang67.cmake
new file mode 100644
index 0000000..0ee34b2
--- /dev/null
+++ b/cmake/Common/CompilerArmClang67.cmake
@@ -0,0 +1,64 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#This file contains settings to specify how ARMCLANG shall be used
+
+#Include some dependencies
+Include(Common/CompilerArmClangCommon)
+Include(Common/Utils)
+
+check_armclang_input_vars("6.7")
+
+if(NOT DEFINED ARM_CPU_ARHITECTURE)
+	set(_NO_ARM_CPU_ARHITECTURE true)
+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")
+	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")
+	string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "--cpu=" VAL "--cpu=8-M.Base")
+elseif(${ARM_CPU_ARHITECTURE} STREQUAL "ARM8-M-MAIN")
+	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.main")
+	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.main")
+	string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "--cpu=" VAL "--cpu=8-M.Main")
+	string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "--cpu=" VAL "--cpu=8-M.Main")
+elseif(${ARM_CPU_ARHITECTURE} STREQUAL "V7-M")
+	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")
+	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=armv7-m")
+	string_append_unique_item(STRING CMAKE_ASM_FLAGS_CPU KEY "--cpu=" VAL "--cpu=7-M")
+	string_append_unique_item(STRING CMAKE_LINK_FLAGS_CPU KEY "--cpu=" VAL "--cpu=7-M")
+else()
+	message(FATAL_ERROR "Unknown or unsupported ARM cpu architecture setting.")
+endif()
+
+#Prefer arhitecture definition over cpu type.
+if(NOT DEFINED ARM_CPU_ARHITECTURE)
+	if(NOT DEFINED ARM_CPU_TYPE)
+		set(_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")
+	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")
+	else()
+		message(FATAL_ERROR "Unknown ARM cpu setting.")
+	endif()
+endif()
+
+if (_NO_ARM_CPU_TYPE AND _NO_ARM_CPU_ARHITECTURE)
+	message(FATAL_ERROR "Can not set CPU specific compiler flags: neither the ARM CPU type nor the architecture is set.")
+endif()
diff --git a/cmake/Common/CompilerArmClangCommon.cmake b/cmake/Common/CompilerArmClangCommon.cmake
new file mode 100644
index 0000000..4059bdf
--- /dev/null
+++ b/cmake/Common/CompilerArmClangCommon.cmake
@@ -0,0 +1,119 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#This file contains settings to specify how ARMCLANG shall be used
+
+function(check_armclang_input_vars MY_VERSION)
+	#Specify where armclang is
+	if (NOT DEFINED ARMCLANG_PATH)
+		message(FATAL_ERROR "Please set ARMCLANG_PATH to the root directory of the armclang installation. e.g. set(ARMCLANG_PATH \"C:/Program Files/ARMCompiler${MY_VERSION}\")")
+	endif()
+
+	STRING(REGEX REPLACE "([0-9]+).([0-9]+).*" "\\1.\\2" _MY_MAJOR_MINOR "${MY_VERSION}")
+	STRING(REGEX REPLACE "([0-9]+).([0-9]+).*" "\\1.\\2" _ARMCLANG_MAJOR_MINOR "${ARMCLANG_VER}")
+
+	#Check armclang version.
+	if (NOT "${_MY_MAJOR_MINOR}" VERSION_EQUAL "${_ARMCLANG_MAJOR_MINOR}")
+		message(FATAL_ERROR "ARMClang version (ARMCLANG_VER=${ARMCLANG_VER}) does not match ${MY_VERSION}")
+	endif()
+
+	#Emit warning if needed environment variables are not set.
+	if(NOT DEFINED ENV{ARM_TOOL_VARIANT} OR NOT DEFINED ENV{ARM_PRODUCT_PATH})
+		message(WARNING "ARM_TOOL_VARIANT or ARM_PRODUCT_PATH environment variables are not set!")
+	endif()
+
+	if (NOT DEFINED ARM_CPU_ARHITECTURE AND NOT DEFINED ARM_CPU_TYPE)
+		message(FATAL_ERROR "ARM_CPU_TYPE and ARM_CPU_ARHITECTURE is not defined! Please include the CPU specific config file before this one.")
+	endif()
+
+endfunction()
+
+message(STATUS "Using armclang compiler package v${ARMCLANG_VER} from ${ARMCLANG_PATH}")
+
+
+#Tell cmake which compiler we use
+if (EXISTS "c:/")
+	set (CMAKE_C_COMPILER "${ARMCLANG_PATH}/bin/armclang.exe")
+	set (CMAKE_CXX_COMPILER "${ARMCLANG_PATH}/bin/armclang.exe")
+	set (CMAKE_ASM_COMPILER "${ARMCLANG_PATH}/bin/armasm.exe")
+else()
+	set (CMAKE_C_COMPILER "${ARMCLANG_PATH}/bin/armclang")
+	set (CMAKE_CXX_COMPILER "${ARMCLANG_PATH}/bin/armclang")
+	set (CMAKE_ASM_COMPILER "${ARMCLANG_PATH}/bin/armasm")
+endif()
+
+if("CXX" IN_LIST languages)
+	set(CMAKE_CXX_COMPILER_ID "ARMCLANG" CACHE INTERNAL "CXX compiler ID" FORCE)
+	include(Compiler/ARMClang-CXX)
+endif()
+
+if("C" IN_LIST languages)
+	set(CMAKE_C_COMPILER_ID "ARMCLANG" CACHE INTERNAL "C compiler ID" FORCE)
+	include(Compiler/ARMClang-C)
+endif()
+
+if("ASM" IN_LIST languages)
+	set(CMAKE_C_COMPILER_ID "ARMCLANG" CACHE INTERNAL "ASM compiler ID" FORCE)
+	include(Compiler/ARMClang-ASM)
+endif()
+
+function(compiler_set_linkercmdfile TARGET FILE_PATH)
+	#Note: the space before the option is important!
+	set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " --scatter=${FILE_PATH}")
+	set_property(TARGET ${TARGET} APPEND PROPERTY LINK_DEPENDS ${FILE_PATH})
+	#Tell cmake .map files shall be removed when project is cleaned (make clean)
+	get_filename_component(_TARGET_BASE_NAME ${TARGET} NAME_WE)
+	get_directory_property(_ADDITIONAL_MAKE_CLEAN_FILES DIRECTORY "./" ADDITIONAL_MAKE_CLEAN_FILES)
+	set_directory_properties(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_ADDITIONAL_MAKE_CLEAN_FILES} ${_TARGET_BASE_NAME}.map")
+endfunction()
+
+function(compiler_set_cmse_output TARGET FILE_PATH)
+	#Note: the space before the option is important!
+	set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " --import_cmse_lib_out=${FILE_PATH}")
+	#Tell cmake cmse output is a generated object file.
+	SET_SOURCE_FILES_PROPERTIES("${FILE_PATH}" PROPERTIES EXTERNAL_OBJECT true GENERATED true)
+	#Tell cmake cmse output shall be removed by clean target.
+	get_directory_property(_ADDITIONAL_MAKE_CLEAN_FILES DIRECTORY "./" ADDITIONAL_MAKE_CLEAN_FILES)
+	set_directory_properties(PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "${_ADDITIONAL_MAKE_CLEAN_FILES} ${FILE_PATH}")
+endfunction()
+
+function(compiler_merge_library)
+	set( _OPTIONS_ARGS )			#Option (on/off) arguments.
+    set( _ONE_VALUE_ARGS DEST)		#Single option arguments.
+    set( _MULTI_VALUE_ARGS LIBS)	#List arguments
+    cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+	#Check passed parameters
+	if(NOT _MY_PARAMS_DEST)
+		message(FATAL_ERROR "embedded_merge_library: no destination library target specified.")
+	endif()
+	#Check if destination is a target
+	if(NOT TARGET ${_MY_PARAMS_DEST})
+		message(FATAL_ERROR "embedded_merge_library: parameter DEST must be a target already defined.")
+	endif()
+	#Check if destination is a library
+	get_target_property(_tmp ${_MY_PARAMS_DEST} TYPE)
+	if(NOT "${_tmp}" STREQUAL "STATIC_LIBRARY")
+		message(FATAL_ERROR "embedded_merge_library: parameter DEST must be a static library target.")
+	endif()
+
+	#Check list if libraries to be merged
+	if(NOT _MY_PARAMS_LIBS)
+		message(FATAL_ERROR "embedded_merge_library: no source libraries specified. Please see the LIBS parameter.")
+	endif()
+
+	#Mark each library file as a generated external object. This is needed to
+	#avoid error because CMake has no info how these can be built.
+	SET_SOURCE_FILES_PROPERTIES(
+	  ${_MY_PARAMS_LIBS}
+	  PROPERTIES
+	  EXTERNAL_OBJECT true
+	  GENERATED true)
+
+	#Add additional input to target
+	target_sources(${_MY_PARAMS_DEST} PRIVATE ${_MY_PARAMS_LIBS})
+endfunction()
diff --git a/cmake/Common/CompilerDetermineC.cmake b/cmake/Common/CompilerDetermineC.cmake
new file mode 100644
index 0000000..0f6000f
--- /dev/null
+++ b/cmake/Common/CompilerDetermineC.cmake
@@ -0,0 +1,38 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Built in compiler identification does not work for embedded targets, so
+#override it here.
+
+#Stop built in CMakeDetermine<lang>.cmake scripts to run.
+set (CMAKE_C_COMPILER_ID_RUN 1)
+#Stop cmake run compiler tests.
+set (CMAKE_C_COMPILER_FORCED true)
+
+if(NOT DEFINED CMAKE_C_COMPILER)
+	message(FATAL_ERROR "Please set CMAKE_C_COMPILER to hold the full path of \
+your compiler executable")
+endif(NOT DEFINED CMAKE_C_COMPILER)
+
+get_filename_component(_C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME)
+
+#Based on the name of the compiler executable select which tool we use.
+if (_C_COMPILER_NAME MATCHES "^.*armclang(\\.exe)?$")
+	set(CMAKE_C_COMPILER_ID "ARMCLANG" CACHE INTERNAL "C compiler ID" FORCE)
+	set(ARM_TOOLCHAIN_FILE "Compiler/ARMClang-C")
+elseif (_C_COMPILER_NAME MATCHES "^.*gcc(\\.exe)?$")
+	set(CMAKE_C_COMPILER_ID "GNU" CACHE INTERNAL "C compiler ID" FORCE)
+	set(ARM_TOOLCHAIN_FILE "Compiler/GNU-C")
+elseif (_C_COMPILER_NAME MATCHES "^.*iccarm(\\.exe)?$")
+	set(CMAKE_C_COMPILER_ID "IAR" CACHE INTERNAL "C compiler ID" FORCE)
+	set(ARM_TOOLCHAIN_FILE "Compiler/IAR-C")
+else()
+	message(FATAL_ERROR "C Compiler executable ${_C_COMPILER_NAME} is unknown.\
+Please add needed settings to ${CMAKE_CURRENT_LIST_FILE}")
+endif ()
+
+include(${ARM_TOOLCHAIN_FILE})
diff --git a/cmake/Common/CompilerDetermineCXX.cmake b/cmake/Common/CompilerDetermineCXX.cmake
new file mode 100644
index 0000000..d6461c1
--- /dev/null
+++ b/cmake/Common/CompilerDetermineCXX.cmake
@@ -0,0 +1,38 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Built in compiler identification does not work for embedded targets, so
+#override it here.
+
+#Stop built in CMakeDetermine<lang>.cmake scripts to run.
+set (CMAKE_CXX_COMPILER_ID_RUN 1)
+#Stop cmake run compiler tests.
+set (CMAKE_CXX_COMPILER_FORCED true)
+
+if(NOT DEFINED CMAKE_CXX_COMPILER)
+	message(FATAL_ERROR "Please set CMAKE_CXX_COMPILER to hold the full path \
+of your compiler executable")
+endif(NOT DEFINED CMAKE_CXX_COMPILER)
+
+get_filename_component(_CXX_COMPILER_NAME ${CMAKE_CXX_COMPILER} NAME)
+
+if (_CXX_COMPILER_NAME MATCHES "^.*armclang(\\.exe)?$")
+	set(CMAKE_CXX_COMPILER_ID "ARMCLANG" CACHE INTERNAL "C++ compiler ID" FORCE)
+	set(ARM_TOOLCHAIN_FILE "Compiler/ARMClang-CXX")
+elseif (_CXX_COMPILER_NAME MATCHES "^.*gcc(\\.exe)?$")
+	set(CMAKE_CXX_COMPILER_ID "GNU" CACHE INTERNAL "C++ compiler ID" FORCE)
+	set(ARM_TOOLCHAIN_FILE "Compiler/GNU-CXX")
+elseif (_CXX_COMPILER_NAME MATCHES "^.*iccarm(\\.exe)?$")
+	set(CMAKE_CXX_COMPILER_ID "IAR" CACHE INTERNAL "C++ compiler ID" FORCE)
+	set(ARM_TOOLCHAIN_FILE "Compiler/IAR-CXX")
+else()
+	message(FATAL_ERROR "C++ Compiler executable ${_C_COMPILER_NAME} is \
+unknown. Please add needed settings to ${CMAKE_CURRENT_LIST_FILE}")
+endif ()
+
+include(${ARM_TOOLCHAIN_FILE})
+
diff --git a/cmake/Common/CpuM33.cmake b/cmake/Common/CpuM33.cmake
new file mode 100644
index 0000000..69bafe6
--- /dev/null
+++ b/cmake/Common/CpuM33.cmake
@@ -0,0 +1,11 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#This file gathers Cortex-M33 specific settings which control the build system.
+set(ARM_CPU_ARHITECTURE "ARM8-M-MAIN")
+
+set(ARM_CPU_TYPE "Cortex-M33")
diff --git a/cmake/Common/FindArmClang.cmake b/cmake/Common/FindArmClang.cmake
new file mode 100644
index 0000000..7e02f51
--- /dev/null
+++ b/cmake/Common/FindArmClang.cmake
@@ -0,0 +1,113 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+#Find the location of the ARMClang C/C++ compiler.
+#
+# Find armclang on the specified location or on the PATH and optionally validate its version.
+#
+#Inputs:
+#   ARMCLANG_PATH - (optional)- install path of armclang compiler to use. If not set the
+#								compiler on the PATH is used.
+#   ARMCLANG_VER  - (optional)- version number. If set the module will validate the compiler version.
+#
+#outputs:
+#   ARMCLANG_PATH   - will be set to the root directory of the compiler. Only set if undefined.
+#   ARMCLANG_VER    - will be set to the version number found. Only set if undefined.
+#   ARMCLANG_MODULE - set to the name of the cmake module to be included for this ARMClang version.
+#
+
+#Include some dependencies
+Include(Common/Utils)
+
+#Get the version of armasm.
+#
+# Execute armasm and extract its version number for its output.
+#
+#Exmaples:
+#  Get the version reported by armasm at location c:/foo/bin/armasm to variable VER
+#    get_armasm_version(ARMASM "c:/foo/bin/armasm" RES VER)
+#
+#INPUTS:
+#    ARMASM  - (mandatory) - armasm executable
+#    RES     - (mandatory) - variable name to put result to
+#
+#OUTPUTS
+#    The variable named after "RES" will be set to the version number matches
+#
+function(get_armasm_version)
+	#Parse our arguments
+	set( _OPTIONS_ARGS )			#No option (on/off) arguments (e.g. IGNORE_CASE)
+	set( _ONE_VALUE_ARGS ARMASM RES)	#Single option arguments (e.g. PATH "./foo/bar")
+	set( _MULTI_VALUE_ARGS )		#One list argument (e.g. LANGUAGES C ASM CXX)
+	cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+	#Check mandatory parameters
+	if(NOT _MY_PARAMS_RES)
+		message (FATAL_ERROR "get_armasm_version(): Missing result parameter!")
+	endif()
+	set (_RES ${_MY_PARAMS_RES})
+
+	if(NOT _MY_PARAMS_ARMASM)
+		message (FATAL_ERROR "get_armasm_version(): Missing ARMASM parameter!")
+	endif()
+	set (_ARMASM ${_MY_PARAMS_ARMASM})
+
+	#Call specified executable
+	execute_process(COMMAND "${_ARMASM}"
+					OUTPUT_VARIABLE _OUTPUT
+					ERROR_VARIABLE _OUTPUT
+					)
+	#Cut off version number. Just the numbers ignore anything after.
+	STRING(REGEX REPLACE ".*ARM Compiler (([0-9]+\.)+[0-9]+).*" "\\1" _VER "${_OUTPUT}")
+
+	if (NOT _VER)
+		message (FATAL_ERROR "get_armasm_version(): Failed to extract version number from armasm output.")
+	endif()
+
+    set(${_RES} ${_VER} PARENT_SCOPE)
+endfunction()
+
+#If the install location needs to be found.
+if(NOT DEFINED ARMCLANG_PATH)
+	#Set ARMCLANG_PATH to default value.
+	set (ARMCLANG_PATH "ARMCLANG_PATH-NOTFOUND")
+
+	#First check if armclang is on the PATH
+	#find_program puts() its output to the cmake cache. We don't want that, so we use a local variable, which
+	#is unset later.
+	find_program (
+	  _ARMCLANG_PATH
+	  armclang
+	  PATHS env PATH
+	  DOC "ARMCLANG compiler location."
+	)
+
+	#Yes, check the version number if it is specified.
+	if(_ARMCLANG_PATH STREQUAL "_ARMCLANG_PATH-NOTFOUND")
+		message (FATAL_ERROR "armclang install location is unset. Either put armclang on the PATH or set ARMCLANG_PATH.")
+	endif()
+
+	#Cut off executable name directory name to get install location.
+	STRING(REGEX REPLACE "(.*)/bin/armclang.*" "\\1" ARMCLANG_PATH "${_ARMCLANG_PATH}")
+
+	#Remove unwanted junk from CMake cache.
+	unset(_ARMCLANG_PATH CACHE)
+endif()
+
+get_armasm_version(ARMASM "${ARMCLANG_PATH}/bin/armasm" RES _VER)
+
+#Check the version if needed
+if(NOT DEFINED ARMCLANG_VER)
+	set(ARMCLANG_VER ${_VER})
+endif()
+
+if(NOT "${ARMCLANG_VER}" VERSION_EQUAL "${_VER}")
+	message (FATAL_ERROR "FindArmClang.cmake: armclang compiler version ${_VER} does not match ${ARMCLANG_VER}.")
+endif()
+
+STRING(REGEX REPLACE "([0-9]+)\.([0-9]+)(\.[0-9]+)*.*" "CompilerArmClang\\1\\2" ARMCLANG_MODULE "${ARMCLANG_VER}")
+
diff --git a/cmake/Common/Utils.cmake b/cmake/Common/Utils.cmake
new file mode 100644
index 0000000..0c3b0d0
--- /dev/null
+++ b/cmake/Common/Utils.cmake
@@ -0,0 +1,52 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2017, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+# Append a value to a string if not already present
+#
+# Append an item to a string if no item with matching key is already on the string.
+# This function's intended purpose is to append unique flags to command line switches.
+#
+# Examples:
+#  string_append_unique_item(STRING C_FLAGS KEY "--target" VAL "--target=armv8m-arm-none-eabi")
+#
+# INPUTS:
+#    STRING  - (mandatory) - name of the string to operate on
+#    KEY   - (mandatory) - string to look for
+#    VAL   - (mandatory) - value to put be added to the string
+#
+# OUTPUTS
+#    STRING is modified as needed.
+#
+function(string_append_unique_item)
+	#Parse our arguments
+	set( _OPTIONS_ARGS )					#No option (on/off) arguments (e.g. IGNORE_CASE)
+	set( _ONE_VALUE_ARGS  STRING KEY VAL)	#Single option arguments (e.g. PATH "./foo/bar")
+	set( _MULTI_VALUE_ARGS )		 		#List arguments (e.g. LANGUAGES C ASM CXX)
+	cmake_parse_arguments(_MY_PARAMS "${_OPTIONS_ARGS}" "${_ONE_VALUE_ARGS}" "${_MULTI_VALUE_ARGS}" ${ARGN} )
+
+	#Check mandatory parameters
+	if(NOT _MY_PARAMS_STRING)
+		failure("string_append_unique_item(): Missing STRING parameter!")
+	endif()
+	set(_STRING ${_MY_PARAMS_STRING})
+
+	if(NOT _MY_PARAMS_KEY)
+		failure("string_append_unique_item(): Missing KEY parameter!")
+	endif()
+	set(_KEY ${_MY_PARAMS_KEY})
+
+	if(NOT _MY_PARAMS_VAL)
+		failure("string_append_unique_item(): Missing VAL parameter!")
+	endif()
+    set(_VAL ${_MY_PARAMS_VAL})
+
+    #Scan the string.
+    STRING(REGEX MATCH "( |^) *${_KEY}" _FOUND "${${_STRING}}")
+    if("${_FOUND}" STREQUAL "")
+		set(${_STRING} "${${_STRING}}  ${_VAL}" PARENT_SCOPE)
+    endif()
+endfunction()