4 * This file is part of BeRTOS.
6 * Bertos is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 * As a special exception, you may use this file as part of a free software
21 * library without restriction. Specifically, if other files instantiate
22 * templates or use macros or inline functions from this file, or you compile
23 * this file and link it with other files to produce an executable, this
24 * file does not by itself cause the resulting executable to be covered by
25 * the GNU General Public License. This exception does not however
26 * invalidate any other reasons why the executable file might be covered by
27 * the GNU General Public License.
29 * Copyright 2004, 2005 Develer S.r.l. (http://www.develer.com/)
30 * Copyright 2004 Giovanni Bajo
34 * \brief CPU detection through special preprocessor macros
39 #if defined(__arm__) /* GCC */ \
40 || defined(__ARM4TM__) /* IAR: defined for all cores >= 4tm */
47 #if (defined(__IAR_SYSTEMS_ICC__) || defined(__IAR_SYSTEMS_ICC)) \
48 && !defined(__ARM4TM__) /* IAR: if not ARM assume I196 */
49 #warning Assuming CPU is I196
56 #if defined(__i386__) /* GCC */ \
57 || (defined(_M_IX86) && !defined(_WIN64)) /* MSVC */
62 #elif defined(__x86_64__) /* GCC */ \
63 || (defined(_M_IX86) && defined(_WIN64)) /* MSVC */
74 #if defined (_ARCH_PPC) || defined(_ARCH_PPC64)
77 #if defined(_ARCH_PPC)
82 #if defined(_ARCH_PPC64)
93 #if defined(__m56800E__) || defined(__m56800__)
100 #if defined (__AVR__)
104 #if defined(__AVR_ATmega64__)
105 #define CPU_AVR_ATMEGA64 1
107 #define CPU_AVR_ATMEGA64 0
110 #if defined(__AVR_ATmega103__)
111 #define CPU_AVR_ATMEGA103 1
113 #define CPU_AVR_ATMEGA103 0
116 #if defined(__AVR_ATmega128__)
117 #define CPU_AVR_ATMEGA128 1
119 #define CPU_AVR_ATMEGA128 0
122 #if defined(__AVR_ATmega8__)
123 #define CPU_AVR_ATMEGA8 1
125 #define CPU_AVR_ATMEGA8 0
128 #if defined(__AVR_ATmega168__)
129 #define CPU_AVR_ATMEGA168 1
131 #define CPU_AVR_ATMEGA168 0
134 #if defined(__AVR_ATmega1281__)
135 #define CPU_AVR_ATMEGA1281 1
137 #define CPU_AVR_ATMEGA1281 0
141 #define CPU_AVR_ATMEGA8 0
142 #define CPU_AVR_ATMEGA168 0
143 #define CPU_AVR_ATMEGA64 0
144 #define CPU_AVR_ATMEGA103 0
145 #define CPU_AVR_ATMEGA128 0
146 #define CPU_AVR_ATMEGA1281 0
150 /* Self-check for the detection: only one CPU must be detected */
151 #if CPU_ARM + CPU_I196 + CPU_X86 + CPU_PPC + CPU_DSP56K + CPU_AVR == 0
153 #elif !defined(CPU_ID)
154 #error CPU_ID not defined
155 #elif CPU_ARM + CPU_I196 + CPU_X86 + CPU_PPC + CPU_DSP56K + CPU_AVR != 1
156 #error Internal CPU configuration error
160 #endif /* CPU_DETECT_H */