From a2b324035c74635d0ca223902d6bb8acf432396c Mon Sep 17 00:00:00 2001 From: Andrew Boie Date: Wed, 10 May 2017 13:28:38 -0700 Subject: [PATCH] xtensa: move byte-order macros out of arch.h These are macros that are expected to be defined at all times by the compiler. We need them at the very beginning of kernel.h for the k_thread definition, before it's possible to include arch.h. Make a special toolchain header for XCC compiler and place these defines in there. Otherwise inherit all the other GCC defines. Signed-off-by: Andrew Boie --- include/arch/xtensa/arch.h | 15 --------------- include/toolchain.h | 4 +++- include/toolchain/xcc.h | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 include/toolchain/xcc.h diff --git a/include/arch/xtensa/arch.h b/include/arch/xtensa/arch.h index db0e9d0f00b..42fac77d635 100644 --- a/include/arch/xtensa/arch.h +++ b/include/arch/xtensa/arch.h @@ -26,21 +26,6 @@ extern "C" { #include #include -/* - * XCC does not define the following macros with the expected names, but the - * file machine/endian.h from XT_LIB 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 - #define STACK_ALIGN 16 #define OCTET_TO_SIZEOFUNIT(X) (X) #define SIZEOFUNIT_TO_OCTET(X) (X) diff --git a/include/toolchain.h b/include/toolchain.h index 11c90024b2a..3bea0dbc29e 100644 --- a/include/toolchain.h +++ b/include/toolchain.h @@ -15,7 +15,9 @@ #ifndef _TOOLCHAIN_H #define _TOOLCHAIN_H -#if defined(__GNUC__) || (defined(_LINKER) && defined(__GCC_LINKER_CMD__)) +#if defined(__XCC__) +#include +#elif defined(__GNUC__) || (defined(_LINKER) && defined(__GCC_LINKER_CMD__)) #include #else #include diff --git a/include/toolchain/xcc.h b/include/toolchain/xcc.h new file mode 100644 index 00000000000..7dfbb0ec083 --- /dev/null +++ b/include/toolchain/xcc.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2017 Intel Corporation + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef _XCC_TOOLCHAIN_H_ +#define _XCC_TOOLCHAIN_H_ + +#include + +#ifndef __GCC_LINKER_CMD__ +#include + +/* + * 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__ */ + +#endif