Zephyr API 3.6.99
Loading...
Searching...
No Matches
mwdt.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Synopsys.
3 * Author: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
4 *
5 * SPDX-License-Identifier: Apache-2.0
6 */
7
8#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_MWDT_H_
9#define ZEPHYR_INCLUDE_TOOLCHAIN_MWDT_H_
10
11#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_H_
12#error Please do not include toolchain-specific headers directly, use <zephyr/toolchain.h> instead
13#endif
14
15#ifndef _LINKER
16#if defined(_ASMLANGUAGE)
17
19
20#define FUNC_CODE()
21#define FUNC_INSTR(a)
22
23#ifdef __MW_ASM_RV_MACRO__
24.macro section_var_mwdt, section, symbol
25 .section \section().\symbol, "aw"
26 \symbol :
27.endm
28
29.macro section_func_mwdt, section, symbol
30 .section \section().\symbol, "ax"
31 FUNC_CODE()
32 PERFOPT_ALIGN
33 \symbol :
34 FUNC_INSTR(symbol)
35.endm
36
37.macro section_subsec_func_mwdt, section, subsection, symbol
38 .section \section().\subsection, "ax"
39 PERFOPT_ALIGN
40 \symbol :
41.endm
42#else
43.macro section_var_mwdt, section, symbol
44 .section .\&section\&.\&symbol, "aw"
45 symbol :
46.endm
47
48.macro section_func_mwdt, section, symbol
49 .section .\&section\&.\&symbol, "ax"
50 FUNC_CODE()
51 PERFOPT_ALIGN
52 symbol :
53 FUNC_INSTR(symbol)
54.endm
55
56.macro section_subsec_func_mwdt, section, subsection, symbol
57 .section .\&section\&.\&subsection, "ax"
58 PERFOPT_ALIGN
59 symbol :
60.endm
61#endif /* __MW_ASM_RV_MACRO__ */
62
63#define SECTION_VAR(sect, sym) section_var_mwdt sect, sym
64#define SECTION_FUNC(sect, sym) section_func_mwdt sect, sym
65#define SECTION_SUBSEC_FUNC(sect, subsec, sym) \
66 section_subsec_func_mwdt sect, subsec, sym
67
68#ifdef __MW_ASM_RV_MACRO__
69.macro glbl_text_mwdt, symbol
70 .globl \symbol
71 .type \symbol, @function
72.endm
73
74.macro glbl_data_mwdt, symbol
75 .globl \symbol
76 .type \symbol, @object
77.endm
78
79.macro weak_data_mwdt, symbol
80 .weak \symbol
81 .type \symbol, @object
82.endm
83
84.macro weak_text_mwdt, symbol
85 .weak \symbol
86 .type \symbol, @function
87.endm
88#else
89.macro glbl_text_mwdt, symbol
90 .globl symbol
91 .type symbol, @function
92.endm
93
94.macro glbl_data_mwdt, symbol
95 .globl symbol
96 .type symbol, @object
97.endm
98
99.macro weak_data_mwdt, symbol
100 .weak symbol
101 .type symbol, @object
102.endm
103
104.macro weak_text_mwdt, symbol
105 .weak symbol
106 .type symbol, @function
107.endm
108#endif /* __MW_ASM_RV_MACRO__ */
109
110#define GTEXT(sym) glbl_text_mwdt sym
111#define GDATA(sym) glbl_data_mwdt sym
112#define WDATA(sym) weak_data_mwdt sym
113#define WTEXT(sym) weak_text_mwdt sym
114
115#else /* defined(_ASMLANGUAGE) */
116
117/* MWDT toolchain misses ssize_t definition which is used by Zephyr */
118#ifndef _SSIZE_T_DEFINED
119#define _SSIZE_T_DEFINED
120#ifdef CONFIG_64BIT
121 typedef long ssize_t;
122#else
123 typedef int ssize_t;
124#endif
125#endif /* _SSIZE_T_DEFINED */
126
127#ifdef CONFIG_NEWLIB_LIBC
128 #error "ARC MWDT doesn't support building with CONFIG_NEWLIB_LIBC as it doesn't have newlib"
129#endif /* CONFIG_NEWLIB_LIBC */
130
131#ifdef CONFIG_NATIVE_APPLICATION
132 #error "ARC MWDT doesn't support building Zephyr as an native application"
133#endif /* CONFIG_NATIVE_APPLICATION */
134
135
136#define __no_optimization __attribute__((optnone))
137#define __fallthrough __attribute__((fallthrough))
138
139#define TOOLCHAIN_HAS_C_GENERIC 1
140#define TOOLCHAIN_HAS_C_AUTO_TYPE 1
141
142#include <zephyr/toolchain/gcc.h>
143
144#undef BUILD_ASSERT
145#if defined(__cplusplus) && (__cplusplus >= 201103L)
146#define BUILD_ASSERT(EXPR, MSG...) static_assert(EXPR, "" MSG)
147#elif defined(__cplusplus)
148/* For cpp98 */
149#define BUILD_ASSERT(EXPR, MSG...)
150#else
151#define BUILD_ASSERT(EXPR, MSG...) _Static_assert((EXPR), "" MSG)
152#endif
153
154#define __builtin_arc_nop() _nop()
155
156#endif /* _ASMLANGUAGE */
157
158#endif /* !_LINKER */
159#endif /* ZEPHYR_INCLUDE_TOOLCHAIN_MWDT_H_ */
Common toolchain abstraction.
GCC toolchain abstraction.
__SIZE_TYPE__ ssize_t
Definition types.h:28