]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/config/avr/avr-devices.c
Update copyright years.
[thirdparty/gcc.git] / gcc / config / avr / avr-devices.c
CommitLineData
f1717362 1/* Copyright (C) 2009-2016 Free Software Foundation, Inc.
795cff42 2 Contributed by Anatoly Sokolov (aesok@post.ru)
3
4 This file is part of GCC.
5
6 GCC 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 3, or (at your option)
9 any later version.
10
11 GCC 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.
15
16 You should have received a copy of the GNU General Public License
17 along with GCC; see the file COPYING3. If not see
18 <http://www.gnu.org/licenses/>. */
19
1dbb006a 20#ifndef IN_GEN_AVR_MMCU_TEXI
795cff42 21#include "config.h"
22#include "system.h"
23#include "coretypes.h"
24#include "tm.h"
c1eb80de 25#include "diagnostic.h"
1dbb006a 26#endif /* IN_GEN_AVR_MMCU_TEXI */
795cff42 27
f0aa7fe2 28#include "avr-arch.h"
29
644ac9c5 30/* List of all known AVR MCU architectures.
31 Order as of enum avr_arch from avr.h. */
795cff42 32
ce544647 33const avr_arch_t
5bd39e93 34avr_arch_types[] =
35{
36 /* unknown device specified */
f0aa7fe2 37 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, NULL, AVR_MMCU_DEFAULT },
5bd39e93 38 /*
b4e6d2e2 39 A M J LM E E E X R T d S S O A
40 S U M PO L L I M A I a t F ff r
41 M L P MV P P J E M N t a R s c
42 XW M M M G P Y a r e h
43 X P A D t t ID */
44 { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, "1", "avr1" },
45 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, "2", "avr2" },
46 { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, 32, "25", "avr25" },
47 { 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0x0060, 32, "3", "avr3" },
48 { 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0x0060, 32, "31", "avr31" },
49 { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0x0060, 32, "35", "avr35" },
50 { 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0x0060, 32, "4", "avr4" },
51 { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0x0060, 32, "5", "avr5" },
52 { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0x0060, 32, "51", "avr51" },
53 { 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0x0060, 32, "6", "avr6" },
0b6cf66f 54
b4e6d2e2 55 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0x0040, 0, "100", "avrtiny" },
56 { 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0x2000, 0, "102", "avrxmega2" },
57 { 0, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0x2000, 0, "104", "avrxmega4" },
58 { 0, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0x2000, 0, "105", "avrxmega5" },
59 { 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0x2000, 0, "106", "avrxmega6" },
60 { 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0x2000, 0, "107", "avrxmega7" }
795cff42 61};
62
ce544647 63const avr_arch_info_t
8a92b4c3 64avr_texinfo[] =
65{
66 { ARCH_AVR1,
67 "This ISA is implemented by the minimal AVR core and supported "
68 "for assembler only." },
69 { ARCH_AVR2,
70 "``Classic'' devices with up to 8@tie{}KiB of program memory." },
71 { ARCH_AVR25,
72 "``Classic'' devices with up to 8@tie{}KiB of program memory and with "
73 "the @code{MOVW} instruction." },
74 { ARCH_AVR3,
75 "``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of "
76 " program memory." },
77 { ARCH_AVR31,
78 "``Classic'' devices with 128@tie{}KiB of program memory." },
79 { ARCH_AVR35,
80 "``Classic'' devices with 16@tie{}KiB up to 64@tie{}KiB of "
81 "program memory and with the @code{MOVW} instruction." },
82 { ARCH_AVR4,
83 "``Enhanced'' devices with up to 8@tie{}KiB of program memory." },
84 { ARCH_AVR5,
85 "``Enhanced'' devices with 16@tie{}KiB up to 64@tie{}KiB of "
86 "program memory." },
87 { ARCH_AVR51,
88 "``Enhanced'' devices with 128@tie{}KiB of program memory." },
89 { ARCH_AVR6,
90 "``Enhanced'' devices with 3-byte PC, i.e.@: with more than 128@tie{}KiB "
91 "of program memory." },
b4e6d2e2 92 { ARCH_AVRTINY,
93 "``TINY'' Tiny core devices with 512@tie{}B up to 4@tie{}KiB of "
94 "program memory." },
8a92b4c3 95 { ARCH_AVRXMEGA2,
96 "``XMEGA'' devices with more than 8@tie{}KiB and up to 64@tie{}KiB "
97 "of program memory." },
98 { ARCH_AVRXMEGA4,
99 "``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB "
100 "of program memory." },
101 { ARCH_AVRXMEGA5,
102 "``XMEGA'' devices with more than 64@tie{}KiB and up to 128@tie{}KiB "
103 "of program memory and more than 64@tie{}KiB of RAM." },
104 { ARCH_AVRXMEGA6,
105 "``XMEGA'' devices with more than 128@tie{}KiB of program memory." },
106 { ARCH_AVRXMEGA7,
107 "``XMEGA'' devices with more than 128@tie{}KiB of program memory "
108 "and more than 64@tie{}KiB of RAM." }
109};
110
ce544647 111const avr_mcu_t
112avr_mcu_types[] =
113{
22e771f8 114#define AVR_MCU(NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH)\
115 { NAME, ARCH, DEV_ATTRIBUTE, MACRO, DATA_SEC, TEXT_SEC, N_FLASH },
c1535dd2 116#include "avr-mcus.def"
117#undef AVR_MCU
795cff42 118 /* End of list. */
22e771f8 119 { NULL, ARCH_UNKNOWN, AVR_ISA_NONE, NULL, 0, 0, 0 }
795cff42 120};
121
f0aa7fe2 122
123\f
124
125#ifndef IN_GEN_AVR_MMCU_TEXI
126
127/* Copy-pastes from `gen-avr-mmcu-texi.c' follow... */
128
129static const char*
130mcu_name[sizeof avr_mcu_types / sizeof avr_mcu_types[0]];
131
132static int
133comparator (const void *va, const void *vb)
134{
135 const char *a = *(const char* const*) va;
136 const char *b = *(const char* const*) vb;
137
138 while (*a && *b)
139 {
140 /* Make letters smaller than digits so that `atmega16a' follows
141 `atmega16' without `atmega161' etc. between them. */
142
143 if (ISALPHA (*a) && ISDIGIT (*b))
144 return -1;
145
146 if (ISDIGIT (*a) && ISALPHA (*b))
147 return 1;
148
149 if (*a != *b)
150 return *a - *b;
151
152 a++;
153 b++;
154 }
155
156 return *a - *b;
157}
158
159
160static char*
161avr_archs_str (void)
162{
163 char *archs = concat ("", NULL);
164
165 // Build of core architectures' names.
166
167 for (const avr_mcu_t *mcu = avr_mcu_types; mcu->name; mcu++)
168 if (!mcu->macro)
169 archs = concat (archs, " ", avr_arch_types[mcu->arch_id].name, NULL);
170
171 return archs;
172}
173
174
175static char*
176avr_mcus_str (void)
177{
178 size_t n_mcus = 0;
179 char *mcus = concat ("", NULL);
180
181 // Build array of proper devices' names.
182
183 for (const avr_mcu_t *mcu = avr_mcu_types; mcu->name; mcu++)
184 if (mcu->macro)
185 mcu_name[n_mcus++] = mcu->name;
186
187 // Sort MCUs so that they are displayed in the same canonical order as
188 // in doc/avr-mcus.texi.
189
190 qsort (mcu_name, n_mcus, sizeof (char*), comparator);
191
192 for (size_t i = 0; i < n_mcus; i++)
193 mcus = concat (mcus, " ", mcu_name[i], NULL);
194
195 return mcus;
196}
197
198
199void
200avr_inform_devices (void)
201{
202 char *mcus = avr_mcus_str ();
203 inform (input_location, "devices natively supported:%s", mcus);
204 free (mcus);
205}
206
207
208void
209avr_inform_core_architectures (void)
210{
211 char *archs = avr_archs_str ();
212 inform (input_location, "supported core architectures:%s", archs);
213 free (archs);
214}
215
216#endif // IN_GEN_AVR_MMCU_TEXI