View previous topic :: View next topic |
Author |
Message |
apakSeO
Joined: 07 Dec 2016 Posts: 60 Location: Northeast USA
|
Breakpoints & ICD3 with MPLAB X |
Posted: Sun Dec 11, 2016 1:03 pm |
|
|
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
|
|
Posted: Sun Dec 11, 2016 2:57 pm |
|
|
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
|
|
Posted: Mon Dec 12, 2016 10:11 am |
|
|
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
|
|
Posted: Mon Dec 12, 2016 11:14 am |
|
|
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. |
|
|
|