[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] Using progmem on the reduced Tiny core?
From: |
Georg-Johann Lay |
Subject: |
[avr-gcc-list] Using progmem on the reduced Tiny core? |
Date: |
Wed, 13 Jul 2016 19:10:59 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 |
Currently progmem attribute works the same way on the reduced core (no LPM, 16
GPRs) and on the ordinary cores (with LPM, 32 GPRs).
As we have a linearized memory model on reduced core and flash memory is
visible in the RAM address range (starting at 0x4000), it would make sense if
the compiler added that offset.
Attached is a tentative patch that adds this feature to avr-gcc together with a
small test program that demonstrates some use cases.
If this does not break anything (e.g. because the current practice is to use
progmem together with hand-crafted offsets and / or inline assembly) and the
feedback is positive, I would propose the change to gcc-patches.
Johann
gcc/
* doc/extend.texi (AVR Variable Attributes) [progmem]: Add
documentation how it works on reduced Tiny cores.
* 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.
* avr.h (AVR_TINY_PM_OFFSET): New macro.
* avr-c.c (avr_cpu_cpp_builtins): Use it instead of magic 0x4000
when built-in def'ing __AVR_TINY_PM_BASE_ADDRESS__.
tiny-progmem.diff
Description: Text Data
ptiny.c
Description: Text Data
- [avr-gcc-list] Using progmem on the reduced Tiny core?,
Georg-Johann Lay <=