OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [gdb-5.0/] [bfd/] [cpu-avr.c] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 104 markom
/* 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>
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
9
the Free Software Foundation; either version 2 of the License, or
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
19
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20
 
21
#include "bfd.h"
22
#include "sysdep.h"
23
#include "libbfd.h"
24
 
25
 
26
static const bfd_arch_info_type *compatible
27
  PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
28
 
29
 
30
#define N(addr_bits, machine, print, default, next)             \
31
{                                                               \
32
  8,                            /* 8 bits in a word */          \
33
  addr_bits,                    /* bits in an address */        \
34
  8,                            /* 8 bits in a byte */          \
35
  bfd_arch_avr,                                                 \
36
  machine,                      /* machine */                   \
37
  "avr",                        /* arch_name  */                \
38
  print,                        /* printable name */            \
39
  1,                            /* section align power */       \
40
  default,                      /* the default machine */       \
41
  compatible,                                                   \
42
  bfd_default_scan,                                             \
43
  next                                                          \
44
}
45
 
46
static const bfd_arch_info_type arch_info_struct[] =
47
{
48
  /* AT90S1200 */
49
  N (16, bfd_mach_avr1, "avr:1", false, & arch_info_struct[1]),
50
 
51
  /* AT90S2xxx, AT90S4xxx, AT90S81xx, ATtiny22 */
52
  N (16, bfd_mach_avr2, "avr:2", false, & arch_info_struct[2]),
53
 
54
  /* ATmega103, ATmega603 */
55
  N (22, bfd_mach_avr3, "avr:3", false, & arch_info_struct[3]),
56
 
57
  /* ATmega161 */
58
  N (16, bfd_mach_avr4, "avr:4", false, NULL)
59
};
60
 
61
const bfd_arch_info_type bfd_avr_arch =
62
  N (16, bfd_mach_avr2, "avr", true, & arch_info_struct[0]);
63
 
64
/* This routine is provided two arch_infos and works out which AVR
65
   machine which would be compatible with both and returns a pointer
66
   to its info structure.  */
67
 
68
static const bfd_arch_info_type *
69
compatible (a,b)
70
     const bfd_arch_info_type * a;
71
     const bfd_arch_info_type * b;
72
{
73
  /* If a & b are for different architectures we can do nothing.  */
74
  if (a->arch != b->arch)
75
    return NULL;
76
 
77
  /* Special case for ATmega[16]03 (avr:3) and ATmega161 (avr:4).  */
78
  if ((a->mach == 3 && b->mach == 4)
79
      || (a->mach == 4 && b->mach == 3))
80
    return NULL;
81
 
82
  /* So far all newer AVR architecture cores are supersets of previous
83
     cores.  */
84
  if (a->mach <= b->mach)
85
    return b;
86
 
87
  /* Never reached!  */
88
  return NULL;
89
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.