simulator don't display eeprom values in studio6 ATXmega128A1

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

Hello,

 

I have a program pretty big and I have tried to simulate part of it, see attachment.

The issue is about the eeprom and some values in EEMEM.

 

*first  according to the simulator in studio6, the locoentry values are all zero, they are not initialized in eeprom

*two if I try to read them, I got 0xff/0xff never {1,M4} or any other values.

Even with the use of mapping eeprom to memory

 

Can you help? am I missing something with the memory controller or the flash mapping.

 

 

see attachment test.txt for the instructions (the .h files are not attached)

 

 

Attachment(s): 

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

I found it!!!  The answer is simply don't select Preserve EEPROM with the simulator tool.

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

In your .txt I see:

        EEpromInit();                                // from xeeprom: map eeprom to memory

...

    stored.as_uint8[0] = eeprom_read_byte(&locoentry[i].b[0]);

But surely the AVR-LibC eeprom_read*() routines for Xmega map the EEPROM into memory as and when necessary - you shouldn't be messing with this too?

 

See the __AVR_XMEGA__ sections of this...

 

http://svn.savannah.nongnu.org/v...

 

That's the actual code of eeprom_read_byte().

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

Thanks for info but AVR-LibC eeprom_read*() or the xeeprom from

Autor : Joachim Rath

* Revision : initial 04/2010

*

*************************************************************************

* (C) Copyright 2010 Joachim Rath

* Joachim[dot]Rath[at]JoRath[dot]eu

*************************************************************************

 

have the same effect, which is slightly more complicated that what I described first, before unsetting the Preserve EEPROM in Simulator.

 

 

Indeed the simulator display the proper values in memory display eeprom and data MAPPED_EEPROM as well.

but the watch on locoentry  {t_locoentry[64]{eeprom}@0x0000} 
don't display any proper value, all are at 0x00 even if the value are there in memory at 0x0000,eeprom.

 

I have added some instruction to test read and write.

eeprom_read_byte works, the eeprom_write_byte don't work, or at least nothing can be seen on the memory displayed by the simulator.

 

Any idea why ?

 

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

the watch

Oh a watch? All the usual caveats apply then ;-)

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

clawson wrote:

the watch

Oh a watch? All the usual caveats apply then ;-)

 

Might be clear for you, not at all for me!

 

What can I do, except give up or try my test program on real hardware?

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

It can help to make the watch target "volatile" as that generally forces the compiler to keep the memory copy up to date rather than just caching values in registers. But if you see it in a memory window but not a watch then that is curious.

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

clawson wrote:

It can help to make the watch target "volatile" .

Ok I will try and let you know

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

Making the watch target volatile does not help.