• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 ASR Microelectronics (Shanghai) Co., Ltd. All rights reserved.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  ****************************************************************************************
18  *
19  * @file gnuarm/compiler.h
20  *
21  * @brief Definitions of compiler specific directives.
22  *
23  ****************************************************************************************
24  */
25 
26 #ifndef _COMPILER_H_
27 #define _COMPILER_H_
28 
29 #ifndef __GNUC__
30 #error "File only included with ARM GCC"
31 #endif // __GNUC__
32 
33 /// define the static keyword for this compiler
34 #define __STATIC static
35 
36 /// define the force inlining attribute for this compiler
37 #define __INLINE static __attribute__((__always_inline__)) inline
38 
39 /// define the IRQ handler attribute for this compiler
40 #define __IRQ __attribute__((__interrupt__("IRQ")))
41 
42 /// define the BLE IRQ handler attribute for this compiler
43 #define __BTIRQ
44 
45 /// define the BLE IRQ handler attribute for this compiler
46 #define __BLEIRQ
47 
48 /// define the FIQ handler attribute for this compiler
49 #define __FIQ __attribute__((__interrupt__("FIQ")))
50 
51 /// define size of an empty array (used to declare structure with an array size not defined)
52 #define __ARRAY_EMPTY
53 
54 /// Function returns struct in registers (4 in rvds, var with gnuarm).
55 /// With Gnuarm, feature depends on command line options and
56 /// impacts ALL functions returning 2-words max structs
57 /// (check -freg-struct-return and -mabi=xxx)
58 #define __VIR
59 
60 /// function has no side effect and return depends only on arguments
61 #define __PURE __attribute__((const))
62 
63 /// Align instantiated lvalue or struct member on 4 bytes
64 #define __ALIGN4 __attribute__((aligned(4)))
65 
66 /// __MODULE__ comes from the RVDS compiler that supports it
67 #define __MODULE__ __BASE_FILE__
68 
69 /// Pack a structure field
70 #define __PACKED __attribute__ ((__packed__))
71 
72 /// Put a variable in a memory maintained during deep sleep
73 #define __LOWPOWER_SAVED
74 
75 #endif // _COMPILER_H_
76