Zephyr API Documentation  2.7.0-rc2
A Scalable Open Source RTOS
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 _LINKER
12#if defined(_ASMLANGUAGE)
13
14#include <toolchain/common.h>
15
16#define FUNC_CODE()
17#define FUNC_INSTR(a)
18
19.macro section_var_mwdt, section, symbol
20 .section .\&section\&.\&symbol, "aw"
21 symbol :
22.endm
23
24.macro section_func_mwdt, section, symbol
25 .section .\&section\&.\&symbol, "ax"
26 FUNC_CODE()
27 PERFOPT_ALIGN
28 symbol :
29 FUNC_INSTR(symbol)
30.endm
31
32.macro section_subsec_func_mwdt, section, subsection, symbol
33 .section .\&section\&.\&subsection, "ax"
34 PERFOPT_ALIGN
35 symbol :
36.endm
37
38#define SECTION_VAR(sect, sym) section_var_mwdt sect, sym
39#define SECTION_FUNC(sect, sym) section_func_mwdt sect, sym
40#define SECTION_SUBSEC_FUNC(sect, subsec, sym) \
41 section_subsec_func_mwdt sect, subsec, sym
42
43.macro glbl_text_mwdt, symbol
44 .globl symbol
45 .type symbol, @function
46.endm
47
48.macro glbl_data_mwdt, symbol
49 .globl symbol
50 .type symbol, @object
51.endm
52
53.macro weak_data_mwdt, symbol
54 .weak symbol
55 .type symbol, @object
56.endm
57
58#define GTEXT(sym) glbl_text_mwdt sym
59#define GDATA(sym) glbl_data_mwdt sym
60#define WDATA(sym) weak_data_mwdt sym
61
62#else /* defined(_ASMLANGUAGE) */
63
64/* MWDT toolchain misses ssize_t definition which is used by Zephyr */
65#ifndef _SSIZE_T_DEFINED
66#define _SSIZE_T_DEFINED
67#ifdef CONFIG_64BIT
68 typedef long ssize_t;
69#else
70 typedef int ssize_t;
71#endif
72#endif /* _SSIZE_T_DEFINED */
73
74#ifdef CONFIG_NEWLIB_LIBC
75 #error "ARC MWDT doesn't support building with CONFIG_NEWLIB_LIBC as it doesn't have newlib"
76#endif /* CONFIG_NEWLIB_LIBC */
77
78#ifdef CONFIG_NATIVE_APPLICATION
79 #error "ARC MWDT doesn't support building Zephyr as an native application"
80#endif /* CONFIG_NATIVE_APPLICATION */
81
82
83#define __no_optimization __attribute__((optnone))
84
85#include <toolchain/gcc.h>
86
87/* Metaware toolchain has _Static_assert. However it not able to calculate
88 * conditional expression in build time for some realy complex cases. ARC GNU
89 * toolchain works fine in this cases, so it looks like MWDT bug. So, disable
90 * BUILD_ASSERT macro until we fix that issue in MWDT toolchain.
91 */
92#undef BUILD_ASSERT
93#define BUILD_ASSERT(EXPR, MSG...)
94
95#define __builtin_arc_nop() _nop()
96
97#endif /* _ASMLANGUAGE */
98
99#endif /* !_LINKER */
100#endif /* ZEPHYR_INCLUDE_TOOLCHAIN_MWDT_H_ */
Common toolchain abstraction.
GCC toolchain abstraction.
__SIZE_TYPE__ ssize_t
Definition: types.h:28