zephyr: include: sof: Add Zephyr version of compiler_info.h

This is required by ARM64 platforms as they don't have
an arch/compiler_info.h so the compilation would fail.

Signed-off-by: Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
This commit is contained in:
Laurentiu Mihalcea 2023-04-10 13:13:56 +03:00 committed by Kai Vehmanen
parent 6339cfd5aa
commit db3c469ee7
1 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,37 @@
/* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright 2023 NXP
*/
#ifndef __SOF_COMPILER_INFO_H__
#define __SOF_COMPILER_INFO_H__
#if defined(__XCC__)
#include <xtensa/hal.h>
#define CC_MAJOR (XTHAL_RELEASE_MAJOR / 1000)
#define CC_MINOR ((XTHAL_RELEASE_MAJOR % 1000) / 10)
#define CC_MICRO XTHAL_RELEASE_MINOR
#define CC_NAME "XCC"
#define CC_DESC " " XCC_TOOLS_VERSION
#elif defined(__GNUC__)
#define CC_MAJOR __GNUC__
#define CC_MINOR __GNUC_MINOR__
#define CC_MICRO __GNUC_PATCHLEVEL__
#define CC_NAME "GCC"
#define CC_DESC ""
#if CC_MAJOR >= 10
#define CC_USE_LIBC
#endif
#else
#error "Unsupported toolchain."
#endif
#endif /* __SOF_COMPILER_INFO_H__ */