1# Copyright (c) 2021 Nordic Semiconductor ASA
2#
3# SPDX-License-Identifier: Apache-2.0
4#
5# This file is the INHERIT equivalent to
6# https://github.com/ARM-software/psa-arch-tests/blob/master/api-tests/tools/cmake/compiler/GNUARM.cmake
7#
8# The INHERIT concept was introduced in
9# https://github.com/ARM-software/psa-arch-tests/pull/276
10
11if(${CPU_ARCH} STREQUAL armv7m)
12  set(TARGET_SWITCH "-march=armv7-m")
13elseif(${CPU_ARCH} STREQUAL armv8m_ml)
14  set(TARGET_SWITCH "-march=armv8-m.main -mcmse")
15elseif(${CPU_ARCH} STREQUAL armv8m_bl)
16  set(TARGET_SWITCH "-march=armv8-m.base -mcmse")
17endif()
18
19set(CMAKE_C_FLAGS   "${TARGET_SWITCH} -g -Wall -Werror -Wextra -fdata-sections -ffunction-sections -mno-unaligned-access")
20set(CMAKE_ASM_FLAGS "${TARGET_SWITCH} -mthumb")
21set(CMAKE_EXE_LINKER_FLAGS "-Xlinker --fatal-warnings -Xlinker --gc-sections -z max-page-size=0x400 -lgcc -lc -lnosys")
22