Back to index

cell-binutils  2.17cvs20070401
cpu-msp430.c
Go to the documentation of this file.
00001 /* BFD library support routines for the MSP architecture.
00002    Copyright (C) 2002, 2003 Free Software Foundation, Inc.
00003    Contributed by Dmitry Diky <diwil@mail.ru>
00004 
00005    This file is part of BFD, the Binary File Descriptor library.
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; either version 2 of the License, or
00010    (at your option) any later version.
00011 
00012    This program is distributed in the hope that it will be useful,
00013    but WITHOUT ANY WARRANTY; without even the implied warranty of
00014    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015    GNU General Public License for more details.
00016 
00017    You should have received a copy of the GNU General Public License
00018    along with this program; if not, write to the Free Software
00019    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00020 
00021 #include "bfd.h"
00022 #include "sysdep.h"
00023 #include "libbfd.h"
00024 
00025 static const bfd_arch_info_type *compatible
00026   PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
00027 
00028 #define N(addr_bits, machine, print, default, next)            \
00029 {                                                       \
00030   16,                       /* 16 bits in a word.  */   \
00031   addr_bits,                /* Bits in an address.  */  \
00032   8,                        /* 8 bits in a byte.  */    \
00033   bfd_arch_msp430,                                      \
00034   machine,                  /* Machine number.  */             \
00035   "msp430",                 /* Architecture name.   */  \
00036   print,                    /* Printable name.  */             \
00037   1,                        /* Section align power.  */ \
00038   default,                  /* The default machine.  */ \
00039   compatible,                                           \
00040   bfd_default_scan,                                     \
00041   next                                                  \
00042 }
00043 
00044 static const bfd_arch_info_type arch_info_struct[] =
00045 {
00046   /* msp430x11x.  */
00047   N (16, bfd_mach_msp11, "msp:11", FALSE, & arch_info_struct[1]),
00048 
00049   /* msp430x11x1.  */
00050   N (16, bfd_mach_msp110, "msp:110", FALSE, & arch_info_struct[2]),
00051 
00052   /* msp430x12x.  */
00053   N (16, bfd_mach_msp12, "msp:12", FALSE, & arch_info_struct[3]),
00054 
00055   /* msp430x13x.  */
00056   N (16, bfd_mach_msp13, "msp:13", FALSE, & arch_info_struct[4]),
00057 
00058   /* msp430x14x.  */
00059   N (16, bfd_mach_msp14, "msp:14", FALSE, & arch_info_struct[5]),
00060 
00061   /* msp430x15x.  */
00062   N (16, bfd_mach_msp15, "msp:15", FALSE, & arch_info_struct[6]),
00063   
00064   /* msp430x16x.  */
00065   N (16, bfd_mach_msp16, "msp:16", FALSE, & arch_info_struct[7]),
00066 
00067   /* msp430x21x.  */
00068   N (16, bfd_mach_msp21, "msp:21", FALSE, & arch_info_struct[8]),
00069 
00070   /* msp430x31x.  */
00071   N (16, bfd_mach_msp31, "msp:31", FALSE, & arch_info_struct[9]), 
00072 
00073   /* msp430x32x.  */
00074   N (16, bfd_mach_msp32, "msp:32", FALSE, & arch_info_struct[10]), 
00075 
00076   /* msp430x33x.  */
00077   N (16, bfd_mach_msp33, "msp:33", FALSE, & arch_info_struct[11]),
00078   
00079   /* msp430x41x.  */
00080   N (16, bfd_mach_msp41, "msp:41", FALSE, & arch_info_struct[12]),
00081 
00082   /* msp430x42x.  */
00083   N (16, bfd_mach_msp42, "msp:42", FALSE, & arch_info_struct[13]),
00084 
00085   /* msp430x43x.  */
00086   N (16, bfd_mach_msp43, "msp:43", FALSE, & arch_info_struct[14]),
00087 
00088   /* msp430x44x.  */
00089   N (16, bfd_mach_msp43, "msp:44", FALSE, NULL)
00090 };
00091 
00092 const bfd_arch_info_type bfd_msp430_arch =
00093   N (16, bfd_mach_msp14, "msp:14", TRUE, & arch_info_struct[0]);
00094 
00095 /* This routine is provided two arch_infos and works out which MSP
00096    machine which would be compatible with both and returns a pointer
00097    to its info structure.  */
00098 
00099 static const bfd_arch_info_type *
00100 compatible (a,b)
00101      const bfd_arch_info_type * a;
00102      const bfd_arch_info_type * b;
00103 {
00104   /* If a & b are for different architectures we can do nothing.  */
00105   if (a->arch != b->arch)
00106     return NULL;
00107 
00108   if (a->mach <= b->mach)
00109     return b;
00110 
00111   return a;
00112 }