Zephyr Project API
4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
xcc.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2017 Intel Corporation
3
*
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_XCC_H_
8
#define ZEPHYR_INCLUDE_TOOLCHAIN_XCC_H_
9
10
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
11
#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
12
#endif
13
14
/*
15
* XCC does not support using deprecated attribute in enum,
16
* so just nullify it here to avoid compilation errors.
17
*/
18
#ifndef __deprecated
19
#define __deprecated
20
#endif
21
22
#define __in_section_unique(seg) \
23
__attribute__((section("." STRINGIFY(seg) "." STRINGIFY(__COUNTER__))))
24
25
#define __in_section_unique_named(seg, name) \
26
__attribute__((section("." STRINGIFY(seg) \
27
"." STRINGIFY(__COUNTER__) \
28
"." STRINGIFY(name))))
29
30
/* toolchain/gcc.h errors out if __BYTE_ORDER__ cannot be determined
31
* there. However, __BYTE_ORDER__ is actually being defined later in
32
* this file. So define __BYTE_ORDER__ to skip the check in gcc.h
33
* and undefine after including gcc.h.
34
*
35
* Clang has it defined so there is no need to work around.
36
*/
37
#ifndef __clang__
38
#define __BYTE_ORDER__
39
#endif
40
41
#ifdef __clang__
42
#include <
zephyr/toolchain/llvm.h
>
43
#else
44
#include <
zephyr/toolchain/gcc.h
>
45
#endif
46
47
#ifdef __clang__
48
/* For some reasons, xt-clang does not like "%hhd" or "%hd" (for example)
49
* being fed int data (same goes for unsigned ones) and will always complain
50
* about mismatched types. GCC and newer LLVM/Clang do not complain.
51
* This could be due to xt-clang being based on older LLVM/Clang.
52
* So skip the check.
53
*/
54
#ifdef __printf_like
55
#undef __printf_like
56
#define __printf_like(f, a)
57
#endif
58
#endif
59
60
#ifndef __clang__
61
#undef __BYTE_ORDER__
62
#endif
63
64
#include <
stdbool.h
>
65
66
#ifndef __INT8_C
67
#define __INT8_C(x) x
68
#endif
69
70
#ifndef INT8_C
71
#define INT8_C(x) __INT8_C(x)
72
#endif
73
74
#ifndef __UINT8_C
75
#define __UINT8_C(x) x ## U
76
#endif
77
78
#ifndef UINT8_C
79
#define UINT8_C(x) __UINT8_C(x)
80
#endif
81
82
#ifndef __INT16_C
83
#define __INT16_C(x) x
84
#endif
85
86
#ifndef INT16_C
87
#define INT16_C(x) __INT16_C(x)
88
#endif
89
90
#ifndef __UINT16_C
91
#define __UINT16_C(x) x ## U
92
#endif
93
94
#ifndef UINT16_C
95
#define UINT16_C(x) __UINT16_C(x)
96
#endif
97
98
#ifndef __INT32_C
99
#define __INT32_C(x) x
100
#endif
101
102
#ifndef INT32_C
103
#define INT32_C(x) __INT32_C(x)
104
#endif
105
106
#ifndef __UINT32_C
107
#define __UINT32_C(x) x ## U
108
#endif
109
110
#ifndef UINT32_C
111
#define UINT32_C(x) __UINT32_C(x)
112
#endif
113
114
#ifndef __INT64_C
115
#define __INT64_C(x) x
116
#endif
117
118
#ifndef INT64_C
119
#define INT64_C(x) __INT64_C(x)
120
#endif
121
122
#ifndef __UINT64_C
123
#define __UINT64_C(x) x ## ULL
124
#endif
125
126
#ifndef UINT64_C
127
#define UINT64_C(x) __UINT64_C(x)
128
#endif
129
130
#ifndef __INTMAX_C
131
#define __INTMAX_C(x) x
132
#endif
133
134
#ifndef INTMAX_C
135
#define INTMAX_C(x) __INTMAX_C(x)
136
#endif
137
138
#ifndef __UINTMAX_C
139
#define __UINTMAX_C(x) x ## ULL
140
#endif
141
142
#ifndef UINTMAX_C
143
#define UINTMAX_C(x) __UINTMAX_C(x)
144
#endif
145
146
#ifndef __COUNTER__
147
/* XCC (GCC-based compiler) doesn't support __COUNTER__
148
* but this should be good enough
149
*/
150
#define __COUNTER__ __LINE__
151
#endif
152
153
#ifndef __GCC_LINKER_CMD__
154
#include <xtensa/config/core.h>
155
156
/*
157
* XCC does not define the following macros with the expected names, but the
158
* HAL defines similar ones. Thus we include it and define the missing macros
159
* ourselves.
160
*/
161
#if XCHAL_MEMORY_ORDER == XTHAL_BIGENDIAN
162
#define __BYTE_ORDER__ __ORDER_BIG_ENDIAN__
163
#elif XCHAL_MEMORY_ORDER == XTHAL_LITTLEENDIAN
164
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
165
#else
166
#error "Cannot determine __BYTE_ORDER__"
167
#endif
168
169
#endif
/* __GCC_LINKER_CMD__ */
170
171
#define __builtin_unreachable() __builtin_trap()
172
173
/* Not a full barrier, just a SW barrier */
174
#define __sync_synchronize() do { __asm__ __volatile__ ("" ::: "memory"); } \
175
while (false)
176
177
#endif
gcc.h
GCC toolchain abstraction.
llvm.h
stdbool.h
include
zephyr
toolchain
xcc.h
Generated on Fri Jun 20 2025 13:59:10 for Zephyr Project API by
1.9.8