diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2016-07-20 14:12:16 +0000 |
---|---|---|
committer | Georg-Johann Lay <gjl@gcc.gnu.org> | 2016-07-20 14:12:16 +0000 |
commit | c25e1d82bf149151af72a8a38db2160b1ca46002 (patch) | |
tree | 2bc4015645e9b395fa0a3e6e1abc9653b4d1d21b /gcc/config/avr/avr-c.c | |
parent | 25e08379b869ba2f2def6d0e9d8443e053f8c3be (diff) | |
download | gcc-c25e1d82bf149151af72a8a38db2160b1ca46002.zip gcc-c25e1d82bf149151af72a8a38db2160b1ca46002.tar.gz gcc-c25e1d82bf149151af72a8a38db2160b1ca46002.tar.bz2 |
Implement attribute progmem on reduced Tiny cores by adding flash offset 0x4000 to respective symbols.
gcc/
Implement attribute progmem on reduced Tiny cores by adding
flash offset 0x4000 to respective symbols.
PR target/71948
* doc/extend.texi (AVR Variable Attributes) [progmem]: Add
documentation how it works on reduced Tiny cores.
(AVR Named Address Spaces): No support for reduced Tiny.
* config/avr/avr.c (AVR_SYMBOL_FLAG_TINY_PM): New macro.
(avr_address_tiny_pm_p): New static function.
(avr_print_operand_address) [AVR_TINY]: Add AVR_TINY_PM_OFFSET
if the address is in progmem.
(avr_assemble_integer): Same.
(avr_encode_section_info) [AVR_TINY]: Set AVR_SYMBOL_FLAG_TINY_PM
for symbol_ref in progmem.
* config/avr/avr.h (AVR_TINY_PM_OFFSET): New macro.
* config/avr/avr-c.c (avr_cpu_cpp_builtins): Use it instead of
magic 0x4000 when built-in def'ing __AVR_TINY_PM_BASE_ADDRESS__.
gcc/testsuite/
PR target/71948
* gcc.target/avr/torture/tiny-progmem.c: New test.
From-SVN: r238525
Diffstat (limited to 'gcc/config/avr/avr-c.c')
-rw-r--r-- | gcc/config/avr/avr-c.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/config/avr/avr-c.c b/gcc/config/avr/avr-c.c index a338a9f..270b803 100644 --- a/gcc/config/avr/avr-c.c +++ b/gcc/config/avr/avr-c.c @@ -296,7 +296,7 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) builtin_define_std ("AVR"); /* __AVR_DEVICE_NAME__ and avr_mcu_types[].macro like __AVR_ATmega8__ - are defined by -D command option, see device-specs file. */ + are defined by -D command option, see device-specs file. */ if (avr_arch->macro) cpp_define_formatted (pfile, "__AVR_ARCH__=%s", avr_arch->macro); @@ -337,7 +337,8 @@ avr_cpu_cpp_builtins (struct cpp_reader *pfile) it has been mapped to the data memory. For AVR_TINY devices (ATtiny4/5/9/10/20 and 40) mapped program memory starts at 0x4000. */ - cpp_define (pfile, "__AVR_TINY_PM_BASE_ADDRESS__=0x4000"); + cpp_define_formatted (pfile, "__AVR_TINY_PM_BASE_ADDRESS__=0x%x", + AVR_TINY_PM_OFFSET); } if (AVR_HAVE_EIJMP_EICALL) |