iLLD_TC29x  1.0
CompilerGnuc.h
Go to the documentation of this file.
1 /**
2  * \file CompilerGnuc.h
3  *
4  * \version iLLD_1_0_0_11_0
5  * \copyright Copyright (c) 2013 Infineon Technologies AG. All rights reserved.
6  *
7  *
8  * IMPORTANT NOTICE
9  *
10  *
11  * Infineon Technologies AG (Infineon) is supplying this file for use
12  * exclusively with Infineon's microcontroller products. This file can be freely
13  * distributed within development tools that are supporting such microcontroller
14  * products.
15  *
16  * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
17  * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
19  * INFINEON SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
20  * OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
21  *
22  */
23 
24 #ifndef COMPILERGNUC_H
25 #define COMPILERGNUC_H 1
26 
27 /******************************************************************************/
28 
29 #include <stddef.h>
30 
31 /*Linker definitions which are specific to Gnuc */
32 /* IFX_CFG_USE_COMPILER_DEFAULT_LINKER shall be defined in Ifx_Cfg.h
33  * to use the default compiler linker varaibles and startup */
34 #ifndef IFX_CFG_USE_COMPILER_DEFAULT_LINKER
35 
36 /*Start: Common definitions ********************************************** */
37 #define IFXCOMPILER_COMMON_LINKER_SYMBOLS() \
38  extern unsigned int __A0_MEM[]; /**< center of A0 addressable area */ \
39  extern unsigned int __A1_MEM[]; /**< center of A1 addressable area */ \
40  extern unsigned int __A8_MEM[]; /**< center of A8 addressable area */ \
41  extern unsigned int __A9_MEM[]; /**< center of A9 addressable area */
42 
43 /*End: Common definitions ************************************************ */
44 
45 /*Start: Core 0 definitions ********************************************** */
46 
47 /*C extern defintions */
48 #define IFXCOMPILER_CORE_LINKER_SYMBOLS(cpu) \
49  extern unsigned int __USTACK##cpu[]; /**< user stack end */ \
50  extern unsigned int __ISTACK##cpu[]; /**< interrupt stack end */ \
51  extern unsigned int __INTTAB_CPU##cpu[]; /**< Interrupt vector table */ \
52  extern unsigned int __TRAPTAB_CPU##cpu[]; /**< trap table */ \
53  extern unsigned int __CSA##cpu[]; /**< context save area 1 begin */ \
54  extern unsigned int __CSA##cpu##_END[]; /**< context save area 1 begin */
55 
56 #define __USTACK(cpu) __USTACK##cpu
57 #define __ISTACK(cpu) __ISTACK##cpu
58 #define __INTTAB_CPU(cpu) __INTTAB_CPU##cpu
59 #define __TRAPTAB_CPU(cpu) __TRAPTAB_CPU##cpu
60 #define __CSA(cpu) __CSA##cpu
61 #define __CSA_END(cpu) __CSA##cpu##_END
62 
63 /*Wrapper macros for the tool specific definitions */
64 #if defined(IFX_USE_SW_MANAGED_INT)
65 #define __INTTAB(cpu) ((unsigned int)__INTTAB_CPU##cpu | (unsigned int)0x1FE0)
66 #else
67 #define __INTTAB(cpu) __INTTAB_CPU##cpu
68 #endif /*defined(IFX_USE_SW_MANAGED_INT) */
69 
70 #define __TRAPTAB(cpu) __TRAPTAB_CPU##cpu
71 
72 #define __SDATA1(cpu) __A0_MEM
73 #define __SDATA2(cpu) __A1_MEM
74 #define __SDATA3(cpu) __A8_MEM
75 #define __SDATA4(cpu) __A9_MEM
76 
77 #endif /*IFX_CFG_USE_COMPILER_DEFAULT_LINKER*/
78 
79 /******************************************************************************/
80 #define IFX_INLINE static inline __attribute__ ((always_inline)) /*Makes the function always inlined */
81 #define IFX_PACKED __attribute__ ((packed))
82 
83 #define COMPILER_NAME "GNUC"
84 #define COMPILER_VERSION __VERSION__
85 
86 #define COMPILER_REVISION 0
87 
88 #define IFX_INTERRUPT_FAST IFX_INTERRUPT
89 
90 #if defined(IFX_USE_SW_MANAGED_INT)
91 
92 #ifndef IFX_INTERRUPT
93 #define IFX_INTERRUPT(isr, vectabNum, prio) void isr(void)
94 #endif
95 
96 #else
97 /* *INDENT-OFF* */
98 #ifndef IFX_INTERRUPT
99 #define IFX_INTERRUPT(isr, vectabNum, prio) IFX_INTERRUPT_INTERNAL(isr, vectabNum, prio)
100 #endif
101 #endif /*defined(IFX_USE_SW_MANAGED_INT)*/
102 
103 #ifndef IFX_INTERRUPT_INTERNAL
104 #define IFX_INTERRUPT_INTERNAL(isr, vectabNum, prio) \
105 __asm__ (".ifndef .intr.entry.include \n"\
106  ".altmacro \n"\
107  ".macro .int_entry.2 intEntryLabel, name # define the section and inttab entry code \n"\
108  " .pushsection .\\intEntryLabel,\"ax\",@progbits \n"\
109  " __\\intEntryLabel : \n"\
110  " svlcx \n"\
111  " movh.a %a14, hi:\\name \n"\
112  " lea %a14, [%a14]lo:\\name \n"\
113  " ji %a14 \n"\
114  " .popsection \n"\
115  ".endm \n"\
116  ".macro .int_entry.1 prio,vectabNum,u,name \n"\
117  ".int_entry.2 intvec_tc\\vectabNum\\u\\prio,(name) # build the unique name \n"\
118  ".endm \n"\
119  " \n"\
120  ".macro .intr.entry name,vectabNum,prio \n"\
121  ".int_entry.1 %(prio),%(vectabNum),_,name # evaluate the priority and the cpu number \n"\
122  ".endm \n"\
123  ".intr.entry.include: \n"\
124  ".endif \n"\
125  ".intr.entry "#isr","#vectabNum","#prio );\
126 IFX_EXTERN void __attribute__ ((interrupt_handler)) isr(); \
127 void isr (void)
128 #endif /* IFX_INTERRUPT_INTERNAL */
129 
130 /* *INDENT-ON* */
131 
132 /******************************************************************************/
133 
134 #define IFX_ALIGN(n) __attribute__ ((aligned(n)))
135 
136 /******************************************************************************/
137 /*Memory qualifiers*/
138 #ifndef IFX_FAR_ABS
139 #define IFX_FAR_ABS __attribute__((fardata))
140 #endif
141 
142 #ifndef IFX_NEAR_ABS
143 #define IFX_NEAR_ABS
144 #endif
145 
146 #ifndef IFX_REL_A0
147 #define IFX_REL_A0
148 #endif
150 #ifndef IFX_REL_A1
151 #define IFX_REL_A1
152 #endif
154 #ifndef IFX_REL_A1
155 #define IFX_REL_A1
156 #endif
158 #ifndef IFX_REL_A9
159 #define IFX_REL_A9
160 #endif
161 /******************************************************************************/
162 
163 #endif /* COMPILERGNUC_H */