CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Breakpoints & ICD3 with MPLAB X

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
apakSeO



Joined: 07 Dec 2016
Posts: 60
Location: Northeast USA

View user's profile Send private message

Breakpoints & ICD3 with MPLAB X
PostPosted: Sun Dec 11, 2016 1:03 pm     Reply with quote

I'm using the ICD3 programmer/debugger, and the latest MPLAB X IDE from Microchip, along with CCS v5.065d

I cannot get a breakpoint-on-variable-change to stop program execution. When I stop manually and look in the watch variables, I see the variables change so I know something is reading back correctly. The CCS compiler options for optimizations is set to 0.

Prior forum topics from a year+ ago or longer point to ICD3 not being compatible with CCS. Have these issues been resolved? Or ever planned to be resolved?

Is it at all possible for me to set breakpoints using this setup?
Ttelmah



Joined: 11 Mar 2010
Posts: 19510

View user's profile Send private message

PostPosted: Sun Dec 11, 2016 2:57 pm     Reply with quote

CCS doesn't actually come into the equation, if you are using MPLAB.
All it does is generate the code. MPLAB then completely controls the debugging. The old posts you saw were about using the ICD3 with the CCS IDE. However this doesn't apply at all with the MPLAB IDE. In fact the ICD3 is now supported in the CCS IDE (has been for several years). You may just be having a version problem with MPLAB-X. Unfortunately this is a pile of (insert suitable rude word here). Sometimes I have to use it, and I have yet to find a version that actually works close to properly. This despite there having been several dozen versions.... If you do a search for 'ICD3 breakpoints not working', unfortunately you will find a huge number of threads.
On breakpoints on variables, these will generally only work on global or static variables. Are you sure you have the pass count set to 1?.
apakSeO



Joined: 07 Dec 2016
Posts: 60
Location: Northeast USA

View user's profile Send private message

PostPosted: Mon Dec 12, 2016 10:11 am     Reply with quote

Ttelmah wrote:
CCS doesn't actually come into the equation, if you are using MPLAB.
All it does is generate the code. MPLAB then completely controls the debugging. The old posts you saw were about using the ICD3 with the CCS IDE. However this doesn't apply at all with the MPLAB IDE. In fact the ICD3 is now supported in the CCS IDE (has been for several years). You may just be having a version problem with MPLAB-X. Unfortunately this is a pile of (insert suitable rude word here). Sometimes I have to use it, and I have yet to find a version that actually works close to properly. This despite there having been several dozen versions.... If you do a search for 'ICD3 breakpoints not working', unfortunately you will find a huge number of threads.
On breakpoints on variables, these will generally only work on global or static variables. Are you sure you have the pass count set to 1?.


That solved the issue; my variable was not global.

Outside of main() I declared:

Code:
volatile unsigned char testVar = 0x00;


And now any change to testVar stops execution and I can see the value change directly in MPLAB's Watches tab window.

Are there any workarounds for setting breakpoints on non-global variables? For example, something like: create a pointer to the global 'testVar' variable above, and inside a private function, anytime a local variable has the capability to change, immediately afterwards write the local value to testVar using the pointer.
Ttelmah



Joined: 11 Mar 2010
Posts: 19510

View user's profile Send private message

PostPosted: Mon Dec 12, 2016 11:14 am     Reply with quote

Static will work.

Problem is that variables don't actually 'exist', when they are local, when you are outside the function. The same memory will be being re-used by other variables. So, if you have three functions called one after the other, they can all use the same RAM for their variables. So there is nothing to actually declare the breakpoint 'on'....

A static variable is retained when you leave the function, so can have a breakpoint generated.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group