1 /* BFD library support routines for the AVR architecture.
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc.
3 Contributed by Denis Chertykov <denisc@overta.ru>
5 This file is part of BFD, the Binary File Descriptor library.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
25 static const bfd_arch_info_type
*compatible
26 PARAMS ((const bfd_arch_info_type
*, const bfd_arch_info_type
*));
28 #define N(addr_bits, machine, print, default, next) \
30 8, /* 8 bits in a word */ \
31 addr_bits, /* bits in an address */ \
32 8, /* 8 bits in a byte */ \
34 machine, /* machine */ \
35 "avr", /* arch_name */ \
36 print, /* printable name */ \
37 1, /* section align power */ \
38 default, /* the default machine */ \
44 static const bfd_arch_info_type arch_info_struct
[] =
46 /* AT90S1200, ATtiny1x, ATtiny28 */
47 N (16, bfd_mach_avr1
, "avr:1", false, & arch_info_struct
[1]),
49 /* AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22 */
50 N (16, bfd_mach_avr2
, "avr:2", false, & arch_info_struct
[2]),
52 /* ATmega103, ATmega603 */
53 N (22, bfd_mach_avr3
, "avr:3", false, & arch_info_struct
[3]),
55 /* ATmega83, ATmega85 */
56 N (16, bfd_mach_avr4
, "avr:4", false, & arch_info_struct
[4]),
58 /* ATmega161, ATmega163, ATmega32, AT94K */
59 N (22, bfd_mach_avr5
, "avr:5", false, NULL
)
62 const bfd_arch_info_type bfd_avr_arch
=
63 N (16, bfd_mach_avr2
, "avr", true, & arch_info_struct
[0]);
65 /* This routine is provided two arch_infos and works out which AVR
66 machine which would be compatible with both and returns a pointer
67 to its info structure. */
69 static const bfd_arch_info_type
*
71 const bfd_arch_info_type
* a
;
72 const bfd_arch_info_type
* b
;
74 /* If a & b are for different architectures we can do nothing. */
75 if (a
->arch
!= b
->arch
)
78 /* Special case for ATmega[16]03 (avr:3) and ATmega83 (avr:4). */
79 if ((a
->mach
== 3 && b
->mach
== 4)
80 || (a
->mach
== 4 && b
->mach
== 3))
83 /* So far all newer AVR architecture cores are supersets of previous
85 if (a
->mach
<= b
->mach
)
88 if (a
->mach
>= b
->mach
)