* Re: [patch] avr-binutils changes
@ 2000-07-03 15:27 Nick Clifton
0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2000-07-03 15:27 UTC (permalink / raw)
To: marekm; +Cc: denisc, binutils
Hi Marek,
: bfd/ChangeLog:
:
: 2000-07-03 Marek Michalkiewicz <marekm@linux.org.pl>
:
: * elf32-avr.c (bfd_elf32_bfd_reloc_type_lookup):
: Add ATTRIBUTE_UNUSED to unused arguments to avoid warnings.
: (avr_info_to_howto_rela): Likewise.
: (elf32_avr_gc_mark_hook): Likewise.
: (elf32_avr_gc_sweep_hook): Likewise.
: (elf32_avr_relocate_section): Likewise.
:
:
: gas/ChangeLog:
:
: 2000-07-03 Marek Michalkiewicz <marekm@linux.org.pl>
:
: * config/tc-avr.c: Change _ () to _() around all strings marked
: for translation (exception from the usual coding style).
: (avr_opt): New struct variable, how the new switches are set.
: (OPTION_MMCU): Define as 'm' and actually use.
: (md_longopts): Add -mall-opcodes, -mno-skip-bug, -mno-wrap.
: (show_mcu_list): New function, display the list of known MCUs.
: (md_show_usage): Document the new switches. Call show_mcu_list.
: (avr_set_arch): Change 'm' to OPTION_MMCU.
: (md_parse_option): Call show_mcu_list if unknown MCU specified.
: Handle the new switches.
: (avr_operands): Disable warnings for undefined combinations of
: operands if -mall-opcodes. Disable warnings for skipping two-word
: instructions if enhanced core or -mno-skip-bug.
: (avr_operand): Accept all addressing modes on avr1 if -mall-opcodes.
: (md_apply_fix3): Reject 8K wrap if >8K or -mno-wrap.
: (md_assemble): Accept opcodes not supported by MCU if -mall-opcodes.
: (avr_ldi_expression): Warn about implicit lo8().
: * config/tc-avr.h (md_pcrel_from_section): Add prototype.
:
:
: opcodes/ChangeLog:
:
: 2000-07-03 Marek Michalkiewicz <marekm@linux.org.pl>
:
: * avr-dis.c (avr_operand): Change _ () to _() around all strings
: marked for translation (exception from the usual coding style).
: (print_insn_avr): Initialize insn2 to avoid warnings.
Approved and applied.
Cheers
Nick
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch] avr-binutils changes
@ 2000-07-03 12:01 Marek Michalkiewicz
0 siblings, 0 replies; 4+ messages in thread
From: Marek Michalkiewicz @ 2000-07-03 12:01 UTC (permalink / raw)
To: denisc; +Cc: binutils
Here are a few more changes for AVR binutils - I hope you find them
useful. The patch is quite big. but much of it are really indentation
changes, and cleanups that don't change how the code works. A few
warnings are removed, and a few new target-specific switches added.
Thanks,
Marek
bfd/ChangeLog:
2000-07-03 Marek Michalkiewicz <marekm@linux.org.pl>
* elf32-avr.c (bfd_elf32_bfd_reloc_type_lookup):
Add ATTRIBUTE_UNUSED to unused arguments to avoid warnings.
(avr_info_to_howto_rela): Likewise.
(elf32_avr_gc_mark_hook): Likewise.
(elf32_avr_gc_sweep_hook): Likewise.
(elf32_avr_relocate_section): Likewise.
gas/ChangeLog:
2000-07-03 Marek Michalkiewicz <marekm@linux.org.pl>
* config/tc-avr.c: Change _ () to _() around all strings marked
for translation (exception from the usual coding style).
(avr_opt): New struct variable, how the new switches are set.
(OPTION_MMCU): Define as 'm' and actually use.
(md_longopts): Add -mall-opcodes, -mno-skip-bug, -mno-wrap.
(show_mcu_list): New function, display the list of known MCUs.
(md_show_usage): Document the new switches. Call show_mcu_list.
(avr_set_arch): Change 'm' to OPTION_MMCU.
(md_parse_option): Call show_mcu_list if unknown MCU specified.
Handle the new switches.
(avr_operands): Disable warnings for undefined combinations of
operands if -mall-opcodes. Disable warnings for skipping two-word
instructions if enhanced core or -mno-skip-bug.
(avr_operand): Accept all addressing modes on avr1 if -mall-opcodes.
(md_apply_fix3): Reject 8K wrap if >8K or -mno-wrap.
(md_assemble): Accept opcodes not supported by MCU if -mall-opcodes.
(avr_ldi_expression): Warn about implicit lo8().
* config/tc-avr.h (md_pcrel_from_section): Add prototype.
opcodes/ChangeLog:
2000-07-03 Marek Michalkiewicz <marekm@linux.org.pl>
* avr-dis.c (avr_operand): Change _ () to _() around all strings
marked for translation (exception from the usual coding style).
(print_insn_avr): Initialize insn2 to avoid warnings.
diff -Nrc3p orig/src/bfd/elf32-avr.c src/bfd/elf32-avr.c
*** orig/src/bfd/elf32-avr.c Tue Jun 27 08:20:24 2000
--- src/bfd/elf32-avr.c Mon Jul 3 13:33:26 2000
*************** struct avr_reloc_map
*** 369,375 ****
static reloc_howto_type *
bfd_elf32_bfd_reloc_type_lookup (abfd, code)
! bfd *abfd;
bfd_reloc_code_real_type code;
{
unsigned int i;
--- 369,375 ----
static reloc_howto_type *
bfd_elf32_bfd_reloc_type_lookup (abfd, code)
! bfd *abfd ATTRIBUTE_UNUSED;
bfd_reloc_code_real_type code;
{
unsigned int i;
*************** bfd_elf32_bfd_reloc_type_lookup (abfd, c
*** 389,395 ****
static void
avr_info_to_howto_rela (abfd, cache_ptr, dst)
! bfd *abfd;
arelent *cache_ptr;
Elf32_Internal_Rela *dst;
{
--- 389,395 ----
static void
avr_info_to_howto_rela (abfd, cache_ptr, dst)
! bfd *abfd ATTRIBUTE_UNUSED;
arelent *cache_ptr;
Elf32_Internal_Rela *dst;
{
*************** avr_info_to_howto_rela (abfd, cache_ptr,
*** 403,409 ****
static asection *
elf32_avr_gc_mark_hook (abfd, info, rel, h, sym)
bfd *abfd;
! struct bfd_link_info *info;
Elf_Internal_Rela *rel;
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
--- 403,409 ----
static asection *
elf32_avr_gc_mark_hook (abfd, info, rel, h, sym)
bfd *abfd;
! struct bfd_link_info *info ATTRIBUTE_UNUSED;
Elf_Internal_Rela *rel;
struct elf_link_hash_entry *h;
Elf_Internal_Sym *sym;
*************** elf32_avr_gc_mark_hook (abfd, info, rel,
*** 442,451 ****
static boolean
elf32_avr_gc_sweep_hook (abfd, info, sec, relocs)
! bfd *abfd;
! struct bfd_link_info *info;
! asection *sec;
! const Elf_Internal_Rela *relocs;
{
/* We don't use got and plt entries for avr. */
return true;
--- 442,451 ----
static boolean
elf32_avr_gc_sweep_hook (abfd, info, sec, relocs)
! bfd *abfd ATTRIBUTE_UNUSED;
! struct bfd_link_info *info ATTRIBUTE_UNUSED;
! asection *sec ATTRIBUTE_UNUSED;
! const Elf_Internal_Rela *relocs ATTRIBUTE_UNUSED;
{
/* We don't use got and plt entries for avr. */
return true;
*************** avr_final_link_relocate (howto, input_bf
*** 717,723 ****
static boolean
elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
! bfd *output_bfd;
struct bfd_link_info *info;
bfd *input_bfd;
asection *input_section;
--- 717,723 ----
static boolean
elf32_avr_relocate_section (output_bfd, info, input_bfd, input_section,
contents, relocs, local_syms, local_sections)
! bfd *output_bfd ATTRIBUTE_UNUSED;
struct bfd_link_info *info;
bfd *input_bfd;
asection *input_section;
diff -Nrc3p orig/src/gas/config/tc-avr.c src/gas/config/tc-avr.c
*** orig/src/gas/config/tc-avr.c Tue Jun 27 08:20:24 2000
--- src/gas/config/tc-avr.c Mon Jul 3 15:07:19 2000
*************** static struct mcu_type_s mcu_types[] =
*** 96,101 ****
--- 96,111 ----
static struct mcu_type_s default_mcu = {"avr2", AVR_ISA_2xxx,bfd_mach_avr2};
static struct mcu_type_s *avr_mcu = &default_mcu;
+ /* AVR target-specific switches. */
+ struct avr_opt_s
+ {
+ int all_opcodes; /* -mall-opcodes: accept all known AVR opcodes */
+ int no_skip_bug; /* -mno-skip-bug: no warnings for skipping 2-word insns */
+ int no_wrap; /* -mno-wrap: reject rjmp/rcall with 8K wrap-around */
+ };
+
+ static struct avr_opt_s avr_opt = { 0, 0, 0 };
+
const char EXP_CHARS[] = "eE";
const char FLT_CHARS[] = "dD";
static void avr_set_arch (int dummy);
*************** const pseudo_typeS md_pseudo_table[] =
*** 109,114 ****
--- 119,125 ----
#define LDI_IMMEDIATE(x) (((x) & 0xf) | (((x) << 4) & 0xf00))
+ static void show_mcu_list (FILE *stream);
static char * skip_space (char * s);
static char * extract_word (char *from, char *to, int limit);
static unsigned int avr_operand (struct avr_opcodes_s *opcode,
*************** static struct hash_control *avr_hash;
*** 150,163 ****
/* Reloc modifiers hash control (hh8,hi8,lo8,pm_xx). */
static struct hash_control *avr_mod_hash;
! #define OPTION_MMCU (OPTION_MD_BASE + 1)
struct option md_longopts[] = {
! {"mmcu", required_argument, NULL, 'm'},
! {NULL, no_argument, NULL, 0}
};
size_t md_longopts_size = sizeof(md_longopts);
static inline char *
skip_space (s)
char * s;
--- 161,207 ----
/* Reloc modifiers hash control (hh8,hi8,lo8,pm_xx). */
static struct hash_control *avr_mod_hash;
! #define OPTION_MMCU 'm'
! #define OPTION_ALL_OPCODES (OPTION_MD_BASE + 1)
! #define OPTION_NO_SKIP_BUG (OPTION_MD_BASE + 2)
! #define OPTION_NO_WRAP (OPTION_MD_BASE + 3)
struct option md_longopts[] = {
! { "mmcu", required_argument, NULL, OPTION_MMCU },
! { "mall-opcodes", no_argument, NULL, OPTION_ALL_OPCODES },
! { "mno-skip-bug", no_argument, NULL, OPTION_NO_SKIP_BUG },
! { "mno-wrap", no_argument, NULL, OPTION_NO_WRAP },
! { NULL, no_argument, NULL, 0 }
};
size_t md_longopts_size = sizeof(md_longopts);
+
+ /* Display nicely formatted list of known MCU names. */
+ static void
+ show_mcu_list (FILE *stream)
+ {
+ int i, x;
+
+ fprintf (stream, _("Known MCU names:"));
+ x = 1000;
+ for (i = 0; mcu_types[i].name; i++)
+ {
+ int len = strlen (mcu_types[i].name);
+ x += len + 1;
+ if (x < 75)
+ {
+ fprintf (stream, " %s", mcu_types[i].name);
+ }
+ else
+ {
+ fprintf (stream, "\n %s", mcu_types[i].name);
+ x = len + 2;
+ }
+ }
+ fprintf (stream, "\n");
+ }
+
+
static inline char *
skip_space (s)
char * s;
*************** void
*** 202,210 ****
md_show_usage (stream)
FILE *stream;
{
! fprintf
! (stream,
! _ ("AVR options:\n"
" -mmcu=[avr-name] select microcontroller variant\n"
" [avr-name] can be:\n"
" avr1 - AT90S1200, ATtiny1x, ATtiny28\n"
--- 246,253 ----
md_show_usage (stream)
FILE *stream;
{
! fprintf (stream,
! _("AVR options:\n"
" -mmcu=[avr-name] select microcontroller variant\n"
" [avr-name] can be:\n"
" avr1 - AT90S1200, ATtiny1x, ATtiny28\n"
*************** md_show_usage (stream)
*** 213,218 ****
--- 256,268 ----
" avr4 - ATmega83, ATmega85\n"
" avr5 - ATmega161, ATmega163, ATmega32, AT94K\n"
" or immediate microcontroller name.\n"));
+ fprintf (stream,
+ _(" -mall-opcodes accept all AVR opcodes, even if not supported by MCU\n"
+ " -mno-skip-bug disable warnings for skipping two-word instructions\n"
+ " (default for avr4, avr5)\n"
+ " -mno-wrap reject rjmp/rcall instructions with 8K wrap-around\n"
+ " (default for avr3, avr5)\n"));
+ show_mcu_list (stream);
}
static void
*************** avr_set_arch (dummy)
*** 222,228 ****
char * str;
str = (char *)alloca (20);
input_line_pointer = extract_word (input_line_pointer, str, 20);
! md_parse_option ('m', str);
bfd_set_arch_mach (stdoutput, TARGET_ARCH, avr_mcu->mach);
}
--- 272,278 ----
char * str;
str = (char *)alloca (20);
input_line_pointer = extract_word (input_line_pointer, str, 20);
! md_parse_option (OPTION_MMCU, str);
bfd_set_arch_mach (stdoutput, TARGET_ARCH, avr_mcu->mach);
}
*************** md_parse_option (c, arg)
*** 231,263 ****
int c;
char *arg;
{
! char *t = alloca (strlen (arg) + 1);
! char *s = t;
! char *arg1 = arg;
! do
! *t = tolower (*arg1++);
! while (*t++);
!
! if (c == 'm')
{
! int i;
! for (i = 0; mcu_types[i].name; ++i)
! if (strcmp (mcu_types[i].name, s) == 0)
! break;
! if (!mcu_types[i].name)
! as_fatal (_ ("unknown MCU: %s\n"), arg);
! /* It is OK to redefine mcu type within the same avr[1-5] bfd machine
! type - this for allows passing -mmcu=... via gcc ASM_SPEC as well
! as .arch ... in the asm output at the same time. */
! if (avr_mcu == &default_mcu || avr_mcu->mach == mcu_types[i].mach)
! avr_mcu = &mcu_types[i];
! else
! as_fatal (_ ("redefinition of mcu type `%s' to `%s'"),
! avr_mcu->name, mcu_types[i].name);
return 1;
}
return 0;
--- 281,331 ----
int c;
char *arg;
{
! switch (c)
{
! case OPTION_MMCU:
! {
! int i;
! char *s = alloca (strlen (arg) + 1);
! {
! char *t = s;
! char *arg1 = arg;
! do
! *t = tolower(*arg1++);
! while (*t++);
! }
! for (i = 0; mcu_types[i].name; ++i)
! if (strcmp (mcu_types[i].name, s) == 0)
! break;
! if (!mcu_types[i].name)
! {
! show_mcu_list (stderr);
! as_fatal (_("unknown MCU: %s\n"), arg);
! }
!
! /* It is OK to redefine mcu type within the same avr[1-5] bfd machine
! type - this for allows passing -mmcu=... via gcc ASM_SPEC as well
! as .arch ... in the asm output at the same time. */
!
! if (avr_mcu == &default_mcu || avr_mcu->mach == mcu_types[i].mach)
! avr_mcu = &mcu_types[i];
! else
! as_fatal (_("redefinition of mcu type `%s' to `%s'"),
! avr_mcu->name, mcu_types[i].name);
! return 1;
! }
! case OPTION_ALL_OPCODES:
! avr_opt.all_opcodes = 1;
! return 1;
! case OPTION_NO_SKIP_BUG:
! avr_opt.no_skip_bug = 1;
! return 1;
! case OPTION_NO_WRAP:
! avr_opt.no_wrap = 1;
return 1;
}
return 0;
*************** avr_operands (opcode, line)
*** 413,419 ****
str = skip_space (str);
if (*str++ != ',')
! as_bad (_ ("`,' required"));
str = skip_space (str);
reg2 = avr_operand (opcode, where, op, &str);
--- 481,487 ----
str = skip_space (str);
if (*str++ != ',')
! as_bad (_("`,' required"));
str = skip_space (str);
reg2 = avr_operand (opcode, where, op, &str);
*************** avr_operands (opcode, line)
*** 429,450 ****
bin |= reg1 | reg2;
}
! /* detect undefined combinations (like lpm r31,Z+) */
! if (((bin & 0xFDEF) == 0x91AD) || ((bin & 0xFDEF) == 0x91AE) ||
! ((bin & 0xFDEF) == 0x91C9) || ((bin & 0xFDEF) == 0x91CA) ||
! ((bin & 0xFDEF) == 0x91E1) || ((bin & 0xFDEF) == 0x91E2) ||
! ((bin & 0xFFED) == 0x91E5))
! as_warn( _("undefined combination of operands"));
!
if (opcode->insn_size == 2)
{
! /* warn if previous opcode was cpse/sbic/sbis/sbrc/sbrs
! (AVR core bug) */
! if ((prev & 0xFC00) == 0x1000
! || (prev & 0xFD00) == 0x9900
! || (prev & 0xFC08) == 0xFC00)
! as_warn (_("skipping two-word instruction"));
!
bfd_putl32 ((bfd_vma)bin, frag);
}
else
--- 497,525 ----
bin |= reg1 | reg2;
}
! if (!avr_opt.all_opcodes)
! {
! /* Detect undefined combinations (like ld r31,Z+). */
! if (((bin & 0xFDEF) == 0x91AD) || ((bin & 0xFDEF) == 0x91AE) ||
! ((bin & 0xFDEF) == 0x91C9) || ((bin & 0xFDEF) == 0x91CA) ||
! ((bin & 0xFDEF) == 0x91E1) || ((bin & 0xFDEF) == 0x91E2) ||
! ((bin & 0xFFED) == 0x91E5))
! as_warn (_("undefined combination of operands"));
! }
!
if (opcode->insn_size == 2)
{
! /* Warn if the previous opcode was cpse/sbic/sbis/sbrc/sbrs
! (AVR core bug, fixed in the newer devices). */
!
! if (!((avr_mcu->isa & AVR_ISA_MUL) || avr_opt.no_skip_bug))
! {
! if ((prev & 0xFC00) == 0x1000
! || (prev & 0xFD00) == 0x9900
! || (prev & 0xFC08) == 0xFC00)
! as_warn (_("skipping two-word instruction"));
! }
!
bfd_putl32 ((bfd_vma)bin, frag);
}
else
*************** avr_operand (opcode, where, op, line)
*** 508,539 ****
{
case 'a':
if (op_mask < 16 || op_mask > 23)
! as_bad (_ ("register r16-r23 required"));
op_mask -= 16;
break;
case 'd':
if (op_mask < 16)
! as_bad (_ ("register number above 15 required"));
op_mask -= 16;
break;
case 'v':
if (op_mask & 1)
! as_bad (_ ("even register number required"));
op_mask >>= 1;
break;
case 'w':
op_mask -= 24;
if (op_mask & 1 || op_mask > 6)
! as_bad (_ ("register r24,r26,r28 or r30 required"));
op_mask >>= 1;
break;
}
break;
}
! as_bad (_ ("register name or number from 0 to 31 required"));
}
break;
--- 583,614 ----
{
case 'a':
if (op_mask < 16 || op_mask > 23)
! as_bad (_("register r16-r23 required"));
op_mask -= 16;
break;
case 'd':
if (op_mask < 16)
! as_bad (_("register number above 15 required"));
op_mask -= 16;
break;
case 'v':
if (op_mask & 1)
! as_bad (_("even register number required"));
op_mask >>= 1;
break;
case 'w':
op_mask -= 24;
if (op_mask & 1 || op_mask > 6)
! as_bad (_("register r24, r26, r28 or r30 required"));
op_mask >>= 1;
break;
}
break;
}
! as_bad (_("register name or number from 0 to 31 required"));
}
break;
*************** avr_operand (opcode, where, op, line)
*** 551,582 ****
else if (c == 'y')
op_mask |= 0x8;
else if (c != 'z')
! as_bad (_ ("pointer register (X,Y or Z) required"));
str = skip_space (str+1);
if (*str == '+')
{
++str;
if (op_mask & 2)
! as_bad (_ ("cannot both predecrement and postincrement"));
op_mask |= 0x1001;
}
/* avr1 can do "ld r,Z" and "st Z,r" but no other pointer
registers, no predecrement, no postincrement. */
! if ((op_mask & 0x100F) && !(avr_mcu->isa & AVR_ISA_SRAM))
! as_bad (_ ("addressing mode not supported"));
}
break;
case 'z':
{
if (*str == '-')
! as_bad (_ ("can't predecrement"));
if (! (*str == 'z' || *str == 'Z'))
! as_bad (_ ("pointer register Z required"));
str = skip_space (str + 1);
if (*str == '+')
--- 626,658 ----
else if (c == 'y')
op_mask |= 0x8;
else if (c != 'z')
! as_bad (_("pointer register (X, Y or Z) required"));
str = skip_space (str+1);
if (*str == '+')
{
++str;
if (op_mask & 2)
! as_bad (_("cannot both predecrement and postincrement"));
op_mask |= 0x1001;
}
/* avr1 can do "ld r,Z" and "st Z,r" but no other pointer
registers, no predecrement, no postincrement. */
! if (!avr_opt.all_opcodes && (op_mask & 0x100F)
! && !(avr_mcu->isa & AVR_ISA_SRAM))
! as_bad (_("addressing mode not supported"));
}
break;
case 'z':
{
if (*str == '-')
! as_bad (_("can't predecrement"));
if (! (*str == 'z' || *str == 'Z'))
! as_bad (_("pointer register Z required"));
str = skip_space (str + 1);
if (*str == '+')
*************** avr_operand (opcode, where, op, line)
*** 593,599 ****
if (c == 'y')
op_mask |= 0x8;
else if (c != 'z')
! as_bad (_ ("pointer register (Y or Z) required"));
str = skip_space (str);
if (*str++ == '+')
{
--- 669,675 ----
if (c == 'y')
op_mask |= 0x8;
else if (c != 'z')
! as_bad (_("pointer register (Y or Z) required"));
str = skip_space (str);
if (*str++ == '+')
{
*************** avr_operand (opcode, where, op, line)
*** 702,708 ****
case '?':
break;
default:
! as_bad (_ ("unknown constraint `%c'"), *op);
}
*line = str;
return op_mask;
--- 778,784 ----
case '?':
break;
default:
! as_bad (_("unknown constraint `%c'"), *op);
}
*line = str;
return op_mask;
*************** md_apply_fix3 (fixp, valuep, seg)
*** 778,784 ****
{
/* We don't actually support subtracting a symbol. */
as_bad_where (fixp->fx_file, fixp->fx_line,
! _ ("expression too complex"));
}
}
}
--- 854,860 ----
{
/* We don't actually support subtracting a symbol. */
as_bad_where (fixp->fx_file, fixp->fx_line,
! _("expression too complex"));
}
}
}
*************** md_apply_fix3 (fixp, valuep, seg)
*** 829,835 ****
if (value < -2048 || value > 2047)
{
/* No wrap for devices with >8K of program memory. */
! if (avr_mcu->isa & AVR_ISA_MEGA)
as_bad_where (fixp->fx_file, fixp->fx_line,
_("operand out of range: %ld"), value);
}
--- 905,911 ----
if (value < -2048 || value > 2047)
{
/* No wrap for devices with >8K of program memory. */
! if ((avr_mcu->isa & AVR_ISA_MEGA) || avr_opt.no_wrap)
as_bad_where (fixp->fx_file, fixp->fx_line,
_("operand out of range: %ld"), value);
}
*************** md_assemble (str)
*** 1007,1019 ****
str = skip_space (extract_word (str, op, sizeof(op)));
if (!op[0])
! as_bad (_ ("can't find opcode "));
opcode = (struct avr_opcodes_s *) hash_find (avr_hash, op);
if (opcode == NULL)
{
! as_bad (_ ("unknown opcode `%s'"), op);
return;
}
--- 1083,1095 ----
str = skip_space (extract_word (str, op, sizeof(op)));
if (!op[0])
! as_bad (_("can't find opcode "));
opcode = (struct avr_opcodes_s *) hash_find (avr_hash, op);
if (opcode == NULL)
{
! as_bad (_("unknown opcode `%s'"), op);
return;
}
*************** md_assemble (str)
*** 1023,1030 ****
if (*str && *opcode->constraints == '?')
++opcode;
! if ((opcode->isa & avr_mcu->isa) != opcode->isa)
! as_bad (_ ("illegal opcode %s for mcu %s"), opcode->name, avr_mcu->name);
/* We used to set input_line_pointer to the result of get_operands,
but that is wrong. Our caller assumes we don't change it. */
--- 1099,1106 ----
if (*str && *opcode->constraints == '?')
++opcode;
! if (!avr_opt.all_opcodes && (opcode->isa & avr_mcu->isa) != opcode->isa)
! as_bad (_("illegal opcode %s for mcu %s"), opcode->name, avr_mcu->name);
/* We used to set input_line_pointer to the result of get_operands,
but that is wrong. Our caller assumes we don't change it. */
*************** md_assemble (str)
*** 1032,1038 ****
char *t = input_line_pointer;
avr_operands (opcode, &str);
if (*skip_space (str))
! as_bad (_ ("garbage at end of line"));
input_line_pointer = t;
}
}
--- 1108,1114 ----
char *t = input_line_pointer;
avr_operands (opcode, &str);
if (*skip_space (str))
! as_bad (_("garbage at end of line"));
input_line_pointer = t;
}
}
*************** avr_ldi_expression (exp)
*** 1090,1096 ****
++closes;
}
else
! as_bad (_ ("illegal expression"));
if (*str == '-')
{
neg_p = 1;
--- 1166,1172 ----
++closes;
}
else
! as_bad (_("illegal expression"));
if (*str == '-')
{
neg_p = 1;
*************** avr_ldi_expression (exp)
*** 1112,1118 ****
{
if (*input_line_pointer != ')')
{
! as_bad (_ ("`)' required"));
break;
}
input_line_pointer++;
--- 1188,1194 ----
{
if (*input_line_pointer != ')')
{
! as_bad (_("`)' required"));
break;
}
input_line_pointer++;
*************** avr_ldi_expression (exp)
*** 1124,1129 ****
--- 1200,1216 ----
}
input_line_pointer = tmp;
expression (exp);
+
+ /* Warn about expressions that fail to use lo8(). */
+ if (exp->X_op == O_constant)
+ {
+ int x = exp->X_add_number;
+ if (x < -255 || x > 255)
+ as_warn (_("constant out of 8-bit range: %d"), x);
+ }
+ else
+ as_warn (_("expression possibly out of 8-bit range"));
+
return BFD_RELOC_AVR_LO8_LDI;
}
*************** avr_parse_cons_expression (exp, nbytes)
*** 1161,1167 ****
++input_line_pointer;
else
{
! as_bad (_ ("`)' required"));
exp_mod_pm = 0;
}
return;
--- 1248,1254 ----
++input_line_pointer;
else
{
! as_bad (_("`)' required"));
exp_mod_pm = 0;
}
return;
*************** avr_cons_fix_new(frag, where, nbytes, ex
*** 1186,1199 ****
else if (nbytes == 4)
fix_new_exp (frag, where, nbytes, exp, false, BFD_RELOC_32);
else
! as_bad (_ ("illegal %srelocation size: %d"), "", nbytes);
}
else
{
if (nbytes == 2)
fix_new_exp (frag, where, nbytes, exp, false, BFD_RELOC_AVR_16_PM);
else
! as_bad (_ ("illegal %srelocation size: %d"), "`pm' ", nbytes);
exp_mod_pm = 0;
}
}
--- 1273,1286 ----
else if (nbytes == 4)
fix_new_exp (frag, where, nbytes, exp, false, BFD_RELOC_32);
else
! as_bad (_("illegal %srelocation size: %d"), "", nbytes);
}
else
{
if (nbytes == 2)
fix_new_exp (frag, where, nbytes, exp, false, BFD_RELOC_AVR_16_PM);
else
! as_bad (_("illegal %srelocation size: %d"), "`pm' ", nbytes);
exp_mod_pm = 0;
}
}
diff -Nrc3p orig/src/gas/config/tc-avr.h src/gas/config/tc-avr.h
*** orig/src/gas/config/tc-avr.h Mon Mar 27 10:39:13 2000
--- src/gas/config/tc-avr.h Mon Jul 3 15:35:46 2000
*************** void avr_cons_fix_new(fragS *frag,int wh
*** 108,113 ****
--- 108,115 ----
of a PC relative instruction is the next instruction, so this
macro would return the length of an instruction. */
+ extern long md_pcrel_from_section PARAMS ((struct fix *, segT));
+
#define LISTING_WORD_SIZE 2
/* The number of bytes to put into a word in a listing. This affects
the way the bytes are clumped together in the listing. For
diff -Nrc3p orig/src/opcodes/avr-dis.c src/opcodes/avr-dis.c
*** orig/src/opcodes/avr-dis.c Mon Jun 12 07:44:51 2000
--- src/opcodes/avr-dis.c Mon Jul 3 13:40:59 2000
*************** avr_operand (insn, insn2, pc, constraint
*** 103,109 ****
case 0: *buf++ = 'Z'; break;
case 2: *buf++ = 'Y'; break;
case 3: *buf++ = 'X'; break;
! default: buf += sprintf (buf, _ (" unknown register ")); break;
}
if (insn & 0x1)
*buf++ = '+';
--- 103,109 ----
case 0: *buf++ = 'Z'; break;
case 2: *buf++ = 'Y'; break;
case 3: *buf++ = 'X'; break;
! default: buf += sprintf (buf, _(" unknown register ")); break;
}
if (insn & 0x1)
*buf++ = '+';
*************** avr_operand (insn, insn2, pc, constraint
*** 165,171 ****
break;
case 'n':
! sprintf (buf, _ ("Internal disassembler error"));
break;
case 'K':
--- 165,171 ----
break;
case 'n':
! sprintf (buf, _("Internal disassembler error"));
break;
case 'K':
*************** avr_operand (insn, insn2, pc, constraint
*** 205,211 ****
break;
default:
! sprintf (buf, _ ("unknown constraint `%c'"), constraint);
}
}
--- 205,211 ----
break;
default:
! sprintf (buf, _("unknown constraint `%c'"), constraint);
}
}
*************** print_insn_avr(addr, info)
*** 280,285 ****
--- 280,286 ----
op2[0] = 0;
comment1[0] = 0;
comment2[0] = 0;
+ insn2 = 0;
if (opcode->insn_size > 1)
{
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] avr-binutils changes
@ 2000-06-26 18:48 Nick Clifton
0 siblings, 0 replies; 4+ messages in thread
From: Nick Clifton @ 2000-06-26 18:48 UTC (permalink / raw)
To: marekm; +Cc: denisc, binutils, avr
Hi Marek,
: bfd/ChangeLog:
:
: 2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
:
: * archures.c (bfd_mach_avr5): Define.
: * bfd-in2.h (bfd_mach_avr5): Define.
: * cpu-avr.c (arch_info_struct): Rename bfd_mach_avr4 to
: bfd_mach_avr5, add bfd_mach_avr4. Update comments.
: (compatible): Update comment. Add missing test.
: * elf32-avr.c (avr_final_link_relocate): Support 8K wrap
: for avr2 and avr4. Simplify 8K wrap code.
: (bfd_elf_avr_final_write_processing): Recognize bfd_mach_avr5.
: (elf32_avr_object_p): Recognize E_AVR_MACH_AVR5.
:
:
: gas/ChangeLog:
:
: 2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
:
: * config/tc-avr.c (mcu_types): Rename avr4 to avr5, add avr4.
: Add more MCU types for avr4 and avr5. Replace at94k{10,20,40}
: with just at94k. Change AVR_ISA_85xx back to AVR_ISA_2xxx.
: (md_show_usage): Update usage message.
: (md_parse_option): Allow redefinition of MCU type within the
: same avr[1-5] bfd machine type. Show both old and new MCU type
: in the error message.
: (md_apply_fix3): Support 8K wrap if AVR_ISA_MEGA is not set.
: Simplify 8K wrap code.
:
:
: include/elf/ChangeLog:
:
: 2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
:
: * avr.h (E_AVR_MACH_AVR5): Define.
:
:
: include/opcode/ChangeLog:
:
: 2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
:
: * avr.h (AVR_ISA_WRAP): Remove, now assumed if not AVR_ISA_MEGA.
: (AVR_ISA_ESPM): Remove, because ESPM removed in databook update.
: (AVR_ISA_85xx): Remove, all uses changed back to AVR_ISA_2xxx.
: (AVR_ISA_M83): Define for ATmega83, ATmega85.
: (espm): Remove, because ESPM removed in databook update.
: (eicall, eijmp): Move to the end of opcode table.
:
:
: ld/ChangeLog:
:
: 2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
:
: * emulparams/avrmega161.sh (ARCH): Change to avr:5.
Accepted and applied.
Cheers
Nick
^ permalink raw reply [flat|nested] 4+ messages in thread
* [patch] avr-binutils changes
@ 2000-06-26 11:52 Marek Michalkiewicz
0 siblings, 0 replies; 4+ messages in thread
From: Marek Michalkiewicz @ 2000-06-26 11:52 UTC (permalink / raw)
To: denisc; +Cc: binutils, avr
Below is a patch for binutils on AVR target. It is quite big -
sorry about that, but (as with my recent avr-gcc patch, applied
now - big thanks, Denis!) there are more changes to come...
Changes in this patch include:
- support for more new MCU types, replace at94k{10,20,40} with
just at94k (the AVR core is the same, only the FPGA differs).
New avr5 machine type, and bug fix for compatible().
- simplified 8K wrap handling: no separate flag, instead simply
no wrap for >8K devices. Also no need to add +/-4096 to the
jump address that is bitwise-ANDed with 0xFFF later anyway.
(To do: the assembler should mark any rjmp/rcall known to wrap
with a special relocation, the linker should report an error if
it sees this in the object file when linking for >8K devices.
Just a suggestion, not sure if I can do it myself...)
- support for future avr-gcc changes (ASM_SPEC will pass -mmcu=...
so there will be no need to pass it separately via -Wa,-mmcu=...
when preprocessing asm source), avoid "redefinition of mcu type"
gas error messages when compiling C code.
- "espm" instruction removed, following recent AVR documentation
update ( http://www.atmel.com/atmel/acrobat/databook.pdf ).
Other opcodes for devices that don't exist yet (eicall, eijmp)
moved to the end of the table - just to make it clear that the
comment above refers only to these two opcodes.
I have tried to maintain backward compatibility, so there is no need
to upgrade avr-gcc immediately. But some of my future avr-gcc patches
may require avr-binutils with this patch applied.
The avr4 bfd machine type is renamed to avr5 for consistency.
Now the bfd types are as follows:
- avr1: <=2K, no RAM, assembler only
- avr2: <=8K, old core
- avr3: >8K, old core
- avr4: <=8K, new core (new)
- avr5: >8K, new core (used to be avr4)
(the order is now so that lower numbered machines are subsets of
higher numbered ones, except avr3/avr4).
Hopefully this will not cause too many problems, as no avr4 or avr5
devices are really available yet (without NDA that is). I haven't
yet added new ld emulations and scripts for all the new devices.
(Maybe we need just one emulation for each avr[1-5] machine type,
and possibly the "INCLUDE memory.x" trick from the 68hc11 port?)
I know bfd/bfd-in2.h should be regenerated, but I had some trouble
with it so I patched it instead (just one line added).
As usual, please review. Suggestions are always welcome.
Thanks, and keep up the good work!
Marek
bfd/ChangeLog:
2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
* archures.c (bfd_mach_avr5): Define.
* bfd-in2.h (bfd_mach_avr5): Define.
* cpu-avr.c (arch_info_struct): Rename bfd_mach_avr4 to
bfd_mach_avr5, add bfd_mach_avr4. Update comments.
(compatible): Update comment. Add missing test.
* elf32-avr.c (avr_final_link_relocate): Support 8K wrap
for avr2 and avr4. Simplify 8K wrap code.
(bfd_elf_avr_final_write_processing): Recognize bfd_mach_avr5.
(elf32_avr_object_p): Recognize E_AVR_MACH_AVR5.
gas/ChangeLog:
2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
* config/tc-avr.c (mcu_types): Rename avr4 to avr5, add avr4.
Add more MCU types for avr4 and avr5. Replace at94k{10,20,40}
with just at94k. Change AVR_ISA_85xx back to AVR_ISA_2xxx.
(md_show_usage): Update usage message.
(md_parse_option): Allow redefinition of MCU type within the
same avr[1-5] bfd machine type. Show both old and new MCU type
in the error message.
(md_apply_fix3): Support 8K wrap if AVR_ISA_MEGA is not set.
Simplify 8K wrap code.
include/elf/ChangeLog:
2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
* avr.h (E_AVR_MACH_AVR5): Define.
include/opcode/ChangeLog:
2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
* avr.h (AVR_ISA_WRAP): Remove, now assumed if not AVR_ISA_MEGA.
(AVR_ISA_ESPM): Remove, because ESPM removed in databook update.
(AVR_ISA_85xx): Remove, all uses changed back to AVR_ISA_2xxx.
(AVR_ISA_M83): Define for ATmega83, ATmega85.
(espm): Remove, because ESPM removed in databook update.
(eicall, eijmp): Move to the end of opcode table.
ld/ChangeLog:
2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
* emulparams/avrmega161.sh (ARCH): Change to avr:5.
diff -Nrc3p orig/src/bfd/archures.c src/bfd/archures.c
*** orig/src/bfd/archures.c Tue Jun 20 07:59:05 2000
--- src/bfd/archures.c Mon Jun 26 11:28:07 2000
*************** DESCRIPTION
*** 229,234 ****
--- 229,235 ----
.#define bfd_mach_avr2 2
.#define bfd_mach_avr3 3
.#define bfd_mach_avr4 4
+ .#define bfd_mach_avr5 5
. bfd_arch_last
. };
diff -Nrc3p orig/src/bfd/bfd-in2.h src/bfd/bfd-in2.h
*** orig/src/bfd/bfd-in2.h Tue Jun 20 07:59:08 2000
--- src/bfd/bfd-in2.h Mon Jun 26 11:30:05 2000
*************** enum bfd_architecture
*** 1468,1473 ****
--- 1468,1474 ----
#define bfd_mach_avr2 2
#define bfd_mach_avr3 3
#define bfd_mach_avr4 4
+ #define bfd_mach_avr5 5
bfd_arch_last
};
diff -Nrc3p orig/src/bfd/cpu-avr.c src/bfd/cpu-avr.c
*** orig/src/bfd/cpu-avr.c Thu Jun 8 08:11:27 2000
--- src/bfd/cpu-avr.c Mon Jun 26 11:36:01 2000
*************** static const bfd_arch_info_type *compati
*** 45,61 ****
static const bfd_arch_info_type arch_info_struct[] =
{
! /* AT90S1200 */
N (16, bfd_mach_avr1, "avr:1", false, & arch_info_struct[1]),
! /* AT90S2xxx, AT90S4xxx, AT90S81xx, ATtiny22 */
N (16, bfd_mach_avr2, "avr:2", false, & arch_info_struct[2]),
/* ATmega103, ATmega603 */
N (22, bfd_mach_avr3, "avr:3", false, & arch_info_struct[3]),
! /* ATmega161 */
! N (16, bfd_mach_avr4, "avr:4", false, NULL)
};
const bfd_arch_info_type bfd_avr_arch =
--- 45,64 ----
static const bfd_arch_info_type arch_info_struct[] =
{
! /* AT90S1200, ATtiny1x, ATtiny28 */
N (16, bfd_mach_avr1, "avr:1", false, & arch_info_struct[1]),
! /* AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22 */
N (16, bfd_mach_avr2, "avr:2", false, & arch_info_struct[2]),
/* ATmega103, ATmega603 */
N (22, bfd_mach_avr3, "avr:3", false, & arch_info_struct[3]),
! /* ATmega83, ATmega85 */
! N (16, bfd_mach_avr4, "avr:4", false, & arch_info_struct[4]),
!
! /* ATmega161, ATmega163, ATmega32, AT94K */
! N (22, bfd_mach_avr5, "avr:5", false, NULL)
};
const bfd_arch_info_type bfd_avr_arch =
*************** compatible (a,b)
*** 74,80 ****
if (a->arch != b->arch)
return NULL;
! /* Special case for ATmega[16]03 (avr:3) and ATmega161 (avr:4). */
if ((a->mach == 3 && b->mach == 4)
|| (a->mach == 4 && b->mach == 3))
return NULL;
--- 77,83 ----
if (a->arch != b->arch)
return NULL;
! /* Special case for ATmega[16]03 (avr:3) and ATmega83 (avr:4). */
if ((a->mach == 3 && b->mach == 4)
|| (a->mach == 4 && b->mach == 3))
return NULL;
*************** compatible (a,b)
*** 83,88 ****
--- 86,94 ----
cores. */
if (a->mach <= b->mach)
return b;
+
+ if (a->mach >= b->mach)
+ return a;
/* Never reached! */
return NULL;
diff -Nrc3p orig/src/bfd/elf32-avr.c src/bfd/elf32-avr.c
*** orig/src/bfd/elf32-avr.c Thu Jun 8 08:11:29 2000
--- src/bfd/elf32-avr.c Mon Jun 26 11:44:03 2000
*************** avr_final_link_relocate (howto, input_bf
*** 548,562 ****
if (srel < -2048 || srel > 2047)
{
/* Apply WRAPAROUND if possible. */
! if (bfd_get_mach (input_bfd) == bfd_mach_avr2)
{
! if (srel > 2047)
! srel -= 4096;
! else
! srel += 4096;
}
- else
- return bfd_reloc_overflow;
}
x = bfd_get_16 (input_bfd, contents);
--- 548,562 ----
if (srel < -2048 || srel > 2047)
{
/* Apply WRAPAROUND if possible. */
! switch (bfd_get_mach (input_bfd))
{
! case bfd_mach_avr2:
! case bfd_mach_avr4:
! break;
!
! default:
! return bfd_reloc_overflow;
}
}
x = bfd_get_16 (input_bfd, contents);
*************** bfd_elf_avr_final_write_processing (abfd
*** 899,904 ****
--- 899,907 ----
val = E_AVR_MACH_AVR4;
break;
+ case bfd_mach_avr5:
+ val = E_AVR_MACH_AVR5;
+ break;
}
elf_elfheader (abfd)->e_machine = EM_AVR;
*************** elf32_avr_object_p (abfd)
*** 933,938 ****
--- 936,945 ----
case E_AVR_MACH_AVR4:
e_set = bfd_mach_avr4;
+ break;
+
+ case E_AVR_MACH_AVR5:
+ e_set = bfd_mach_avr5;
break;
}
}
diff -Nrc3p orig/src/gas/config/tc-avr.c src/gas/config/tc-avr.c
*** orig/src/gas/config/tc-avr.c Thu Jun 8 08:11:50 2000
--- src/gas/config/tc-avr.c Mon Jun 26 12:50:11 2000
*************** struct mcu_type_s
*** 59,67 ****
static struct mcu_type_s mcu_types[] =
{
{"avr1", AVR_ISA_TINY1, bfd_mach_avr1},
! {"avr2", AVR_ISA_85xx, bfd_mach_avr2},
{"avr3", AVR_ISA_M103, bfd_mach_avr3},
! {"avr4", AVR_ISA_ALL, bfd_mach_avr4},
{"at90s1200", AVR_ISA_1200, bfd_mach_avr1},
{"attiny10", AVR_ISA_TINY1, bfd_mach_avr1},
{"attiny11", AVR_ISA_TINY1, bfd_mach_avr1},
--- 59,68 ----
static struct mcu_type_s mcu_types[] =
{
{"avr1", AVR_ISA_TINY1, bfd_mach_avr1},
! {"avr2", AVR_ISA_2xxx, bfd_mach_avr2},
{"avr3", AVR_ISA_M103, bfd_mach_avr3},
! {"avr4", AVR_ISA_M83, bfd_mach_avr4},
! {"avr5", AVR_ISA_ALL, bfd_mach_avr5},
{"at90s1200", AVR_ISA_1200, bfd_mach_avr1},
{"attiny10", AVR_ISA_TINY1, bfd_mach_avr1},
{"attiny11", AVR_ISA_TINY1, bfd_mach_avr1},
*************** static struct mcu_type_s mcu_types[] =
*** 76,90 ****
{"at90s4433", AVR_ISA_2xxx, bfd_mach_avr2},
{"at90s4414", AVR_ISA_2xxx, bfd_mach_avr2},
{"at90s4434", AVR_ISA_2xxx, bfd_mach_avr2},
! {"at90s8515", AVR_ISA_85xx, bfd_mach_avr2},
! {"at90s8535", AVR_ISA_85xx, bfd_mach_avr2},
! {"at90c8534", AVR_ISA_85xx, bfd_mach_avr2},
{"atmega603", AVR_ISA_M603, bfd_mach_avr3},
{"atmega103", AVR_ISA_M103, bfd_mach_avr3},
! {"atmega161", AVR_ISA_M161, bfd_mach_avr4},
! {"at94k10", AVR_ISA_94K, bfd_mach_avr4},
! {"at94k20", AVR_ISA_94K, bfd_mach_avr4},
! {"at94k40", AVR_ISA_94K, bfd_mach_avr4},
{NULL, 0, 0}
};
--- 77,93 ----
{"at90s4433", AVR_ISA_2xxx, bfd_mach_avr2},
{"at90s4414", AVR_ISA_2xxx, bfd_mach_avr2},
{"at90s4434", AVR_ISA_2xxx, bfd_mach_avr2},
! {"at90s8515", AVR_ISA_2xxx, bfd_mach_avr2},
! {"at90s8535", AVR_ISA_2xxx, bfd_mach_avr2},
! {"at90c8534", AVR_ISA_2xxx, bfd_mach_avr2},
{"atmega603", AVR_ISA_M603, bfd_mach_avr3},
{"atmega103", AVR_ISA_M103, bfd_mach_avr3},
! {"atmega83", AVR_ISA_M83, bfd_mach_avr4},
! {"atmega85", AVR_ISA_M83, bfd_mach_avr4},
! {"atmega161", AVR_ISA_M161, bfd_mach_avr5},
! {"atmega163", AVR_ISA_M161, bfd_mach_avr5},
! {"atmega32", AVR_ISA_M161, bfd_mach_avr5},
! {"at94k", AVR_ISA_94K, bfd_mach_avr5},
{NULL, 0, 0}
};
*************** md_show_usage (stream)
*** 204,213 ****
_ ("AVR options:\n"
" -mmcu=[avr-name] select microcontroller variant\n"
" [avr-name] can be:\n"
! " avr1 - AT90S1200\n"
! " avr2 - AT90S2xxx, AT90S4xxx, AT90S85xx, ATtiny22\n"
! " avr3 - ATmega103 or ATmega603\n"
! " avr4 - ATmega161\n"
" or immediate microcontroller name.\n"));
}
--- 207,217 ----
_ ("AVR options:\n"
" -mmcu=[avr-name] select microcontroller variant\n"
" [avr-name] can be:\n"
! " avr1 - AT90S1200, ATtiny1x, ATtiny28\n"
! " avr2 - AT90S2xxx, AT90S4xxx, AT90S8xxx, ATtiny22\n"
! " avr3 - ATmega103, ATmega603\n"
! " avr4 - ATmega83, ATmega85\n"
! " avr5 - ATmega161, ATmega163, ATmega32, AT94K\n"
" or immediate microcontroller name.\n"));
}
*************** md_parse_option (c, arg)
*** 244,253 ****
if (!mcu_types[i].name)
as_fatal (_ ("unknown MCU: %s\n"), arg);
! if (avr_mcu == &default_mcu)
avr_mcu = &mcu_types[i];
else
! as_fatal (_ ("redefinition of mcu type `%s'"), mcu_types[i].name);
return 1;
}
return 0;
--- 248,263 ----
if (!mcu_types[i].name)
as_fatal (_ ("unknown MCU: %s\n"), arg);
!
! /* It is OK to redefine mcu type within the same avr[1-5] bfd machine
! type - this for allows passing -mmcu=... via gcc ASM_SPEC as well
! as .arch ... in the asm output at the same time. */
!
! if (avr_mcu == &default_mcu || avr_mcu->mach == mcu_types[i].mach)
avr_mcu = &mcu_types[i];
else
! as_fatal (_ ("redefinition of mcu type `%s' to `%s'"),
! avr_mcu->name, mcu_types[i].name);
return 1;
}
return 0;
*************** md_apply_fix3 (fixp, valuep, seg)
*** 818,831 ****
if (value < -2048 || value > 2047)
{
! if (avr_mcu->isa & AVR_ISA_WRAP)
! {
! if (value > 2047)
! value -= 4096;
! else
! value += 4096;
! }
! else
as_bad_where (fixp->fx_file, fixp->fx_line,
_("operand out of range: %ld"), value);
}
--- 828,835 ----
if (value < -2048 || value > 2047)
{
! /* No wrap for devices with >8K of program memory. */
! if (avr_mcu->isa & AVR_ISA_MEGA)
as_bad_where (fixp->fx_file, fixp->fx_line,
_("operand out of range: %ld"), value);
}
diff -Nrc3p orig/src/include/elf/avr.h src/include/elf/avr.h
*** orig/src/include/elf/avr.h Thu Jun 8 08:11:29 2000
--- src/include/elf/avr.h Mon Jun 26 11:55:05 2000
*************** along with this program; if not, write t
*** 30,35 ****
--- 30,36 ----
#define E_AVR_MACH_AVR2 2
#define E_AVR_MACH_AVR3 3
#define E_AVR_MACH_AVR4 4
+ #define E_AVR_MACH_AVR5 5
/* Relocations. */
START_RELOC_NUMBERS (elf_avr_reloc_type)
diff -Nrc3p orig/src/include/opcode/avr.h src/include/opcode/avr.h
*** orig/src/include/opcode/avr.h Mon Jun 12 07:44:50 2000
--- src/include/opcode/avr.h Mon Jun 26 12:13:02 2000
***************
*** 21,38 ****
#define AVR_ISA_LPM 0x0002 /* device has LPM */
#define AVR_ISA_LPMX 0x0004 /* device has LPM Rd,Z[+] */
#define AVR_ISA_SRAM 0x0008 /* device has SRAM (LD, ST, PUSH, POP, ...) */
! #define AVR_ISA_WRAP 0x0010 /* device has exactly 8K program memory */
! #define AVR_ISA_MEGA 0x0020 /* device has >8K program memory (JMP, CALL) */
#define AVR_ISA_MUL 0x0040 /* device has new core (MUL, MOVW, ...) */
#define AVR_ISA_ELPM 0x0080 /* device has >64K program memory (ELPM) */
#define AVR_ISA_ELPMX 0x0100 /* device has ELPM Rd,Z[+] (none yet) */
! #define AVR_ISA_SPM 0x0200 /* device can program itself (<=64K) */
! #define AVR_ISA_ESPM 0x0400 /* device can program itself (>64K, none yet) */
#define AVR_ISA_EIND 0x0800 /* device has >128K program memory (none yet) */
#define AVR_ISA_TINY1 (AVR_ISA_1200 | AVR_ISA_LPM)
#define AVR_ISA_2xxx (AVR_ISA_TINY1 | AVR_ISA_SRAM)
! #define AVR_ISA_85xx (AVR_ISA_2xxx | AVR_ISA_WRAP)
#define AVR_ISA_M603 (AVR_ISA_2xxx | AVR_ISA_MEGA)
#define AVR_ISA_M103 (AVR_ISA_M603 | AVR_ISA_ELPM)
#define AVR_ISA_M161 (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_LPMX | AVR_ISA_SPM)
--- 21,37 ----
#define AVR_ISA_LPM 0x0002 /* device has LPM */
#define AVR_ISA_LPMX 0x0004 /* device has LPM Rd,Z[+] */
#define AVR_ISA_SRAM 0x0008 /* device has SRAM (LD, ST, PUSH, POP, ...) */
! #define AVR_ISA_MEGA 0x0020 /* device has >8K program memory (JMP and CALL
! supported, no 8K wrap on RJMP and RCALL) */
#define AVR_ISA_MUL 0x0040 /* device has new core (MUL, MOVW, ...) */
#define AVR_ISA_ELPM 0x0080 /* device has >64K program memory (ELPM) */
#define AVR_ISA_ELPMX 0x0100 /* device has ELPM Rd,Z[+] (none yet) */
! #define AVR_ISA_SPM 0x0200 /* device can program itself */
#define AVR_ISA_EIND 0x0800 /* device has >128K program memory (none yet) */
#define AVR_ISA_TINY1 (AVR_ISA_1200 | AVR_ISA_LPM)
#define AVR_ISA_2xxx (AVR_ISA_TINY1 | AVR_ISA_SRAM)
! #define AVR_ISA_M83 (AVR_ISA_2xxx | AVR_ISA_MUL | AVR_ISA_LPMX | AVR_ISA_SPM)
#define AVR_ISA_M603 (AVR_ISA_2xxx | AVR_ISA_MEGA)
#define AVR_ISA_M103 (AVR_ISA_M603 | AVR_ISA_ELPM)
#define AVR_ISA_M161 (AVR_ISA_M603 | AVR_ISA_MUL | AVR_ISA_LPMX | AVR_ISA_SPM)
*************** AVR_INSN (mulsu,"a,a", "000000110ddd0rrr
*** 191,202 ****
AVR_INSN (fmul, "a,a", "000000110ddd1rrr", 1, AVR_ISA_MUL, 0x0308)
AVR_INSN (fmuls,"a,a", "000000111ddd0rrr", 1, AVR_ISA_MUL, 0x0380)
AVR_INSN (fmulsu,"a,a","000000111ddd1rrr", 1, AVR_ISA_MUL, 0x0388)
! /* these are for devices that don't exists yet */
! /* >64K program memory, new core */
! AVR_INSN (espm, "", "1001010111111000", 1, AVR_ISA_ESPM, 0x95f8)
! /* >128K program memory (PC = EIND:Z) */
! AVR_INSN (eicall, "", "1001010100011001", 1, AVR_ISA_EIND, 0x9519)
! AVR_INSN (eijmp, "", "1001010000011001", 1, AVR_ISA_EIND, 0x9419)
AVR_INSN (sts, "i,r", "1001001ddddd0000", 2, AVR_ISA_2xxx, 0x9200)
AVR_INSN (lds, "r,i", "1001000ddddd0000", 2, AVR_ISA_2xxx, 0x9000)
AVR_INSN (ldd, "r,b", "10o0oo0dddddbooo", 1, AVR_ISA_2xxx, 0x8000)
--- 190,196 ----
AVR_INSN (fmul, "a,a", "000000110ddd1rrr", 1, AVR_ISA_MUL, 0x0308)
AVR_INSN (fmuls,"a,a", "000000111ddd0rrr", 1, AVR_ISA_MUL, 0x0380)
AVR_INSN (fmulsu,"a,a","000000111ddd1rrr", 1, AVR_ISA_MUL, 0x0388)
!
AVR_INSN (sts, "i,r", "1001001ddddd0000", 2, AVR_ISA_2xxx, 0x9200)
AVR_INSN (lds, "r,i", "1001000ddddd0000", 2, AVR_ISA_2xxx, 0x9000)
AVR_INSN (ldd, "r,b", "10o0oo0dddddbooo", 1, AVR_ISA_2xxx, 0x8000)
*************** AVR_INSN (std, "b,r", "10o0oo1rrrrrbooo
*** 204,207 ****
--- 198,207 ----
/* ee = {X=11,Y=10,Z=00, 0) */
AVR_INSN (ld, "r,e", "100!000dddddee-+", 1, AVR_ISA_1200, 0x8000)
AVR_INSN (st, "e,r", "100!001rrrrree-+", 1, AVR_ISA_1200, 0x8200)
+
+ /* these are for devices that don't exist yet */
+ /* espm (0x95f8) removed in databook update, use spm with RAMPZ:Z */
+ /* >128K program memory (PC = EIND:Z) */
+ AVR_INSN (eicall, "", "1001010100011001", 1, AVR_ISA_EIND, 0x9519)
+ AVR_INSN (eijmp, "", "1001010000011001", 1, AVR_ISA_EIND, 0x9419)
diff -Nrc3p orig/src/ld/emulparams/avrmega161.sh src/ld/emulparams/avrmega161.sh
*** orig/src/ld/emulparams/avrmega161.sh Mon May 29 07:54:24 2000
--- src/ld/emulparams/avrmega161.sh Mon Jun 26 12:25:42 2000
***************
*** 1,4 ****
! ARCH=avr:4
MACHINE=
SCRIPT_NAME=elf32avr
OUTPUT_FORMAT="elf32-avr"
--- 1,4 ----
! ARCH=avr:5
MACHINE=
SCRIPT_NAME=elf32avr
OUTPUT_FORMAT="elf32-avr"
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-07-03 15:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-03 15:27 [patch] avr-binutils changes Nick Clifton
-- strict thread matches above, loose matches on Subject: below --
2000-07-03 12:01 Marek Michalkiewicz
2000-06-26 18:48 Nick Clifton
2000-06-26 11:52 Marek Michalkiewicz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).