zephyr/include/toolchain/xcc.h
Rajavardhan Gundi 08172cdf83 xtensa: provide XCC compiler support for Xtensa
This patchset provides Xtensa's xcc compiler support for Xtensa
projects in Cmake. This requires the below environment variables
to be defined aptly. The appropriate xcc license information also
need to be supplied.

ZEPHYR_GCC_VARIANT=xcc
TOOLCHAIN_VER=RF-2015.3-linux
XTENSA_CORE=cavs21_LX6HiFi3_RF3_WB16
XTENSA_SYSTEM=/opt/xtensa/XtDevTools/install/tools/
		RF-2015.3-linux/XtensaTools/config/
XTENSA_BUILD_PATHS=/opt/xtensa/XtDevTools/install/builds/

Change-Id: Ib3c10e8095439b0e32276ff37c00eca8420773ec
Signed-off-by: Rajavardhan Gundi <rajavardhan.gundi@intel.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2018-05-01 16:46:41 -04:00

48 lines
1.2 KiB
C

/*
* Copyright (c) 2017 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef _XCC_TOOLCHAIN_H_
#define _XCC_TOOLCHAIN_H_
#include <toolchain/gcc.h>
/* XCC doesn't support __COUNTER__ but this should be good enough */
#define __COUNTER__ __LINE__
#undef __in_section_unique
#define __in_section_unique(seg) \
__attribute__((section("." STRINGIFY(seg) "." STRINGIFY(__COUNTER__))))
#ifndef __GCC_LINKER_CMD__
#include <xtensa/config/core.h>
/*
* XCC does not define the following macros with the expected names, but the
* HAL defines similar ones. Thus we include it and define the missing macros
* ourselves.
*/
#ifndef __BYTE_ORDER__
#define __BYTE_ORDER__ XCHAL_MEMORY_ORDER
#endif
#ifndef __ORDER_BIG_ENDIAN__
#define __ORDER_BIG_ENDIAN__ XTHAL_BIGENDIAN
#endif
#ifndef __ORDER_LITTLE_ENDIAN__
#define __ORDER_LITTLE_ENDIAN__ XTHAL_LITTLEENDIAN
#endif
#endif /* __GCC_LINKER_CMD__ */
#define __builtin_unreachable() __ASSERT(0, "Unreachable code")
/* TODO: XCC doesn't define the below macros which are useful for checking
* overflows. This needs to be fixed.
*/
#define __builtin_add_overflow(a, b, output) ({ *output = (a) + (b); 0; })
#define __builtin_mul_overflow(a, b, output) ({ *output = (a) * (b); 0; })
#endif