annotate gcc/config/avr/avr-arch.h @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children 1830386684a0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* Definitions of types that are used to store AVR architecture and
kono
parents:
diff changeset
2 device information.
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
3 Copyright (C) 2012-2018 Free Software Foundation, Inc.
111
kono
parents:
diff changeset
4 Contributed by Georg-Johann Lay (avr@gjlay.de)
kono
parents:
diff changeset
5
kono
parents:
diff changeset
6 This file is part of GCC.
kono
parents:
diff changeset
7
kono
parents:
diff changeset
8 GCC is free software; you can redistribute it and/or modify
kono
parents:
diff changeset
9 it under the terms of the GNU General Public License as published by
kono
parents:
diff changeset
10 the Free Software Foundation; either version 3, or (at your option)
kono
parents:
diff changeset
11 any later version.
kono
parents:
diff changeset
12
kono
parents:
diff changeset
13 GCC is distributed in the hope that it will be useful,
kono
parents:
diff changeset
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
kono
parents:
diff changeset
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
kono
parents:
diff changeset
16 GNU General Public License for more details.
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
kono
parents:
diff changeset
19 along with GCC; see the file COPYING3. If not see
kono
parents:
diff changeset
20 <http://www.gnu.org/licenses/>. */
kono
parents:
diff changeset
21
kono
parents:
diff changeset
22 #ifndef AVR_ARCH_H
kono
parents:
diff changeset
23 #define AVR_ARCH_H
kono
parents:
diff changeset
24
kono
parents:
diff changeset
25 #define AVR_MMCU_DEFAULT "avr2"
kono
parents:
diff changeset
26
kono
parents:
diff changeset
27 /* This enum supplies indices into the avr_arch_types[] table below. */
kono
parents:
diff changeset
28
kono
parents:
diff changeset
29 enum avr_arch_id
kono
parents:
diff changeset
30 {
kono
parents:
diff changeset
31 ARCH_UNKNOWN,
kono
parents:
diff changeset
32 ARCH_AVR1,
kono
parents:
diff changeset
33 ARCH_AVR2,
kono
parents:
diff changeset
34 ARCH_AVR25,
kono
parents:
diff changeset
35 ARCH_AVR3,
kono
parents:
diff changeset
36 ARCH_AVR31,
kono
parents:
diff changeset
37 ARCH_AVR35,
kono
parents:
diff changeset
38 ARCH_AVR4,
kono
parents:
diff changeset
39 ARCH_AVR5,
kono
parents:
diff changeset
40 ARCH_AVR51,
kono
parents:
diff changeset
41 ARCH_AVR6,
kono
parents:
diff changeset
42 ARCH_AVRTINY,
kono
parents:
diff changeset
43 ARCH_AVRXMEGA2,
kono
parents:
diff changeset
44 ARCH_AVRXMEGA3,
kono
parents:
diff changeset
45 ARCH_AVRXMEGA4,
kono
parents:
diff changeset
46 ARCH_AVRXMEGA5,
kono
parents:
diff changeset
47 ARCH_AVRXMEGA6,
kono
parents:
diff changeset
48 ARCH_AVRXMEGA7
kono
parents:
diff changeset
49 };
kono
parents:
diff changeset
50
kono
parents:
diff changeset
51
kono
parents:
diff changeset
52 /* Architecture-specific properties. */
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 typedef struct
kono
parents:
diff changeset
55 {
kono
parents:
diff changeset
56 /* Assembler only. */
kono
parents:
diff changeset
57 int asm_only;
kono
parents:
diff changeset
58
kono
parents:
diff changeset
59 /* Core have 'MUL*' instructions. */
kono
parents:
diff changeset
60 int have_mul;
kono
parents:
diff changeset
61
kono
parents:
diff changeset
62 /* Core have 'CALL' and 'JMP' instructions. */
kono
parents:
diff changeset
63 int have_jmp_call;
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 /* Core have 'MOVW' and 'LPM Rx,Z' instructions. */
kono
parents:
diff changeset
66 int have_movw_lpmx;
kono
parents:
diff changeset
67
kono
parents:
diff changeset
68 /* Core have 'ELPM' instructions. */
kono
parents:
diff changeset
69 int have_elpm;
kono
parents:
diff changeset
70
kono
parents:
diff changeset
71 /* Core have 'ELPM Rx,Z' instructions. */
kono
parents:
diff changeset
72 int have_elpmx;
kono
parents:
diff changeset
73
kono
parents:
diff changeset
74 /* Core have 'EICALL' and 'EIJMP' instructions. */
kono
parents:
diff changeset
75 int have_eijmp_eicall;
kono
parents:
diff changeset
76
kono
parents:
diff changeset
77 /* This is an XMEGA core. */
kono
parents:
diff changeset
78 int xmega_p;
kono
parents:
diff changeset
79
kono
parents:
diff changeset
80 /* This core has the RAMPD special function register
kono
parents:
diff changeset
81 and thus also the RAMPX, RAMPY and RAMPZ registers. */
kono
parents:
diff changeset
82 int have_rampd;
kono
parents:
diff changeset
83
kono
parents:
diff changeset
84 /* This is a TINY core. */
kono
parents:
diff changeset
85 int tiny_p;
kono
parents:
diff changeset
86
kono
parents:
diff changeset
87 /* Default start of data section address for architecture. */
kono
parents:
diff changeset
88 int default_data_section_start;
kono
parents:
diff changeset
89
kono
parents:
diff changeset
90 /* Offset where flash memory is seen in RAM address range or 0. */
kono
parents:
diff changeset
91 int flash_pm_offset;
kono
parents:
diff changeset
92
kono
parents:
diff changeset
93 /* Offset between SFR address and RAM address:
kono
parents:
diff changeset
94 SFR-address = RAM-address - sfr_offset */
kono
parents:
diff changeset
95 int sfr_offset;
kono
parents:
diff changeset
96
kono
parents:
diff changeset
97 /* Architecture id to built-in define __AVR_ARCH__ (NULL -> no macro) */
kono
parents:
diff changeset
98 const char *const macro;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 /* Architecture name. */
kono
parents:
diff changeset
101 const char *const name;
kono
parents:
diff changeset
102 } avr_arch_t;
kono
parents:
diff changeset
103
kono
parents:
diff changeset
104
kono
parents:
diff changeset
105 /* Device-specific properties. */
kono
parents:
diff changeset
106
kono
parents:
diff changeset
107 typedef struct
kono
parents:
diff changeset
108 {
kono
parents:
diff changeset
109 /* Device name. */
kono
parents:
diff changeset
110 const char *const name;
kono
parents:
diff changeset
111
kono
parents:
diff changeset
112 /* Index in avr_arch_types[]. */
kono
parents:
diff changeset
113 enum avr_arch_id arch_id;
kono
parents:
diff changeset
114
kono
parents:
diff changeset
115 /* device specific feature */
kono
parents:
diff changeset
116 int dev_attribute;
kono
parents:
diff changeset
117
kono
parents:
diff changeset
118 /* Must lie outside user's namespace. NULL == no macro. */
kono
parents:
diff changeset
119 const char *const macro;
kono
parents:
diff changeset
120
kono
parents:
diff changeset
121 /* Start of data section. */
kono
parents:
diff changeset
122 int data_section_start;
kono
parents:
diff changeset
123
kono
parents:
diff changeset
124 /* Start of text section. */
kono
parents:
diff changeset
125 int text_section_start;
kono
parents:
diff changeset
126
kono
parents:
diff changeset
127 /* Flash size in bytes. */
kono
parents:
diff changeset
128 int flash_size;
kono
parents:
diff changeset
129 } avr_mcu_t;
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 /* AVR device specific features.
kono
parents:
diff changeset
132
kono
parents:
diff changeset
133 AVR_ISA_RMW
kono
parents:
diff changeset
134 Only few avr devices have Read-Modify-Write (RMW) instructions
kono
parents:
diff changeset
135 (XCH, LAC, LAS and LAT)
kono
parents:
diff changeset
136
kono
parents:
diff changeset
137 AVR_SHORT_SP
kono
parents:
diff changeset
138 Stack Pointer has only 8 bit width.
kono
parents:
diff changeset
139 The device / multilib has an 8-bit stack pointer (no SPH).
kono
parents:
diff changeset
140
kono
parents:
diff changeset
141 AVR_ERRATA_SKIP
kono
parents:
diff changeset
142 Some AVR devices have a core erratum when skipping a 2-word instruction.
kono
parents:
diff changeset
143 Skip instructions are: SBRC, SBRS, SBIC, SBIS, CPSE.
kono
parents:
diff changeset
144 Problems will occur with return address is IRQ executes during the
kono
parents:
diff changeset
145 skip sequence.
kono
parents:
diff changeset
146
kono
parents:
diff changeset
147 A support ticket from Atmel returned the following information:
kono
parents:
diff changeset
148
kono
parents:
diff changeset
149 Subject: (ATTicket:644469) On AVR skip-bug core Erratum
kono
parents:
diff changeset
150 From: avr@atmel.com Date: 2011-07-27
kono
parents:
diff changeset
151 (Please keep the subject when replying to this mail)
kono
parents:
diff changeset
152
kono
parents:
diff changeset
153 This errata exists only in AT90S8515 and ATmega103 devices.
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155 For information please refer the following respective errata links
kono
parents:
diff changeset
156 http://www.atmel.com/dyn/resources/prod_documents/doc2494.pdf
kono
parents:
diff changeset
157 http://www.atmel.com/dyn/resources/prod_documents/doc1436.pdf
kono
parents:
diff changeset
158
kono
parents:
diff changeset
159 AVR_ISA_RCALL
kono
parents:
diff changeset
160 Always use RJMP / RCALL and assume JMP / CALL are not available.
kono
parents:
diff changeset
161 This affects multilib selection via specs generation and -mshort-calls.
kono
parents:
diff changeset
162 Even if a device like ATtiny417 from avrxmega3 supports JMP / CALL, we
kono
parents:
diff changeset
163 assume these instructions are not available and we set the built-in
kono
parents:
diff changeset
164 macro __AVR_HAVE_JMP_CALL__ accordingly. This macro is used to
kono
parents:
diff changeset
165 determine a rough estimate of flash size in libgcc, and AVR-LibC uses
kono
parents:
diff changeset
166 this macro to determine vector sizes. */
kono
parents:
diff changeset
167
kono
parents:
diff changeset
168 enum avr_device_specific_features
kono
parents:
diff changeset
169 {
kono
parents:
diff changeset
170 AVR_ISA_NONE,
kono
parents:
diff changeset
171 AVR_ISA_RMW = 0x1, /* device has RMW instructions. */
kono
parents:
diff changeset
172 AVR_SHORT_SP = 0x2, /* Stack Pointer has 8 bits width. */
kono
parents:
diff changeset
173 AVR_ERRATA_SKIP = 0x4, /* device has a core erratum. */
kono
parents:
diff changeset
174 AVR_ISA_LDS = 0x8, /* whether LDS / STS is valid for all data in static
kono
parents:
diff changeset
175 storage. Only useful for reduced Tiny. */
kono
parents:
diff changeset
176 AVR_ISA_RCALL = 0x10 /* Use RJMP / RCALL even though JMP / CALL
kono
parents:
diff changeset
177 are available (-mshort-calls). */
kono
parents:
diff changeset
178 };
kono
parents:
diff changeset
179
kono
parents:
diff changeset
180 /* Map architecture to its texinfo string. */
kono
parents:
diff changeset
181
kono
parents:
diff changeset
182 typedef struct
kono
parents:
diff changeset
183 {
kono
parents:
diff changeset
184 /* Architecture ID. */
kono
parents:
diff changeset
185 enum avr_arch_id arch_id;
kono
parents:
diff changeset
186
kono
parents:
diff changeset
187 /* textinfo source to describe the architecture. */
kono
parents:
diff changeset
188 const char *texinfo;
kono
parents:
diff changeset
189 } avr_arch_info_t;
kono
parents:
diff changeset
190
kono
parents:
diff changeset
191 /* Preprocessor macros to define depending on MCU type. */
kono
parents:
diff changeset
192
kono
parents:
diff changeset
193 extern const avr_arch_t avr_arch_types[];
kono
parents:
diff changeset
194 extern const avr_arch_t *avr_arch;
kono
parents:
diff changeset
195
kono
parents:
diff changeset
196 extern const avr_mcu_t avr_mcu_types[];
kono
parents:
diff changeset
197
kono
parents:
diff changeset
198 extern void avr_inform_core_architectures (void);
kono
parents:
diff changeset
199
kono
parents:
diff changeset
200 #endif /* AVR_ARCH_H */