[patch,avr] Add support for devices with flash accessible by LD.
Georg-Johann Lay
avr@gjlay.de
Fri Jun 9 10:29:00 GMT 2017
Hi,
This patch adds support for devices that can access flash memory
by LD* instructions, hence there is no need to put .rodata in RAM.
The default linker script for the new multilib versions already
supports this feature, it's similar to avrtiny, cf.
https://sourceware.org/PR21472
This patch does the following:
* Add multilib variants avrxmega3 and avrxmega3/short-calls.
* Add new option -mshort-calls for multilib selection between
devices with <= 8KiB flash and > 8KiB flash.
* Add specs handling for -mshort-calls: The compiler knows
if this option is needed or not appropriate (similar to -msp8).
* Add new ISA feature AVR_ISA_RCALL for multilib selection
via -mshort-calls.
* Add a new row to architecture description that contains the
start address of flash memory in the RAM address range.
(The actual value is not needed).
* For devices with flash in RAM space, don't let .rodata
objects trigger need for __do_copy_data.
* Add some devices.
* Add configure test for Binutils PR21472.
* Adjust documentation etc.
Even the smaller devices with flash <= 8KiB support JMP+CALL,
but we get better code by assuming RJMP+RCALL: Jump tables
are more efficient and insn length computation is more exact
(CALL -> RCALL relaxation would need -mrelax and insn size
would still be 4 bytes).
Moreover, avr-libc uses __AVR_HAVE_JMP_CALL__ to determine
vector entry size, and libgcc uses that macro for flash size
estimation.
Ok for trunk?
Johann
* config/avr/avr-arch.h (avr_arch_id) <ARCH_AVRXMEGA3>: New enum.
(avr_mcu_t) <flash_pm_offset>: New field.
(avr_device_specific_features) <AVR_ISA_RCALL>: New enum.
* config/avr/avr.h (AVR_SHORT_CALLS): New define.
(AVR_HAVE_JMP_CALL): Don't set if AVR_SHORT_CALLS.
(AVR_TINY_PM_OFFSET): Remove macro.
* config/avr/avr.opt (-mshort-calls): New option.
* config/avr/gen-avr-mmcu-specs.c (print_mcu)
[*self_spec]: Add / remove -mshort-calls depending on AVR_ISA_RCALL.
* config/avr/avr-c.c (avr_cpu_cpp_builtins)
<__AVR_SHORT_CALLS__>: Built-in define if AVR_SHORT_CALLS.
<__AVR_HAVE_JMP_CALL__>: Use AVR_HAVE_JMP_CALL as condition
instead of avr_arch->have_jmp_call.
<__AVR_PM_BASE_ADDRESS__>: Built-in define if avr_arch->flash_pm_offset.
[AVR_TINY] <__AVR_TINY_PM_BASE_ADDRESS__>: Use
avr_arch->flash_pm_offset to define.
* config/avr/avr-devices.c (avr_arch_types): Add initializers for
new field flash_pm_offset. Add entry for avrxmega3.
(avr_texinfo): Add entry for avrxmega3.
* avr-mcus.def: Add entries for: avrxmega3, attiny212, attiny214,
attiny412, attiny414, attiny416, attiny417, attiny814,
attiny816, attiny817, attiny1616, attiny1617, attiny3214,
attiny3216, attiny3217.
* config/avr/avr.c (avr_assemble_integer)[AVR_TINY]: Use
avr_arch->flash_pm_offset instead of AVR_TINY_PM_OFFSET.
(avr_print_operand_address) [AVR_TINY]: Same.
(avr_asm_init_sections) <readonly_data_section>: Only patch
callback if avr_arch->flash_pm_offset = 0.
(avr_asm_named_section) <avr_need_copy_data_p>: Skip setting it
for rodata if avr_arch->flash_pm_offset != 0.
(avr_encode_section_info) [AVR_TINY]: Adjust comment.
* config/avr/genmultilib.awk (dir_rcall, opt_rcall): New vars.
(opts) [AVR_ISA_RCALL]: Append opt_rcall.
(m_options): Append opt_rcall.
(m_dirnames): Append dir_rcall.
* config/avr/t-multilib: Regenerate.
* configure.ac [target=avr]: Check whether avrxmega3 default
linker description file works as needed.
* configure: Regenerate.
* doc/avr-mmcu.texi: Regenerate.
* doc/invoke.texi (AVR Options) <-mshort-calls>: Document it.
<__AVR_ARCH__>: Document avrxmega3 and 103.
<__AVR_HAVE_JMP_CALL__>: Adjust documentation.
<__AVR_SHORT_CALLS__>: Document it.
<__AVR_PM_BASE_ADDRESS__>: Document it.
* doc/extend.texi (AVR Options) <-mshort-calls>: Document it.
(AVR Variable Attributes) <progmem>: Document this is
not needed for avrxmega3.
(AVR Named Address Spaces) <__flash>: Dito.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: avrxmega3.diff
Type: text/x-patch
Size: 30794 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20170609/32187413/attachment.bin>
More information about the Gcc-patches
mailing list