forked from zephyrproject-rtos/zephyr
/
mwdt.h
79 lines (61 loc) · 1.78 KB
/
mwdt.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
* Copyright (c) 2020 Synopsys.
* Author: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_INCLUDE_TOOLCHAIN_MWDT_H_
#define ZEPHYR_INCLUDE_TOOLCHAIN_MWDT_H_
#ifndef _LINKER
#if defined(_ASMLANGUAGE)
#include <toolchain/common.h>
#define FUNC_CODE()
#define FUNC_INSTR(a)
.macro section_var_mwdt, section, symbol
.section .\§ion\&.\&symbol, "aw"
symbol :
.endm
.macro section_func_mwdt, section, symbol
.section .\§ion\&.\&symbol, "ax"
FUNC_CODE()
PERFOPT_ALIGN
symbol :
FUNC_INSTR(symbol)
.endm
.macro section_subsec_func_mwdt, section, subsection, symbol
.section .\§ion\&.\&subsection, "ax"
PERFOPT_ALIGN
symbol :
.endm
#define SECTION_VAR(sect, sym) section_var_mwdt sect, sym
#define SECTION_FUNC(sect, sym) section_func_mwdt sect, sym
#define SECTION_SUBSEC_FUNC(sect, subsec, sym) \
section_subsec_func_mwdt sect, subsec, sym
.macro glbl_text_mwdt, symbol
.globl symbol
.type symbol, @function
.endm
.macro glbl_data_mwdt, symbol
.globl symbol
.type symbol, @object
.endm
.macro weak_data_mwdt, symbol
.weak symbol
.type symbol, @object
.endm
#define GTEXT(sym) glbl_text_mwdt sym
#define GDATA(sym) glbl_data_mwdt sym
#define WDATA(sym) weak_data_mwdt sym
#else /* defined(_ASMLANGUAGE) */
#include <toolchain/gcc.h>
/* Metaware toolchain has _Static_assert. However it not able to calculate
* conditional expression in build time for some realy complex cases. ARC GNU
* toolchain works fine in this cases, so it looks like MWDT bug. So, disable
* BUILD_ASSERT macro until we fix that issue in MWDT toolchain.
*/
#undef BUILD_ASSERT
#define BUILD_ASSERT(EXPR, MSG...)
#define __builtin_arc_nop() _nop()
#endif /* _ASMLANGUAGE */
#endif /* !_LINKER */
#endif /* ZEPHYR_INCLUDE_TOOLCHAIN_MWDT_H_ */