4 * Copyright 2004, 2005 Develer S.r.l. (http://www.develer.com/)
5 * Copyright 2004 Giovanni Bajo
6 * This file is part of DevLib - See README.devlib for information.
9 * \brief CPU detection through special preprocessor macros
16 /* Any random CPU will do */
20 #if defined(__arm__) /* GCC */ \
21 || defined(__ARM4TM__) /* IAR: defined for all cores >= 4tm */
28 #if (defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)) \
29 && !defined(__ARM4TM__) /* IAR: if not ARM assume I196 */
36 #if defined(__i386__) /* GCC */ \
37 || (defined(_M_IX86) && !defined(_WIN64)) /* MSVC */
42 #elif defined(__x86_64__) /* GCC */ \
43 || (defined(_M_IX86) && defined(_WIN64)) /* MSVC */
54 #if defined (_ARCH_PPC) || defined(_ARCH_PPC64)
57 #if defined(_ARCH_PPC)
62 #if defined(_ARCH_PPC64)
73 #if defined(__m56800E__) || defined(__m56800__)
84 #if defined(__AVR_ATmega64__)
85 #define CPU_AVR_ATMEGA64 1
87 #define CPU_AVR_ATMEGA64 0
90 #if defined(__AVR_ATmega103__)
91 #define CPU_AVR_ATMEGA103 1
93 #define CPU_AVR_ATMEGA103 0
96 #if defined(__AVR_ATmega128__)
97 #define CPU_AVR_ATMEGA128 1
99 #define CPU_AVR_ATMEGA128 0
102 #if defined(__AVR_ATmega8__)
103 #define CPU_AVR_ATMEGA8 1
105 #define CPU_AVR_ATMEGA8 0
108 #if defined(__AVR_ATmega168__)
109 #define CPU_AVR_ATMEGA168 1
111 #define CPU_AVR_ATMEGA168 0
114 #if defined(__AVR_ATmega1281__)
115 #define CPU_AVR_ATMEGA1281 1
117 #define CPU_AVR_ATMEGA1281 0
121 #define CPU_AVR_ATMEGA8 0
122 #define CPU_AVR_ATMEGA168 0
123 #define CPU_AVR_ATMEGA64 0
124 #define CPU_AVR_ATMEGA103 0
125 #define CPU_AVR_ATMEGA128 0
126 #define CPU_AVR_ATMEGA1281 0
130 /* Self-check for the detection: only one CPU must be detected */
131 #if CPU_ARM + CPU_I196 + CPU_X86 + CPU_PPC + CPU_DSP56K + CPU_AVR == 0
133 #elif !defined(CPU_ID)
134 #error CPU_ID not defined
135 #elif CPU_ARM + CPU_I196 + CPU_X86 + CPU_PPC + CPU_DSP56K + CPU_AVR != 1
136 #error Internal CPU configuration error
140 #endif /* CPU_DETECT_H */