Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: IAR 6. Debugger doesn't resolve macros
PostPosted: Mon Jul 11, 2011 1:08 pm 
Offline

Joined: Mon Mar 10, 2008 12:48 pm
Posts: 5
Hi there,

I am currently working with the Atmel controller AT91SAM7X512 and migrating from IAR Embedded Workbench 4.40A to IAR Embedded Workbench 6.0.

The problem is, when debugging, I cannot watch any contstats defined via macros:

e.g. when watching
#define AT25DF_STA_BSY ((unsigned short)0x0001)

The watch-window says: "Error (col 1): Unknown or ambiguous symbol. AT25DF_STA_BSY" and the mouse-over tool-tip doesn't show the constant value either.

It cannot be ambiguous because it is defined and included only once.
The software works just fine, however I can't see the value represented by AT25DF_STA_BSY.

I am guessing the J-LINK debugger cannot access the memory address of AT25DF_STA_BSY.

Does anyone know this problem? And/or (better) the solution for this problem?

We also adapted the linker-file (.icf) for the new IAR.
Can the linker command file cause this problem?

Can anyone please tell me where to look?!

Thanks for any help!
simon


Top
 Profile  
 
 Post subject: Re: IAR 6. Debugger doesn't resolve macros
PostPosted: Mon Jul 11, 2011 4:30 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
It's a #define used by the PREPROCESSOR (ie a text substitution), the compiler does not see the name. It does not have an address.

Use an "enum", to enumerate the constant in a manner the debugger might recognize, again it won't have an address because it is a VALUE.

Perhaps you should be looking at the address of the variable holding the EPROM's status byte you're reading?


Top
 Profile  
 
 Post subject: Re: IAR 6. Debugger doesn't resolve macros
PostPosted: Mon Jul 11, 2011 5:06 pm 
Offline

Joined: Mon Mar 10, 2008 12:48 pm
Posts: 5
Firstly: Thank you for your answer

What I want is the IDE to behave correctly (just like before in the IAR 4.40A).
I wanna be able to use constants just like I did before.

I have a conditional statement to check the flash state and wanted to watch the outcome of the condition in the watch-window. Thats when I recognized the problem.

The code runs just fine so I see no need to change it.

Is it possible there is an error in the IDE or C-Spy?
How does the debugger normally resolve the #define statements (macros)?

Maybe we can retrace...


Top
 Profile  
 
 Post subject: Re: IAR 6. Debugger doesn't resolve macros
PostPosted: Mon Jul 11, 2011 6:21 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
While I'm not intimately familiar with IAR and the vagaries of their debugger, the general rule is that debuggers can't see text substitutions that are performed by the preprocessor, as these typically don't reach the object file.

The debugger can resolve the address of machine code instructions, to lines within the source. It can see symbols in the object file. It typically doesn't see the source code, and has to correlate symbolic information backward to present human orientated information. This would normally exist as "debug" or "browse" information generated by the compiler, code-generator and the IDE.

While your code might have "if (status & AT25DF_STA_BSY)" the compiler sees "if (status & 1)", and can conceivably optimize that into a form that doesn't include "1" at all. (ie bit#0, or shifts it into a carry/sign flag, etc)

You could watch "status", you could break point the test, and the taken/not-taken paths. You could also define the busy bit as a variable, and watch the run-time usage of that.

Use "enum" to define these constants. Not familiar with enum? http://publications.gbdirect.co.uk/c_bo ... enums.html

Check the optimization settings, check that the compiler is generating debug/browsing information.

If you have a problem with IAR software you should probably discuss that with your support contact at IAR.


Top
 Profile  
 
 Post subject: Re: IAR 6. Debugger doesn't resolve macros
PostPosted: Wed Jul 13, 2011 10:47 am 
Offline

Joined: Mon Mar 10, 2008 12:48 pm
Posts: 5
Hi CptTitanic,

I followed your hint and had a little chat with our support contact.
Here is what he said:
He pointed out that the Linker does no longer support the UBROF-Format (which provided constant names within the out-file). The standard elf/dwarf format is used since version 5.x which sadly doesn't support this feature.

I will try out the alternatives you've suggested.

Thank you, for your help and time!
Simon


Top
 Profile  
 
 Post subject: Re: IAR 6. Debugger doesn't resolve macros
PostPosted: Wed Jul 13, 2011 11:15 am 
Offline

Joined: Fri Jan 18, 2008 12:58 pm
Posts: 6
Hi sig
I also have a similar issue, we updated from IAR 5.2 to 6.1 and we get some warning while compiling.
You mentioned you adapted to ICF to ewarm 6, would it be possible that you post it so I can see your changes ?
In advance thanks
J


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron