• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use crate::spec::{Cc, LinkerFlavor, Lld, RelocModel, Target, TargetOptions};
2 use object::elf;
3 
4 /// A base target for AVR devices using the GNU toolchain.
5 ///
6 /// Requires GNU avr-gcc and avr-binutils on the host system.
7 /// FIXME: Remove the second parameter when const string concatenation is possible.
target(target_cpu: &'static str, mmcu: &'static str) -> Target8 pub fn target(target_cpu: &'static str, mmcu: &'static str) -> Target {
9     Target {
10         arch: "avr".into(),
11         data_layout: "e-P1-p:16:8-i8:8-i16:8-i32:8-i64:8-f32:8-f64:8-n8-a:8".into(),
12         llvm_target: "avr-unknown-unknown".into(),
13         pointer_width: 16,
14         options: TargetOptions {
15             c_int_width: "16".into(),
16             cpu: target_cpu.into(),
17             exe_suffix: ".elf".into(),
18 
19             linker: Some("avr-gcc".into()),
20             eh_frame_header: false,
21             pre_link_args: TargetOptions::link_args(LinkerFlavor::Gnu(Cc::Yes, Lld::No), &[mmcu]),
22             late_link_args: TargetOptions::link_args(
23                 LinkerFlavor::Gnu(Cc::Yes, Lld::No),
24                 &["-lgcc"],
25             ),
26             max_atomic_width: Some(0),
27             atomic_cas: false,
28             relocation_model: RelocModel::Static,
29             ..TargetOptions::default()
30         },
31     }
32 }
33 
34 /// Resolve the value of the EF_AVR_ARCH field for AVR ELF files, given the
35 /// name of the target CPU / MCU.
36 ///
37 /// In ELF files using the AVR architecture, the lower 7 bits of the e_flags
38 /// field is a code that identifies the "ISA revision" of the object code.
39 ///
40 /// This flag is generally set by AVR compilers in their output ELF files,
41 /// and linkers like avr-ld check this flag in all of their input files to
42 /// make sure they are compiled with the same ISA revision.
ef_avr_arch(target_cpu: &str) -> u3243 pub fn ef_avr_arch(target_cpu: &str) -> u32 {
44     // Adapted from llvm-project/llvm/lib/target/AVR/AVRDevices.td
45     match target_cpu {
46         // Generic MCUs
47         "avr1" => elf::EF_AVR_ARCH_AVR1,
48         "avr2" => elf::EF_AVR_ARCH_AVR2,
49         "avr25" => elf::EF_AVR_ARCH_AVR25,
50         "avr3" => elf::EF_AVR_ARCH_AVR3,
51         "avr31" => elf::EF_AVR_ARCH_AVR31,
52         "avr35" => elf::EF_AVR_ARCH_AVR35,
53         "avr4" => elf::EF_AVR_ARCH_AVR4,
54         "avr5" => elf::EF_AVR_ARCH_AVR5,
55         "avr51" => elf::EF_AVR_ARCH_AVR51,
56         "avr6" => elf::EF_AVR_ARCH_AVR6,
57         "avrxmega1" => elf::EF_AVR_ARCH_XMEGA1,
58         "avrxmega2" => elf::EF_AVR_ARCH_XMEGA2,
59         "avrxmega3" => elf::EF_AVR_ARCH_XMEGA3,
60         "avrxmega4" => elf::EF_AVR_ARCH_XMEGA4,
61         "avrxmega5" => elf::EF_AVR_ARCH_XMEGA5,
62         "avrxmega6" => elf::EF_AVR_ARCH_XMEGA6,
63         "avrxmega7" => elf::EF_AVR_ARCH_XMEGA7,
64         "avrtiny" => elf::EF_AVR_ARCH_AVRTINY,
65 
66         // Specific MCUs
67         "at90s1200" => elf::EF_AVR_ARCH_AVR1,
68         "attiny11" => elf::EF_AVR_ARCH_AVR1,
69         "attiny12" => elf::EF_AVR_ARCH_AVR1,
70         "attiny15" => elf::EF_AVR_ARCH_AVR1,
71         "attiny28" => elf::EF_AVR_ARCH_AVR1,
72         "at90s2313" => elf::EF_AVR_ARCH_AVR2,
73         "at90s2323" => elf::EF_AVR_ARCH_AVR2,
74         "at90s2333" => elf::EF_AVR_ARCH_AVR2,
75         "at90s2343" => elf::EF_AVR_ARCH_AVR2,
76         "attiny22" => elf::EF_AVR_ARCH_AVR2,
77         "attiny26" => elf::EF_AVR_ARCH_AVR2,
78         "at86rf401" => elf::EF_AVR_ARCH_AVR25,
79         "at90s4414" => elf::EF_AVR_ARCH_AVR2,
80         "at90s4433" => elf::EF_AVR_ARCH_AVR2,
81         "at90s4434" => elf::EF_AVR_ARCH_AVR2,
82         "at90s8515" => elf::EF_AVR_ARCH_AVR2,
83         "at90c8534" => elf::EF_AVR_ARCH_AVR2,
84         "at90s8535" => elf::EF_AVR_ARCH_AVR2,
85         "ata5272" => elf::EF_AVR_ARCH_AVR25,
86         "ata6616c" => elf::EF_AVR_ARCH_AVR25,
87         "attiny13" => elf::EF_AVR_ARCH_AVR25,
88         "attiny13a" => elf::EF_AVR_ARCH_AVR25,
89         "attiny2313" => elf::EF_AVR_ARCH_AVR25,
90         "attiny2313a" => elf::EF_AVR_ARCH_AVR25,
91         "attiny24" => elf::EF_AVR_ARCH_AVR25,
92         "attiny24a" => elf::EF_AVR_ARCH_AVR25,
93         "attiny4313" => elf::EF_AVR_ARCH_AVR25,
94         "attiny44" => elf::EF_AVR_ARCH_AVR25,
95         "attiny44a" => elf::EF_AVR_ARCH_AVR25,
96         "attiny84" => elf::EF_AVR_ARCH_AVR25,
97         "attiny84a" => elf::EF_AVR_ARCH_AVR25,
98         "attiny25" => elf::EF_AVR_ARCH_AVR25,
99         "attiny45" => elf::EF_AVR_ARCH_AVR25,
100         "attiny85" => elf::EF_AVR_ARCH_AVR25,
101         "attiny261" => elf::EF_AVR_ARCH_AVR25,
102         "attiny261a" => elf::EF_AVR_ARCH_AVR25,
103         "attiny441" => elf::EF_AVR_ARCH_AVR25,
104         "attiny461" => elf::EF_AVR_ARCH_AVR25,
105         "attiny461a" => elf::EF_AVR_ARCH_AVR25,
106         "attiny841" => elf::EF_AVR_ARCH_AVR25,
107         "attiny861" => elf::EF_AVR_ARCH_AVR25,
108         "attiny861a" => elf::EF_AVR_ARCH_AVR25,
109         "attiny87" => elf::EF_AVR_ARCH_AVR25,
110         "attiny43u" => elf::EF_AVR_ARCH_AVR25,
111         "attiny48" => elf::EF_AVR_ARCH_AVR25,
112         "attiny88" => elf::EF_AVR_ARCH_AVR25,
113         "attiny828" => elf::EF_AVR_ARCH_AVR25,
114         "at43usb355" => elf::EF_AVR_ARCH_AVR3,
115         "at76c711" => elf::EF_AVR_ARCH_AVR3,
116         "atmega103" => elf::EF_AVR_ARCH_AVR31,
117         "at43usb320" => elf::EF_AVR_ARCH_AVR31,
118         "attiny167" => elf::EF_AVR_ARCH_AVR35,
119         "at90usb82" => elf::EF_AVR_ARCH_AVR35,
120         "at90usb162" => elf::EF_AVR_ARCH_AVR35,
121         "ata5505" => elf::EF_AVR_ARCH_AVR35,
122         "ata6617c" => elf::EF_AVR_ARCH_AVR35,
123         "ata664251" => elf::EF_AVR_ARCH_AVR35,
124         "atmega8u2" => elf::EF_AVR_ARCH_AVR35,
125         "atmega16u2" => elf::EF_AVR_ARCH_AVR35,
126         "atmega32u2" => elf::EF_AVR_ARCH_AVR35,
127         "attiny1634" => elf::EF_AVR_ARCH_AVR35,
128         "atmega8" => elf::EF_AVR_ARCH_AVR4,
129         "ata6289" => elf::EF_AVR_ARCH_AVR4,
130         "atmega8a" => elf::EF_AVR_ARCH_AVR4,
131         "ata6285" => elf::EF_AVR_ARCH_AVR4,
132         "ata6286" => elf::EF_AVR_ARCH_AVR4,
133         "ata6612c" => elf::EF_AVR_ARCH_AVR4,
134         "atmega48" => elf::EF_AVR_ARCH_AVR4,
135         "atmega48a" => elf::EF_AVR_ARCH_AVR4,
136         "atmega48pa" => elf::EF_AVR_ARCH_AVR4,
137         "atmega48pb" => elf::EF_AVR_ARCH_AVR4,
138         "atmega48p" => elf::EF_AVR_ARCH_AVR4,
139         "atmega88" => elf::EF_AVR_ARCH_AVR4,
140         "atmega88a" => elf::EF_AVR_ARCH_AVR4,
141         "atmega88p" => elf::EF_AVR_ARCH_AVR4,
142         "atmega88pa" => elf::EF_AVR_ARCH_AVR4,
143         "atmega88pb" => elf::EF_AVR_ARCH_AVR4,
144         "atmega8515" => elf::EF_AVR_ARCH_AVR4,
145         "atmega8535" => elf::EF_AVR_ARCH_AVR4,
146         "atmega8hva" => elf::EF_AVR_ARCH_AVR4,
147         "at90pwm1" => elf::EF_AVR_ARCH_AVR4,
148         "at90pwm2" => elf::EF_AVR_ARCH_AVR4,
149         "at90pwm2b" => elf::EF_AVR_ARCH_AVR4,
150         "at90pwm3" => elf::EF_AVR_ARCH_AVR4,
151         "at90pwm3b" => elf::EF_AVR_ARCH_AVR4,
152         "at90pwm81" => elf::EF_AVR_ARCH_AVR4,
153         "ata5702m322" => elf::EF_AVR_ARCH_AVR5,
154         "ata5782" => elf::EF_AVR_ARCH_AVR5,
155         "ata5790" => elf::EF_AVR_ARCH_AVR5,
156         "ata5790n" => elf::EF_AVR_ARCH_AVR5,
157         "ata5791" => elf::EF_AVR_ARCH_AVR5,
158         "ata5795" => elf::EF_AVR_ARCH_AVR5,
159         "ata5831" => elf::EF_AVR_ARCH_AVR5,
160         "ata6613c" => elf::EF_AVR_ARCH_AVR5,
161         "ata6614q" => elf::EF_AVR_ARCH_AVR5,
162         "ata8210" => elf::EF_AVR_ARCH_AVR5,
163         "ata8510" => elf::EF_AVR_ARCH_AVR5,
164         "atmega16" => elf::EF_AVR_ARCH_AVR5,
165         "atmega16a" => elf::EF_AVR_ARCH_AVR5,
166         "atmega161" => elf::EF_AVR_ARCH_AVR5,
167         "atmega162" => elf::EF_AVR_ARCH_AVR5,
168         "atmega163" => elf::EF_AVR_ARCH_AVR5,
169         "atmega164a" => elf::EF_AVR_ARCH_AVR5,
170         "atmega164p" => elf::EF_AVR_ARCH_AVR5,
171         "atmega164pa" => elf::EF_AVR_ARCH_AVR5,
172         "atmega165" => elf::EF_AVR_ARCH_AVR5,
173         "atmega165a" => elf::EF_AVR_ARCH_AVR5,
174         "atmega165p" => elf::EF_AVR_ARCH_AVR5,
175         "atmega165pa" => elf::EF_AVR_ARCH_AVR5,
176         "atmega168" => elf::EF_AVR_ARCH_AVR5,
177         "atmega168a" => elf::EF_AVR_ARCH_AVR5,
178         "atmega168p" => elf::EF_AVR_ARCH_AVR5,
179         "atmega168pa" => elf::EF_AVR_ARCH_AVR5,
180         "atmega168pb" => elf::EF_AVR_ARCH_AVR5,
181         "atmega169" => elf::EF_AVR_ARCH_AVR5,
182         "atmega169a" => elf::EF_AVR_ARCH_AVR5,
183         "atmega169p" => elf::EF_AVR_ARCH_AVR5,
184         "atmega169pa" => elf::EF_AVR_ARCH_AVR5,
185         "atmega32" => elf::EF_AVR_ARCH_AVR5,
186         "atmega32a" => elf::EF_AVR_ARCH_AVR5,
187         "atmega323" => elf::EF_AVR_ARCH_AVR5,
188         "atmega324a" => elf::EF_AVR_ARCH_AVR5,
189         "atmega324p" => elf::EF_AVR_ARCH_AVR5,
190         "atmega324pa" => elf::EF_AVR_ARCH_AVR5,
191         "atmega324pb" => elf::EF_AVR_ARCH_AVR5,
192         "atmega325" => elf::EF_AVR_ARCH_AVR5,
193         "atmega325a" => elf::EF_AVR_ARCH_AVR5,
194         "atmega325p" => elf::EF_AVR_ARCH_AVR5,
195         "atmega325pa" => elf::EF_AVR_ARCH_AVR5,
196         "atmega3250" => elf::EF_AVR_ARCH_AVR5,
197         "atmega3250a" => elf::EF_AVR_ARCH_AVR5,
198         "atmega3250p" => elf::EF_AVR_ARCH_AVR5,
199         "atmega3250pa" => elf::EF_AVR_ARCH_AVR5,
200         "atmega328" => elf::EF_AVR_ARCH_AVR5,
201         "atmega328p" => elf::EF_AVR_ARCH_AVR5,
202         "atmega328pb" => elf::EF_AVR_ARCH_AVR5,
203         "atmega329" => elf::EF_AVR_ARCH_AVR5,
204         "atmega329a" => elf::EF_AVR_ARCH_AVR5,
205         "atmega329p" => elf::EF_AVR_ARCH_AVR5,
206         "atmega329pa" => elf::EF_AVR_ARCH_AVR5,
207         "atmega3290" => elf::EF_AVR_ARCH_AVR5,
208         "atmega3290a" => elf::EF_AVR_ARCH_AVR5,
209         "atmega3290p" => elf::EF_AVR_ARCH_AVR5,
210         "atmega3290pa" => elf::EF_AVR_ARCH_AVR5,
211         "atmega406" => elf::EF_AVR_ARCH_AVR5,
212         "atmega64" => elf::EF_AVR_ARCH_AVR5,
213         "atmega64a" => elf::EF_AVR_ARCH_AVR5,
214         "atmega640" => elf::EF_AVR_ARCH_AVR5,
215         "atmega644" => elf::EF_AVR_ARCH_AVR5,
216         "atmega644a" => elf::EF_AVR_ARCH_AVR5,
217         "atmega644p" => elf::EF_AVR_ARCH_AVR5,
218         "atmega644pa" => elf::EF_AVR_ARCH_AVR5,
219         "atmega645" => elf::EF_AVR_ARCH_AVR5,
220         "atmega645a" => elf::EF_AVR_ARCH_AVR5,
221         "atmega645p" => elf::EF_AVR_ARCH_AVR5,
222         "atmega649" => elf::EF_AVR_ARCH_AVR5,
223         "atmega649a" => elf::EF_AVR_ARCH_AVR5,
224         "atmega649p" => elf::EF_AVR_ARCH_AVR5,
225         "atmega6450" => elf::EF_AVR_ARCH_AVR5,
226         "atmega6450a" => elf::EF_AVR_ARCH_AVR5,
227         "atmega6450p" => elf::EF_AVR_ARCH_AVR5,
228         "atmega6490" => elf::EF_AVR_ARCH_AVR5,
229         "atmega6490a" => elf::EF_AVR_ARCH_AVR5,
230         "atmega6490p" => elf::EF_AVR_ARCH_AVR5,
231         "atmega64rfr2" => elf::EF_AVR_ARCH_AVR5,
232         "atmega644rfr2" => elf::EF_AVR_ARCH_AVR5,
233         "atmega16hva" => elf::EF_AVR_ARCH_AVR5,
234         "atmega16hva2" => elf::EF_AVR_ARCH_AVR5,
235         "atmega16hvb" => elf::EF_AVR_ARCH_AVR5,
236         "atmega16hvbrevb" => elf::EF_AVR_ARCH_AVR5,
237         "atmega32hvb" => elf::EF_AVR_ARCH_AVR5,
238         "atmega32hvbrevb" => elf::EF_AVR_ARCH_AVR5,
239         "atmega64hve" => elf::EF_AVR_ARCH_AVR5,
240         "atmega64hve2" => elf::EF_AVR_ARCH_AVR5,
241         "at90can32" => elf::EF_AVR_ARCH_AVR5,
242         "at90can64" => elf::EF_AVR_ARCH_AVR5,
243         "at90pwm161" => elf::EF_AVR_ARCH_AVR5,
244         "at90pwm216" => elf::EF_AVR_ARCH_AVR5,
245         "at90pwm316" => elf::EF_AVR_ARCH_AVR5,
246         "atmega32c1" => elf::EF_AVR_ARCH_AVR5,
247         "atmega64c1" => elf::EF_AVR_ARCH_AVR5,
248         "atmega16m1" => elf::EF_AVR_ARCH_AVR5,
249         "atmega32m1" => elf::EF_AVR_ARCH_AVR5,
250         "atmega64m1" => elf::EF_AVR_ARCH_AVR5,
251         "atmega16u4" => elf::EF_AVR_ARCH_AVR5,
252         "atmega32u4" => elf::EF_AVR_ARCH_AVR5,
253         "atmega32u6" => elf::EF_AVR_ARCH_AVR5,
254         "at90usb646" => elf::EF_AVR_ARCH_AVR5,
255         "at90usb647" => elf::EF_AVR_ARCH_AVR5,
256         "at90scr100" => elf::EF_AVR_ARCH_AVR5,
257         "at94k" => elf::EF_AVR_ARCH_AVR5,
258         "m3000" => elf::EF_AVR_ARCH_AVR5,
259         "atmega128" => elf::EF_AVR_ARCH_AVR51,
260         "atmega128a" => elf::EF_AVR_ARCH_AVR51,
261         "atmega1280" => elf::EF_AVR_ARCH_AVR51,
262         "atmega1281" => elf::EF_AVR_ARCH_AVR51,
263         "atmega1284" => elf::EF_AVR_ARCH_AVR51,
264         "atmega1284p" => elf::EF_AVR_ARCH_AVR51,
265         "atmega128rfa1" => elf::EF_AVR_ARCH_AVR51,
266         "atmega128rfr2" => elf::EF_AVR_ARCH_AVR51,
267         "atmega1284rfr2" => elf::EF_AVR_ARCH_AVR51,
268         "at90can128" => elf::EF_AVR_ARCH_AVR51,
269         "at90usb1286" => elf::EF_AVR_ARCH_AVR51,
270         "at90usb1287" => elf::EF_AVR_ARCH_AVR51,
271         "atmega2560" => elf::EF_AVR_ARCH_AVR6,
272         "atmega2561" => elf::EF_AVR_ARCH_AVR6,
273         "atmega256rfr2" => elf::EF_AVR_ARCH_AVR6,
274         "atmega2564rfr2" => elf::EF_AVR_ARCH_AVR6,
275         "atxmega16a4" => elf::EF_AVR_ARCH_XMEGA2,
276         "atxmega16a4u" => elf::EF_AVR_ARCH_XMEGA2,
277         "atxmega16c4" => elf::EF_AVR_ARCH_XMEGA2,
278         "atxmega16d4" => elf::EF_AVR_ARCH_XMEGA2,
279         "atxmega32a4" => elf::EF_AVR_ARCH_XMEGA2,
280         "atxmega32a4u" => elf::EF_AVR_ARCH_XMEGA2,
281         "atxmega32c3" => elf::EF_AVR_ARCH_XMEGA2,
282         "atxmega32c4" => elf::EF_AVR_ARCH_XMEGA2,
283         "atxmega32d3" => elf::EF_AVR_ARCH_XMEGA2,
284         "atxmega32d4" => elf::EF_AVR_ARCH_XMEGA2,
285         "atxmega32e5" => elf::EF_AVR_ARCH_XMEGA2,
286         "atxmega16e5" => elf::EF_AVR_ARCH_XMEGA2,
287         "atxmega8e5" => elf::EF_AVR_ARCH_XMEGA2,
288         "atxmega64a3" => elf::EF_AVR_ARCH_XMEGA4,
289         "atxmega64a3u" => elf::EF_AVR_ARCH_XMEGA4,
290         "atxmega64a4u" => elf::EF_AVR_ARCH_XMEGA4,
291         "atxmega64b1" => elf::EF_AVR_ARCH_XMEGA4,
292         "atxmega64b3" => elf::EF_AVR_ARCH_XMEGA4,
293         "atxmega64c3" => elf::EF_AVR_ARCH_XMEGA4,
294         "atxmega64d3" => elf::EF_AVR_ARCH_XMEGA4,
295         "atxmega64d4" => elf::EF_AVR_ARCH_XMEGA4,
296         "atxmega64a1" => elf::EF_AVR_ARCH_XMEGA5,
297         "atxmega64a1u" => elf::EF_AVR_ARCH_XMEGA5,
298         "atxmega128a3" => elf::EF_AVR_ARCH_XMEGA6,
299         "atxmega128a3u" => elf::EF_AVR_ARCH_XMEGA6,
300         "atxmega128b1" => elf::EF_AVR_ARCH_XMEGA6,
301         "atxmega128b3" => elf::EF_AVR_ARCH_XMEGA6,
302         "atxmega128c3" => elf::EF_AVR_ARCH_XMEGA6,
303         "atxmega128d3" => elf::EF_AVR_ARCH_XMEGA6,
304         "atxmega128d4" => elf::EF_AVR_ARCH_XMEGA6,
305         "atxmega192a3" => elf::EF_AVR_ARCH_XMEGA6,
306         "atxmega192a3u" => elf::EF_AVR_ARCH_XMEGA6,
307         "atxmega192c3" => elf::EF_AVR_ARCH_XMEGA6,
308         "atxmega192d3" => elf::EF_AVR_ARCH_XMEGA6,
309         "atxmega256a3" => elf::EF_AVR_ARCH_XMEGA6,
310         "atxmega256a3u" => elf::EF_AVR_ARCH_XMEGA6,
311         "atxmega256a3b" => elf::EF_AVR_ARCH_XMEGA6,
312         "atxmega256a3bu" => elf::EF_AVR_ARCH_XMEGA6,
313         "atxmega256c3" => elf::EF_AVR_ARCH_XMEGA6,
314         "atxmega256d3" => elf::EF_AVR_ARCH_XMEGA6,
315         "atxmega384c3" => elf::EF_AVR_ARCH_XMEGA6,
316         "atxmega384d3" => elf::EF_AVR_ARCH_XMEGA6,
317         "atxmega128a1" => elf::EF_AVR_ARCH_XMEGA7,
318         "atxmega128a1u" => elf::EF_AVR_ARCH_XMEGA7,
319         "atxmega128a4u" => elf::EF_AVR_ARCH_XMEGA7,
320         "attiny4" => elf::EF_AVR_ARCH_AVRTINY,
321         "attiny5" => elf::EF_AVR_ARCH_AVRTINY,
322         "attiny9" => elf::EF_AVR_ARCH_AVRTINY,
323         "attiny10" => elf::EF_AVR_ARCH_AVRTINY,
324         "attiny20" => elf::EF_AVR_ARCH_AVRTINY,
325         "attiny40" => elf::EF_AVR_ARCH_AVRTINY,
326         "attiny102" => elf::EF_AVR_ARCH_AVRTINY,
327         "attiny104" => elf::EF_AVR_ARCH_AVRTINY,
328         "attiny202" => elf::EF_AVR_ARCH_XMEGA3,
329         "attiny402" => elf::EF_AVR_ARCH_XMEGA3,
330         "attiny204" => elf::EF_AVR_ARCH_XMEGA3,
331         "attiny404" => elf::EF_AVR_ARCH_XMEGA3,
332         "attiny804" => elf::EF_AVR_ARCH_XMEGA3,
333         "attiny1604" => elf::EF_AVR_ARCH_XMEGA3,
334         "attiny406" => elf::EF_AVR_ARCH_XMEGA3,
335         "attiny806" => elf::EF_AVR_ARCH_XMEGA3,
336         "attiny1606" => elf::EF_AVR_ARCH_XMEGA3,
337         "attiny807" => elf::EF_AVR_ARCH_XMEGA3,
338         "attiny1607" => elf::EF_AVR_ARCH_XMEGA3,
339         "attiny212" => elf::EF_AVR_ARCH_XMEGA3,
340         "attiny412" => elf::EF_AVR_ARCH_XMEGA3,
341         "attiny214" => elf::EF_AVR_ARCH_XMEGA3,
342         "attiny414" => elf::EF_AVR_ARCH_XMEGA3,
343         "attiny814" => elf::EF_AVR_ARCH_XMEGA3,
344         "attiny1614" => elf::EF_AVR_ARCH_XMEGA3,
345         "attiny416" => elf::EF_AVR_ARCH_XMEGA3,
346         "attiny816" => elf::EF_AVR_ARCH_XMEGA3,
347         "attiny1616" => elf::EF_AVR_ARCH_XMEGA3,
348         "attiny3216" => elf::EF_AVR_ARCH_XMEGA3,
349         "attiny417" => elf::EF_AVR_ARCH_XMEGA3,
350         "attiny817" => elf::EF_AVR_ARCH_XMEGA3,
351         "attiny1617" => elf::EF_AVR_ARCH_XMEGA3,
352         "attiny3217" => elf::EF_AVR_ARCH_XMEGA3,
353         "attiny1624" => elf::EF_AVR_ARCH_XMEGA3,
354         "attiny1626" => elf::EF_AVR_ARCH_XMEGA3,
355         "attiny1627" => elf::EF_AVR_ARCH_XMEGA3,
356         "atmega808" => elf::EF_AVR_ARCH_XMEGA3,
357         "atmega809" => elf::EF_AVR_ARCH_XMEGA3,
358         "atmega1608" => elf::EF_AVR_ARCH_XMEGA3,
359         "atmega1609" => elf::EF_AVR_ARCH_XMEGA3,
360         "atmega3208" => elf::EF_AVR_ARCH_XMEGA3,
361         "atmega3209" => elf::EF_AVR_ARCH_XMEGA3,
362         "atmega4808" => elf::EF_AVR_ARCH_XMEGA3,
363         "atmega4809" => elf::EF_AVR_ARCH_XMEGA3,
364 
365         // Unknown target CPU => Unspecified/generic code
366         _ => 0,
367     }
368 }
369