C preprocessors in GCC-AVR & AVR studio

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hi,

I am using GCC and AVR sudio in my MCU project. I find a big problem
when the two tools are used together.

My C program has many "#ifdef"/"#endif" instruction segments to
control different compilation options. However, when I debug the
program in AVR studio and set watch points, some locations are
misaligned so that the real position of instruction lines cannot be
really located. I knew that becaue I found that some instruction lines
cannot be set watchpoint successfully. So this brings a lot of
troubles to me.

Could anyone teach me how to solve the problem? Or I need to remove
those preprocesors?

Re: C preprocessors in GCC-AVR & AVR studio

Quoted text here. Click to load it

I'd be very, very surprised if the preprocessor stuff is causing problems.

Most likey, you need to turn off optimization in the compiler.  With
optimization enabled, lines get eliminated and re-arranged.

--
Grant Edwards                   grante             Yow!  Half a mind is a
                                  at               terrible thing to waste!
We've slightly trimmed the long signature. Click to see the full one.
Re: C preprocessors in GCC-AVR & AVR studio
Quoted text here. Click to load it

I think the problem i not in the optimization. For example, if A is
not defined in the following, the alignment would become wrong in b()
funciton. Setting or not setting optimization cannot help.
:
:
#ifdef A
void a()
{
:
:
}
#endif
:
:
void b()
{
:

}

Re: C preprocessors in GCC-AVR & AVR studio

Quoted text here. Click to load it

This might be an oversimplification of your problem, but you know that
changing the source code after the last compilation can cause alignment
problems for most source-level debuggers.



Site Timeline