2017-05-10 22:28:38 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2017 Intel Corporation
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
2018-09-14 19:43:44 +02:00
|
|
|
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_XCC_H_
|
|
|
|
#define ZEPHYR_INCLUDE_TOOLCHAIN_XCC_H_
|
2017-05-10 22:28:38 +02:00
|
|
|
|
2019-11-25 21:14:41 +01:00
|
|
|
/* toolchain/gcc.h errors out if __BYTE_ORDER__ cannot be determined
|
|
|
|
* there. However, __BYTE_ORDER__ is actually being defined later in
|
|
|
|
* this file. So define __BYTE_ORDER__ to skip the check in gcc.h
|
|
|
|
* and undefine after including gcc.h.
|
2019-12-17 02:26:54 +01:00
|
|
|
*
|
|
|
|
* Clang has it defined so there is no need to work around.
|
2019-11-25 21:14:41 +01:00
|
|
|
*/
|
2019-12-17 02:26:54 +01:00
|
|
|
#ifndef __clang__
|
2019-11-25 21:14:41 +01:00
|
|
|
#define __BYTE_ORDER__
|
2019-12-17 02:26:54 +01:00
|
|
|
#endif
|
|
|
|
|
2017-05-10 22:28:38 +02:00
|
|
|
#include <toolchain/gcc.h>
|
2019-12-17 02:26:54 +01:00
|
|
|
|
|
|
|
#ifndef __clang__
|
2019-11-25 21:14:41 +01:00
|
|
|
#undef __BYTE_ORDER__
|
2019-12-17 02:26:54 +01:00
|
|
|
#endif
|
2019-11-25 21:14:41 +01:00
|
|
|
|
2018-11-22 01:12:49 +01:00
|
|
|
#include <stdbool.h>
|
2017-05-10 22:28:38 +02:00
|
|
|
|
2019-12-16 18:35:03 +01:00
|
|
|
#ifndef UINT32_C
|
|
|
|
#define UINT32_C(x) x ## U
|
|
|
|
#endif
|
|
|
|
|
2019-12-17 02:26:54 +01:00
|
|
|
#ifndef __COUNTER__
|
|
|
|
/* XCC (GCC-based compiler) doesn't support __COUNTER__
|
|
|
|
* but this should be good enough
|
|
|
|
*/
|
2017-08-14 22:26:23 +02:00
|
|
|
#define __COUNTER__ __LINE__
|
2019-12-17 02:26:54 +01:00
|
|
|
#endif
|
2017-08-14 22:26:23 +02:00
|
|
|
|
|
|
|
#undef __in_section_unique
|
|
|
|
#define __in_section_unique(seg) \
|
|
|
|
__attribute__((section("." STRINGIFY(seg) "." STRINGIFY(__COUNTER__))))
|
|
|
|
|
2017-05-10 22:28:38 +02:00
|
|
|
#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.
|
|
|
|
*/
|
2019-11-25 21:14:41 +01:00
|
|
|
#if XCHAL_MEMORY_ORDER == XTHAL_BIGENDIAN
|
|
|
|
#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
|
|
|
|
#elif XCHAL_MEMORY_ORDER == XTHAL_LITTLEENDIAN
|
|
|
|
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
|
|
|
|
#else
|
|
|
|
#error "Cannot determine __BYTE_ORDER__"
|
2017-05-10 22:28:38 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* __GCC_LINKER_CMD__ */
|
|
|
|
|
2018-11-22 01:12:49 +01:00
|
|
|
#define __builtin_unreachable() do { __ASSERT(false, "Unreachable code"); } \
|
2018-11-01 21:27:03 +01:00
|
|
|
while (true)
|
2017-12-12 18:59:37 +01:00
|
|
|
|
2017-05-10 22:28:38 +02:00
|
|
|
#endif
|