Accessing flash data > 64K

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

I would like to place some large arrays into flash above the 64K level of an ATmega128.
.
I created a new memory section:

const int8_t __attribute__ ((section (".mymem"))) test[100] = {""};

and added ".mymem" to the memory sections options of the Studio GCC-pluging.( the period is important !!).

The hex files are correct although I understand Studio has the limitation that you can't debug with a JtagICE or the simulator these extra sections. You in fact have to load the hex file in ISP mode, and debug the device without reloading the code. Then you can debug the disassembled code.

So my questions are, how do I tell the complier to create the program memory pointer ( "test" above) as a "far" address so I can use the functions
buf[0] = pgm_read_byte_far(test);

Do I need to control the RAMPZ register directly?
Also will any of the *_P functions work, do they use ELPM?

Any help is greatly appreciated I've already lost a lot of hair over this "section" issue with studio.

Colin

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

> Do I need to control the RAMPZ register directly?

No, this is handled transparently.

> Also will any of the *_P functions work, do they use ELPM?

No, they use LPM only.

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

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

Hello,

I've posted a macro and sample code in this post:

https://www.avrfreaks.net/index.p...

Maybe it can be useful for you or at least for your hair ;-)

Regards. Carlos.