MPLAB IDE: C Programming: Using watch function for symbols

View: New views
8 Messages — Rating Filter:   Alert me  

MPLAB IDE: C Programming: Using watch function for symbols

by Zachary Noyes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am using PICC Lite software with MPLAB IDE. I write some code and try to
get a "watch" for the variables that I create. I can add watches for built
in registers (using 16F877 setup), but cannot click the "Add Symbol" button
because it is "gray" (does nothing when clicked).

I read from the website http://www.microchipc.com/ That I need to add the
switch '-fakelocal' to the linker options. I click "project, build, project"
and it opens a dialog. There is a text box with linker options label at the
bottom. I add the text, but the project build fails and says that it doesn't
recognize that command.

What is going on with my innability to add symbol names from the program (I
set the variables up as unsigned chars)? Thanks.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

RE: MPLAB IDE: C Programming: Using watch function for symbols

by Michael Rigby-Jones :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



> -----Original Message-----
> From: piclist-bounces@... [mailto:piclist-bounces@...] On
Behalf
> Of Zachary Noyes
> Sent: 28 April 2008 17:43
> To: piclist@...
> Subject: [PIC] MPLAB IDE: C Programming: Using watch function for
symbols
>
> I am using PICC Lite software with MPLAB IDE. I write some code and
try to
> get a "watch" for the variables that I create. I can add watches for
built
> in registers (using 16F877 setup), but cannot click the "Add Symbol"
> button
> because it is "gray" (does nothing when clicked).
>
> I read from the website http://www.microchipc.com/ That I need to add
the
> switch '-fakelocal' to the linker options. I click "project, build,
> project"
> and it opens a dialog. There is a text box with linker options label
at
> the
> bottom. I add the text, but the project build fails and says that it
> doesn't
> recognize that command.
>
> What is going on with my innability to add symbol names from the
program
> (I
> set the variables up as unsigned chars)? Thanks.

Local variables are often optimised away by the compiler if possible.
Try disabling optimisation perhaps?

Regards

Mike

=======================================================================
This e-mail is intended for the person it is addressed to only. The
information contained in it may be confidential and/or protected by
law. If you are not the intended recipient of this message, you must
not make any use of this information, or copy or show it to any
person. Please contact us immediately to tell us that you have
received this e-mail, and return the original to us. Any use,
forwarding, printing or copying of this message is strictly prohibited.
No part of this message can be considered a request for goods or
services.
=======================================================================

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Parent Message unknown Re: MPLAB IDE: C Programming: Using watch function for symbols

by Marcel Duchamp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Zachary Noyes wrote:

> I am using PICC Lite software with MPLAB IDE. I write some code and try to
> get a "watch" for the variables that I create. I can add watches for built
> in registers (using 16F877 setup), but cannot click the "Add Symbol" button
> because it is "gray" (does nothing when clicked).
>
> I read from the website http://www.microchipc.com/ That I need to add the
> switch '-fakelocal' to the linker options. I click "project, build, project"
> and it opens a dialog. There is a text box with linker options label at the
> bottom. I add the text, but the project build fails and says that it doesn't
> recognize that command.
>
> What is going on with my innability to add symbol names from the program (I
> set the variables up as unsigned chars)? Thanks.

I saw this in the past and for me, the issue was related to how variables were being declared.  I was working with assembly code in absolute mode.  Depending on whether variables were declared with CBLOCK  or RES keywords, they either would or wouldn't show up in the "Add Symbol" drop-down dialog box.  I can't remember which way worked but if you knock up a quick sample project, you can test and see which way works.  It *was* baffling at first.

--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: MPLAB IDE: C Programming: Using watch function for symbols

by Harold Hallikainen-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have not used PICC Lite, but have instead used Microchip's C18 and C30.
Someone pointed out that optimization may cause variables to disappear. I
have not seen that, but have seen wild program line execution order when
single stepping if I have full optimization on. For debug, I either turn
off optimization or set it to "debug."

I am also not familiar with the fakelocal flag, but I expect that it makes
local variables static instead of automatic so they have a permanent
location in RAM instead of a location on the stack. You do not indicate
whether the problem is with global or local variables (apparently it's
with both since you have the button grayed out). I have not ever seen that
happen.

With C18 and C30, local variables are visible in the watch window when you
are in the function they are defined in. If you step outside the function,
the watch window says they are out of scope. Global variables are always
visible.

So... Since I have not use PICC Lite, I am not really answering your
question. There are some general comments on the watch window, though.

Good luck!

Harold




--
FCC Rules Updated Daily at http://www.hallikainen.com - Advertising
opportunities available!
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: MPLAB IDE: C Programming: Using watch function for symbols

by John Temples-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 28 Apr 2008, Zachary Noyes wrote:

> I am using PICC Lite software with MPLAB IDE. I write some code and try to
> get a "watch" for the variables that I create. I can add watches for built
> in registers (using 16F877 setup), but cannot click the "Add Symbol" button
> because it is "gray" (does nothing when clicked).
>
> I read from the website http://www.microchipc.com/ That I need to add the
> switch '-fakelocal' to the linker options. I click "project, build, project"
> and it opens a dialog. There is a text box with linker options label at the
> bottom. I add the text, but the project build fails and says that it doesn't
> recognize that command.

The "fakelocal" flag was deprecated several years ago.  microchipc.com
generally has lots of obsolete and incorrect information.

--
John W. Temples, III
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: MPLAB IDE: C Programming: Using watch function for symbols

by Herbert Graf-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Mon, 2008-04-28 at 12:43 -0400, Zachary Noyes wrote:

> I am using PICC Lite software with MPLAB IDE. I write some code and try to
> get a "watch" for the variables that I create. I can add watches for built
> in registers (using 16F877 setup), but cannot click the "Add Symbol" button
> because it is "gray" (does nothing when clicked).
>
> I read from the website http://www.microchipc.com/ That I need to add the
> switch '-fakelocal' to the linker options. I click "project, build, project"
> and it opens a dialog. There is a text box with linker options label at the
> bottom. I add the text, but the project build fails and says that it doesn't
> recognize that command.
>
> What is going on with my innability to add symbol names from the program (I
> set the variables up as unsigned chars)? Thanks.

Welcome to C! :)

A problem I've had is you have to remember that in C variables have a
"scope", meaning they exist only when the code they are in scope with is
running (unless you modify the scope, i.e. declaring a variable outside
of all code blocks, that effectively makes them "global" variables).

In your case, you have to stop your execution in the section of code
where that variable exists, add it, and then continue or reset.

This might not be your problem, but it is a common thing that people
forget.

TTYL
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Parent Message unknown Re: MPLAB IDE: C Programming: Using watch function for symbols

by Spehro Pefhany :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

At 03:36 PM 4/28/2008, you wrote:

>I have not used PICC Lite, but have instead used Microchip's C18 and C30.
>Someone pointed out that optimization may cause variables to disappear. I
>have not seen that, but have seen wild program line execution order when
>single stepping if I have full optimization on. For debug, I either turn
>off optimization or set it to "debug."
>
>I am also not familiar with the fakelocal flag, but I expect that it makes
>local variables static instead of automatic so they have a permanent
>location in RAM instead of a location on the stack. You do not indicate
>whether the problem is with global or local variables (apparently it's
>with both since you have the button grayed out). I have not ever seen that
>happen.
>
>With C18 and C30, local variables are visible in the watch window when you
>are in the function they are defined in. If you step outside the function,
>the watch window says they are out of scope. Global variables are always
>visible.
>
>So... Since I have not use PICC Lite, I am not really answering your
>question. There are some general comments on the watch window, though.
>
>Good luck!
>
>Harold

One general suggestion I have is to avoid paths to the project directory
that are very long or have spaces in them. Some programs still have problems
with such things. Try re-creating the project in a folder such as
C:\myproject\
and see what happens.

>Best regards,

Spehro Pefhany --"it's the network..."            "The Journey is the reward"
speff@...             Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog  Info for designers:  http://www.speff.com



--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist

Re: MPLAB IDE: C Programming: Using watch function for symbols

by sahanaashwin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Zachary Noyes wrote:
I am using PICC Lite software with MPLAB IDE. I write some code and try to
get a "watch" for the variables that I create. I can add watches for built
in registers (using 16F877 setup), but cannot click the "Add Symbol" button
because it is "gray" (does nothing when clicked).

I innability to add symbol names from the program (I
set the variables up as unsigned chars)? Thanks.
--
http://www.piclist.com PIC/SX FAQ & list archive
View/change your membership options at
http://mailman.mit.edu/mailman/listinfo/piclist
LightInTheBox - Buy quality products at wholesale price!