Can memcpy_P be used to access the upper 64K of program memory, or do you have to roll your own version using __elpm_inline?
Well I just disassembled a program I have that uses memcopy_P and it
looks like the function uses the lpm instruction, so it cannot access the upper 64K bytes of code space in the 128.
You are right, it cannot. gcc places all .progmem
data at the beginning of flash (right after the
interrupt vectors) in the hope it'll be reachable for
LPM that way. Program code (where it doesn't matter
since CALL/JUMP are used anyway), and .data initialization
values (the .data init code uses ELPM on the larger
ATmegas) are placed behind.
Jörg, when you have a chance, could you review the new pgmspace.h API patch I have on avr-libc-dev? It relates to this issue. Thanks.
Maybe Marc would be a better candidate for a review? ;-)
© 2019 Microchip Technology Inc.