memcpy_P and 128

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

Eric

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Maybe Marc would be a better candidate for a review? ;-)