aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/ChangeLog12
-rw-r--r--bfd/archures.c1
-rw-r--r--bfd/bfd-in2.h1
-rw-r--r--bfd/cpu-avr.c16
-rw-r--r--bfd/elf32-avr.c21
-rw-r--r--gas/ChangeLog12
-rw-r--r--gas/config/tc-avr.c50
-rw-r--r--include/elf/ChangeLog4
-rw-r--r--include/elf/avr.h1
-rw-r--r--include/opcode/ChangeLog9
-rw-r--r--include/opcode/avr.h22
-rw-r--r--ld/ChangeLog4
-rw-r--r--ld/emulparams/avrmega161.sh2
13 files changed, 108 insertions, 47 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 43655d2..41f5b9f 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,15 @@
+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.
+
2000-06-26 Kazu Hirata <kazu@hxi.com>
* coff-h8300.c: Fix formatting.
diff --git a/bfd/archures.c b/bfd/archures.c
index ffc7937..bafb9c8 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -229,6 +229,7 @@ DESCRIPTION
.#define bfd_mach_avr2 2
.#define bfd_mach_avr3 3
.#define bfd_mach_avr4 4
+.#define bfd_mach_avr5 5
. bfd_arch_last
. };
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index b0832b9..95544bf 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -1468,6 +1468,7 @@ enum bfd_architecture
#define bfd_mach_avr2 2
#define bfd_mach_avr3 3
#define bfd_mach_avr4 4
+#define bfd_mach_avr5 5
bfd_arch_last
};
diff --git a/bfd/cpu-avr.c b/bfd/cpu-avr.c
index 637b13f..9180d90 100644
--- a/bfd/cpu-avr.c
+++ b/bfd/cpu-avr.c
@@ -45,17 +45,20 @@ static const bfd_arch_info_type *compatible
static const bfd_arch_info_type arch_info_struct[] =
{
- /* AT90S1200 */
+ /* AT90S1200, ATtiny1x, ATtiny28 */
N (16, bfd_mach_avr1, "avr:1", false, & arch_info_struct[1]),
- /* AT90S2xxx, AT90S4xxx, AT90S81xx, ATtiny22 */
+ /* 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]),
- /* ATmega161 */
- N (16, bfd_mach_avr4, "avr:4", false, NULL)
+ /* 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 =
@@ -74,7 +77,7 @@ compatible (a,b)
if (a->arch != b->arch)
return NULL;
- /* Special case for ATmega[16]03 (avr:3) and ATmega161 (avr:4). */
+ /* 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;
@@ -84,6 +87,9 @@ compatible (a,b)
if (a->mach <= b->mach)
return b;
+ if (a->mach >= b->mach)
+ return a;
+
/* Never reached! */
return NULL;
}
diff --git a/bfd/elf32-avr.c b/bfd/elf32-avr.c
index c64ab28..c99d667 100644
--- a/bfd/elf32-avr.c
+++ b/bfd/elf32-avr.c
@@ -548,15 +548,15 @@ avr_final_link_relocate (howto, input_bfd, input_section,
if (srel < -2048 || srel > 2047)
{
/* Apply WRAPAROUND if possible. */
- if (bfd_get_mach (input_bfd) == bfd_mach_avr2)
+ switch (bfd_get_mach (input_bfd))
{
- if (srel > 2047)
- srel -= 4096;
- else
- srel += 4096;
+ case bfd_mach_avr2:
+ case bfd_mach_avr4:
+ break;
+
+ default:
+ return bfd_reloc_overflow;
}
- else
- return bfd_reloc_overflow;
}
x = bfd_get_16 (input_bfd, contents);
@@ -899,6 +899,9 @@ bfd_elf_avr_final_write_processing (abfd, linker)
val = E_AVR_MACH_AVR4;
break;
+ case bfd_mach_avr5:
+ val = E_AVR_MACH_AVR5;
+ break;
}
elf_elfheader (abfd)->e_machine = EM_AVR;
@@ -934,6 +937,10 @@ elf32_avr_object_p (abfd)
case E_AVR_MACH_AVR4:
e_set = bfd_mach_avr4;
break;
+
+ case E_AVR_MACH_AVR5:
+ e_set = bfd_mach_avr5;
+ break;
}
}
return bfd_default_set_arch_mach (abfd, bfd_arch_avr,
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 8173884..fdbd4d6 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,15 @@
+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.
+
2000-06-25 Kazu Hirata <kazu@hxi.com>
* config/obj-aout.c: Remove all uses of DEFUN.
diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c
index d93b16b..97f614d 100644
--- a/gas/config/tc-avr.c
+++ b/gas/config/tc-avr.c
@@ -59,9 +59,10 @@ struct mcu_type_s
static struct mcu_type_s mcu_types[] =
{
{"avr1", AVR_ISA_TINY1, bfd_mach_avr1},
- {"avr2", AVR_ISA_85xx, bfd_mach_avr2},
+ {"avr2", AVR_ISA_2xxx, bfd_mach_avr2},
{"avr3", AVR_ISA_M103, bfd_mach_avr3},
- {"avr4", AVR_ISA_ALL, bfd_mach_avr4},
+ {"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},
@@ -76,15 +77,17 @@ static struct mcu_type_s mcu_types[] =
{"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},
+ {"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},
- {"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},
+ {"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}
};
@@ -204,10 +207,11 @@ md_show_usage (stream)
_ ("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"
+ " 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"));
}
@@ -244,10 +248,16 @@ md_parse_option (c, arg)
if (!mcu_types[i].name)
as_fatal (_ ("unknown MCU: %s\n"), arg);
- if (avr_mcu == &default_mcu)
+
+ /* 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'"), mcu_types[i].name);
+ as_fatal (_ ("redefinition of mcu type `%s' to `%s'"),
+ avr_mcu->name, mcu_types[i].name);
return 1;
}
return 0;
@@ -818,14 +828,8 @@ md_apply_fix3 (fixp, valuep, seg)
if (value < -2048 || value > 2047)
{
- if (avr_mcu->isa & AVR_ISA_WRAP)
- {
- if (value > 2047)
- value -= 4096;
- else
- value += 4096;
- }
- else
+ /* 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 --git a/include/elf/ChangeLog b/include/elf/ChangeLog
index 0a103ae..3a7d75a 100644
--- a/include/elf/ChangeLog
+++ b/include/elf/ChangeLog
@@ -1,3 +1,7 @@
+2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
+
+ * avr.h (E_AVR_MACH_AVR5): Define.
+
2000-06-18 Stephane Carrez <stcarrez@worldnet.fr>
* m68hc11.h: New file, definitions for the Motorola 68hc11.
diff --git a/include/elf/avr.h b/include/elf/avr.h
index c4cb860..09cdf7b 100644
--- a/include/elf/avr.h
+++ b/include/elf/avr.h
@@ -30,6 +30,7 @@ along with this program; if not, write to the Free Software Foundation, Inc.,
#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 --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog
index 73504e2..e639b34 100644
--- a/include/opcode/ChangeLog
+++ b/include/opcode/ChangeLog
@@ -1,3 +1,12 @@
+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.
+
2000-06-18 Stephane Carrez <stcarrez@worldnet.fr>
* m68hc11.h: New file for support of Motorola 68hc11.
diff --git a/include/opcode/avr.h b/include/opcode/avr.h
index c5bf49b..1f02514 100644
--- a/include/opcode/avr.h
+++ b/include/opcode/avr.h
@@ -21,18 +21,17 @@
#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_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 (<=64K) */
-#define AVR_ISA_ESPM 0x0400 /* device can program itself (>64K, 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_85xx (AVR_ISA_2xxx | AVR_ISA_WRAP)
+#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)
@@ -191,12 +190,7 @@ AVR_INSN (mulsu,"a,a", "000000110ddd0rrr", 1, AVR_ISA_MUL, 0x0300)
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)
@@ -205,3 +199,9 @@ AVR_INSN (std, "b,r", "10o0oo1rrrrrbooo", 1, AVR_ISA_2xxx, 0x8200)
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 --git a/ld/ChangeLog b/ld/ChangeLog
index 4eb8918..fd58bd97 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,3 +1,7 @@
+2000-06-26 Marek Michalkiewicz <marekm@linux.org.pl>
+
+ * emulparams/avrmega161.sh (ARCH): Change to avr:5.
+
2000-06-24 Alan Modra <alan@linuxcare.com.au>
* NEWS: arm-elf does --gc-sections too.
diff --git a/ld/emulparams/avrmega161.sh b/ld/emulparams/avrmega161.sh
index d92cc18..fa55222 100644
--- a/ld/emulparams/avrmega161.sh
+++ b/ld/emulparams/avrmega161.sh
@@ -1,4 +1,4 @@
-ARCH=avr:4
+ARCH=avr:5
MACHINE=
SCRIPT_NAME=elf32avr
OUTPUT_FORMAT="elf32-avr"