[PATCH series] AVR: add support for new controller family to binutils, gcc and avr-libc
=?cp 850?q?Bj=94rn_Haase?=
bjoern.m.haase@web.de
Tue May 23 01:32:00 GMT 2006
Nick Clifton wrote on Mittwoch, 17. Mai 2006 17:08 :
> Hi Bjrn,
>
> > Here is a patch series that adds support for a new controller family avr6
> > to the AVR ports of the gnu toolchain.
>
> After applying this patch I get three new linker testsuite failures for
> the avr-elf port:
>
> FAIL: ld-elf/64ksec-r
> FAIL: ld-elf/orphan2
> FAIL: ld-elf/group2
>
> Please could you take a look and see if you can reproduce them, and if
> so fix them ?
>
> Cheers
> Nick
With the present version of the patch, I don't observe any new real problem on
my machine for the ld testsuite. The old failures
FAIL: S-records,
FAIL: S-records with constructors
are, unfortunately, still there. The testsuite now also reports a new failure
FAIL: SIZEOF
because LD now emits a warning
/home/bmh/gnucvs/binutils/build/ld/ld-new: tmpdir/sizeof: warning: allocated
section `.data' not in segment
for this testcase. The size of the sections is correctly calculated, but the
testsuite machine generates a failure due to the ld warning.
The newly generated object file (result from objdump -D) ...
tmpdir/sizeof: file format elf32-avr
Disassembly of section .text:
00000000 <text_start>:
0: 00 00 nop
2: 00 00 nop
4: 00 00 nop
6: 00 00 nop
8: 00 00 nop
a: 00 00 nop
c: 00 00 nop
e: 00 00 nop
Disassembly of section .data:
00000010 <data_start>:
10: 00 00 nop
12: 00 00 nop
14: 00 00 nop
16: 00 00 nop
18: 00 00 nop
1a: 00 00 nop
1c: 00 00 nop
1e: 00 00 nop
... looks more reasonable to me than the corresponding version from cvs ...
tmpdir/sizeof: file format elf32-avr
Disassembly of section .text:
00000000 <text_start>:
0: 00 00 nop
2: 00 00 nop
4: 00 00 nop
6: 00 00 nop
8: 00 00 nop
a: 00 00 nop
c: 00 00 nop
e: 00 00 nop
Disassembly of section .data:
00000010 <data_start>:
10: 00 2e mov r0, r16
12: 73 79 andi r23, 0x93 ; 147
14: 6d 74 andi r22, 0x4D ; 77
16: 61 62 ori r22, 0x21 ; 33
18: 00 2e mov r0, r16
1a: 73 74 andi r23, 0x43 ; 67
1c: 72 74 andi r23, 0x42 ; 66
1e: 61 62 ori r22, 0x21 ; 33
. So, IMO, the FAIL message seems to be false alarm.
In comparison with the last version (5) a bug in the gcc part found by Bernd
trog has been removed and difficulties have been addressed that showed up
when using linker relaxation for non-avr6 targets.
Namely, there had been failing attempts to access the trampolines sections
causing ld testsuite regressions.
I also now have revised the ChangeLog entries.
Bjoern.
Summary of the changes to the binutils:
The template used for implementing the linker stubs for avr was the hppa
target. The difference here is, that we are having only one single
stub section that is created at the very beginning in the linker emulation
template. The placement of this stub section is controlled by it's name that
is included in the scripttemplate. It will be linked right after the
section used for initializing the contents of the .data section.
In order to implement this, it was necessary to add support for a derived
linker hash table and an additional stub hash table.
avr-ld now is aware of new target specific options (documented in the
avr-ld --help output):
The two options
--no-call-ret-replacement
--pmem-wrap-around
control the linker relaxation optimizations. When defining
--pm-wrap-around=16k,
the linker now tries to shorten jumps from absolute 14k to absolute 1k by
using
the fact that the PC wraps around when using a shorter relative jump.
This is, IMO, useful only for the 16k and 32k devices.
When using --no-stubs, the linker will not generate the jump stubs even when
using an avr6 device.
By use of the --debug-stubs and --debug-relax switches one could activate
debugging printout to stdout that is meant to be used when debugging avr-ld
itself. It's not meant to be used by the user, but documented never the less.
In order to distinguish relocs where stubs should be generated and relocs
where
no stubs should be generated, there are now two new ldi-type PM relocs that
carry the GS suffix instead of PM. Gas now knows of the directives gs() that
has the same functionality as pm(), only that it generates the GS relocs that
force the linker to generate stubs.
Yours,
Bjoern.
Change logs for the binutils parts:
bfd:
2006-05-10 Bjoern Haase <bjoern.m.haase@web.de>
* archures.c: Add bfd_mach_avr6.
* cpu-avr.c: Likewise.
* bfd-in2.h: Add bfd_mach_avr6, BFD_RELOC_AVR_LO8_LDI_GS and
BFD_RELOC_AVR_HI8_LDI_GS.
* libbfd.h: Add BFD_RELOC_AVR_LO8_LDI_GS, BFD_RELOC_AVR_HI8_LDI_GS.
* reloc.c: Likewise.
* elf32-avr.h: Add new file for communication with ld.
* elf32-avr.c
Add elf32-avr.h to include list.
(elf32_avr_stub_hash_entry): New function.
(elf32_avr_link_hash_table): New struct.
(avr_link_hash_table): Likewise.
(avr_stub_hash_entry): Likewise.
(avr_stub_hash_lookup): New function.
(stub_hash_newfunc): New function.
(elf32_avr_link_hash_table_create): New function.
(elf32_avr_link_hash_table_free): New function.
(avr_get_stub_addr): New function.
(debug_relax, debug_stubs): Add new global variables controlling
debugging printout to stdout.
(avr_pc_wrap_around): Change the type to bfd_vma.
(avr_replace_call_ret_sequences): Add a new variable controling
linkrelax optimizations.
(avr_stub_is_required_for_16_bit_reloc): New function.
(avr_final_link_relocate):
Add linker hash table to parameter list. Use stub addr. if necessary.
(elf32_avr_relocate_section):
Add linker hashtable to parameter list of avr_final_link_relocate.
(bfd_elf_avr_final_write_processing): Add support for bfd_mach_avr6.
(elf32_avr_object_p): Add support for E_AVR_MACH_AVR6.
(elf32_avr_relax_delete_bytes):
Iterate over all sections of a bfd when adjusting relocs addends.
(elf32_avr_relax_section):
Evaluate avr_replace_call_ret_sequences and recalculate the size of
stub section.
(avr_stub_name): New function.
(avr_get_stub_entry): New function.
(avr_add_stub): New function.
(avr_build_one_stub): New function.
(avr_size_one_stub): New function.
(elf32_avr_setup_params): New function.
(elf32_avr_setup_section_lists): New function.
(get_local_syms): New function.
(elf32_avr_size_stubs): New function.
(bfd_elf32_bfd_link_hash_table_create): New function.
(bfd_elf32_bfd_link_hash_table_free): New function.
Gas:
2006-05-10 Bjoern Haase <bjoern.m.haase@web.de>
* config/tc-avr.c: Add new cpu targets avr6, avr2560 and avr2561.
* config/tc-avr.h (TC_VALIDATE_FIX): Don't generate fixups for
PM type relocs except for constant immediates.
Include:
2006-05-10 Bjoern Haase <bjoern.m.haase@web.de>
* include/elf/avr.h
Add E_AVR_MACH_AVR6, R_AVR_LO8_LDI_GS and R_AVR_HI8_LDI_GS.
Ld:
2006-05-10 Bjoern Haase <bjoern.m.haase@web.de>
* configure.tgt: Add avr6 to emulation list.
* Makefile.am, ld/Makefile.in:
Add eavr6.o and corresponding rule.
* emulparams/avr6.sh: New file.
* emulparams/avrX.sh:
(TEMPLATE_NAME): Use elf32 instead of generic for target option support.
(EXTRA_EM_FILE): Add reference to new em template file avrelf.
* scripttempl/avr.sc: Add ".trampolines" section.
* emultempl/avrelf.em: Add new file for target specific options.
Summary of the changes to gcc:
There is now a new variable holding the size of the PC and the frame
offsets are adjusted accordingly.
The tablejump insn now use eijmp instead of ijmp for the
3-Byte PC devices and so does libgcc.S.
New builtin defines for __AVR_3_BYTE_PC__ and _AVR_2_BYTE_PC__ are now
available.
The option -fno-delete-null-pointer-checks has been added to the option
list, since 0 is a perfectly legal address for some avr devices.
main() now is a normal function without any special handling.
Change log for the gcc part:
2006-05-10 Bjoern Haase <bjoern.m.haase@web.de>
* gcc/gcc/config/avr/avr.c:
(avr_pc_size): New variable.
(struct base_arch): Add three_byte_pc to struct.
(struct base_arch_s): Add new struct member and add avr6 entry.
(struct mcu_type_s): Add new cpus avr6 and atmega2560 and atmega2561.
(avr_override_options): Set avr_pc_size to 3 if necessary.
(initial_elimination_offset): Evaluate (avr_pc_size) instead of using
a fixed value of 2.
(avr_output_function_prologue): Use gs() asm specifier instead of pm()
(print_operand_address): Likewise.
(avr_assemble_integer): Likewise.
(avr_output_addr_vec_elt): Likewise.
(avr_output_function_prologue): Make main() be like any normal function.
(avr_output_function_epilogue): Likewise.
* gcc/gcc/config/avr/avr.h:
(CC1_SPEC): Add -fno-delete-null-pointer-checks to list.
(CC1PLUS_SPEC): Likewise.
(LINK_SPEC): Add support for atmega2560 and atmega2561.
(CRT_BINUTILS_SPEC):
Add support for atmega2560 (crtm2560.o) and atmega2561 (crtm2561.o).
(TARGET_CPU_CPP_BUILTINS): Add __AVR_3_BYTE_PC__ and __AVR_2_BYTE_PC__.
(AVR_3_BYTE_PC): New define symbol.
(AVR_2_BYTE_PC): Likewise.
* gcc/gcc/config/avr/libgcc.S
* gcc/gcc/config/avr/avr.md
(call_insn): Use eicall instead of icall for 3 byte PC devices.
(call_value_insn): Likewise.
(indirect_jump): Use only if AVR_2_BYTE_PC.
(tablejump_enh): Likewise.
(tablejump): Likewise.
(indirect_jump_avr6): Add.
(tablejump_avr6): Add.
* gcc/gcc/config/avr/t-avr:
(MULITLIB_OPTIONS): Add avr6 architecture to list.
(MULITLIB_DIRNAMES): Likewise
(MULTILIB_MATCHES): Add atmega2560 and atmega2561 to list.
Change Log for avr-libc:
2006-05-10 Bjoern Haase <bjoern.m.haase@web.de>
* devtools/gen-avr-lib-tree.sh:
(AVR6_DEV_INFO): Add.
(AVR_ARH_INFO): Append AVR6_DEV_INFO.
* configure.ac:
(AC_CONFIG_FILES): Add avr6/Makefile, atmega2560 and atmega2561.
* include/avr/io.h:
Add "#include"s for atmega2560 and atmega2561.
* include/avr/iom2560.h: New file. Register locations are untested.
* include/avr/iom2561.h: New file. Register locations are untested.
* crt1/gcrt1.S:
(init2): add EIND initialization to hh8(pm(__vectors))
(init9): use XCALL main instead of XJMP main. Add XJMP exit
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mega_256x_avrlibc_6.patch
Type: text/x-diff
Size: 6334 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060523/080ce8eb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mega_256x_gcc_6.patch
Type: text/x-diff
Size: 14539 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060523/080ce8eb/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mega_256x_binutils_6.patch
Type: text/x-diff
Size: 196911 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20060523/080ce8eb/attachment-0002.bin>
More information about the Binutils
mailing list