Forum Menu




 


Log in Problems?
New User? Sign Up!
AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
moelphes
PostPosted: Jan 30, 2009 - 07:45 AM
Newbie


Joined: Jan 30, 2009
Posts: 3
Location: Heidelberg, Germany

Hello,

I have an array of structures placed in the flash memory.
Every time I want to display the contents in the watch window strange values are displayed. It seems
that the hole flash is covered with the pattern 0x0C94.(Actually it is not!)
The memory window shows the same strange things. But after performing a single step the memory window shows the correct values.
(This really drives me mad!)

Does anybody know what to do?

By the way: I'am working with AVR Studio 4.15 on an
ATMega128L and the IAR C-compiler.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jan 30, 2009 - 10:09 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

You can't watch flash - the watch window shows you what's in SRAM (remember the AVR is "Harvard" so has multiple memory spaces each with their own location 0). But what's the point of watching something that, by defition, cannot possibly change (or are you trying to do SPM??). You'd be far better off using a memory window, set the drop down to "Program" (should be the default) and then direct it to the address of the data listed in the .map file (if C?)

Cliff

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
moelphes
PostPosted: Jan 30, 2009 - 02:04 PM
Newbie


Joined: Jan 30, 2009
Posts: 3
Location: Heidelberg, Germany

Hello Cliff,

of course you can watch flash values in the watch window.
In my case these data structures can be reloaded
with a host computer. So they can be changed.
And I'm pretty shure that it worked in earlier versions of the AVR Studio.

Gerald
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jan 30, 2009 - 02:19 PM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

Apologies - you are of course quite right - can't imagine what I was thinking of! Embarassed

I can't help noticing though that 0x0C94 is what's usually at the reset vector (it's the JMP opcode) so I wonder if it's initially confused and thinks the entity is at address 0x0000 in flash rather than it's true address which is then read/updated later?

Cliff

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
moelphes
PostPosted: Feb 02, 2009 - 06:39 AM
Newbie


Joined: Jan 30, 2009
Posts: 3
Location: Heidelberg, Germany

Hello Cliff,

no problem at all.

0x0C94 looked always familiar to me but I didn't regonised the JMP opcode.
Actually there is an update.
After some single steps the contents of these flash values are displayed correctly.
But after a running/stop cycle there are these JMP's
again.

What do you thing, will there be a workaround?

(If you find some strange grammatical structures or some funny spelling mistake...I have to apologise for that)

Gerald
 
 View user's profile Send private message  
Reply with quote Back to top
nobbyv
PostPosted: May 31, 2012 - 08:27 PM
Hangaround


Joined: Mar 17, 2008
Posts: 249


Calling this one back from the dead, as I seem to be having a similar issue. I have an array of 32 chars stored in flash. When I go and look at the array in the watch window, each element has either a 0x81 or 0xC1, alternating for each element, instead of my expected values.

Obviously, this isn't a big issue; I never even would have noticed it as I usually would just reference the flash-stored, hard-coded array, but someone testing my code who is new to embedded software noticed it.

BTW, I'm using a ATmega162 if that makes a difference.
 
 View user's profile Send private message  
Reply with quote Back to top
clawson
PostPosted: Jun 01, 2012 - 09:28 AM
10k+ Postman


Joined: Jul 18, 2005
Posts: 62281
Location: (using avr-gcc in) Finchingfield, Essex, England

Quote:

I have an array of 32 chars stored in flash. When I go and look at the array in the watch window, each element has either a 0x81 or 0xC1, alternating for each element, instead of my expected values.

The watch window surely does not know how to dereference a flash pointer using the LPM opcode so I suspect it shows what's in RAM at the address of the pointer (array base) rather than what's in flash. Take the value of the pointer and look at that address in a memory window set to "Program"

_________________
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits