]>
Commit | Line | Data |
---|---|---|
2469cfa2 | 1 | /* BFD library support routines for the MSP architecture. |
aa820537 | 2 | Copyright (C) 2002, 2003, 2005, 2007 Free Software Foundation, Inc. |
2469cfa2 NC |
3 | Contributed by Dmitry Diky <[email protected]> |
4 | ||
5 | This file is part of BFD, the Binary File Descriptor library. | |
6 | ||
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 | |
cd123cb7 | 9 | the Free Software Foundation; either version 3 of the License, or |
2469cfa2 NC |
10 | (at your option) any later version. |
11 | ||
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. | |
16 | ||
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 | |
cd123cb7 NC |
19 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
20 | MA 02110-1301, USA. */ | |
2469cfa2 | 21 | |
2469cfa2 | 22 | #include "sysdep.h" |
3db64b00 | 23 | #include "bfd.h" |
2469cfa2 NC |
24 | #include "libbfd.h" |
25 | ||
26 | static const bfd_arch_info_type *compatible | |
27 | PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); | |
28 | ||
29 | #define N(addr_bits, machine, print, default, next) \ | |
30 | { \ | |
31 | 16, /* 16 bits in a word. */ \ | |
32 | addr_bits, /* Bits in an address. */ \ | |
33 | 8, /* 8 bits in a byte. */ \ | |
34 | bfd_arch_msp430, \ | |
35 | machine, /* Machine number. */ \ | |
36 | "msp430", /* Architecture name. */ \ | |
37 | print, /* Printable name. */ \ | |
38 | 1, /* Section align power. */ \ | |
39 | default, /* The default machine. */ \ | |
40 | compatible, \ | |
41 | bfd_default_scan, \ | |
b7761f11 | 42 | bfd_arch_default_fill, \ |
2469cfa2 NC |
43 | next \ |
44 | } | |
45 | ||
46 | static const bfd_arch_info_type arch_info_struct[] = | |
47 | { | |
48 | /* msp430x11x. */ | |
49 | N (16, bfd_mach_msp11, "msp:11", FALSE, & arch_info_struct[1]), | |
50 | ||
3b260895 NC |
51 | /* msp430x11x1. */ |
52 | N (16, bfd_mach_msp110, "msp:110", FALSE, & arch_info_struct[2]), | |
53 | ||
2469cfa2 | 54 | /* msp430x12x. */ |
3b260895 | 55 | N (16, bfd_mach_msp12, "msp:12", FALSE, & arch_info_struct[3]), |
2469cfa2 NC |
56 | |
57 | /* msp430x13x. */ | |
3b260895 | 58 | N (16, bfd_mach_msp13, "msp:13", FALSE, & arch_info_struct[4]), |
2469cfa2 NC |
59 | |
60 | /* msp430x14x. */ | |
3b260895 NC |
61 | N (16, bfd_mach_msp14, "msp:14", FALSE, & arch_info_struct[5]), |
62 | ||
63 | /* msp430x15x. */ | |
64 | N (16, bfd_mach_msp15, "msp:15", FALSE, & arch_info_struct[6]), | |
65 | ||
66 | /* msp430x16x. */ | |
67 | N (16, bfd_mach_msp16, "msp:16", FALSE, & arch_info_struct[7]), | |
2469cfa2 | 68 | |
3260c64d NC |
69 | /* msp430x21x. */ |
70 | N (16, bfd_mach_msp21, "msp:21", FALSE, & arch_info_struct[8]), | |
71 | ||
2469cfa2 | 72 | /* msp430x31x. */ |
3260c64d | 73 | N (16, bfd_mach_msp31, "msp:31", FALSE, & arch_info_struct[9]), |
2469cfa2 NC |
74 | |
75 | /* msp430x32x. */ | |
3260c64d | 76 | N (16, bfd_mach_msp32, "msp:32", FALSE, & arch_info_struct[10]), |
2469cfa2 NC |
77 | |
78 | /* msp430x33x. */ | |
3260c64d | 79 | N (16, bfd_mach_msp33, "msp:33", FALSE, & arch_info_struct[11]), |
2469cfa2 NC |
80 | |
81 | /* msp430x41x. */ | |
3260c64d | 82 | N (16, bfd_mach_msp41, "msp:41", FALSE, & arch_info_struct[12]), |
3b260895 NC |
83 | |
84 | /* msp430x42x. */ | |
3260c64d | 85 | N (16, bfd_mach_msp42, "msp:42", FALSE, & arch_info_struct[13]), |
2469cfa2 NC |
86 | |
87 | /* msp430x43x. */ | |
3260c64d | 88 | N (16, bfd_mach_msp43, "msp:43", FALSE, & arch_info_struct[14]), |
2469cfa2 NC |
89 | |
90 | /* msp430x44x. */ | |
3b260895 | 91 | N (16, bfd_mach_msp43, "msp:44", FALSE, NULL) |
2469cfa2 NC |
92 | }; |
93 | ||
94 | const bfd_arch_info_type bfd_msp430_arch = | |
95 | N (16, bfd_mach_msp14, "msp:14", TRUE, & arch_info_struct[0]); | |
96 | ||
97 | /* This routine is provided two arch_infos and works out which MSP | |
98 | machine which would be compatible with both and returns a pointer | |
99 | to its info structure. */ | |
100 | ||
101 | static const bfd_arch_info_type * | |
102 | compatible (a,b) | |
103 | const bfd_arch_info_type * a; | |
104 | const bfd_arch_info_type * b; | |
105 | { | |
106 | /* If a & b are for different architectures we can do nothing. */ | |
107 | if (a->arch != b->arch) | |
108 | return NULL; | |
109 | ||
110 | if (a->mach <= b->mach) | |
111 | return b; | |
112 | ||
113 | return a; | |
114 | } |