Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Breakpoints and MPLAB simulator

Status
Not open for further replies.

Dan_Kolis

Newbie level 4
Joined
Nov 16, 2012
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,329
Hi

I am trying to turn off optimization using CCS compiler with MPLAB as a front end for Microchip 18F252 development.

Single stepping is brutally hard with yellow "can't get there" question marks all over. I tried:

From MPLAB which calls CCS:
Project | Build Options | Project | CCS Compiler
select catagory : Optimization
set slider to "Low"
options that creates is:
+DF +LN +T +A +M -Z +Y=0 +EA
[ ] Inherit global settings { not checked }

MPLAB version: 8.87
CCS Complier version: PCH 4.134

the various sources say this goes away and one can step the C code if optimization is turned off. That is the +Y=0 setting says the PDF.

Anybody know / can tell us/me how to do this?

Thank you for even reading my sorry plight.

Regards
Dan K
 

I don't use CCS but one possible way round the problem of not being able to add breakpoints (because the optimiser removes the statement you are trying to stop at) is to add 'dummy' statements which either prevent other statements being removed or provide another statement to break at.

Turning off optimisation is probably better if you can do it, but another problem I found with some compilers was incomplete disassembly view which seemed to cause the debugger to get 'lost'.
Keith
 

I don't use CCS but one possible way round the problem of not being able to add breakpoints (because the optimiser removes the statement you are trying to stop at) is to add 'dummy' statements which either prevent other statements being removed or provide another statement to break at.

Turning off optimisation is probably better if you can do it, but another problem I found with some compilers was incomplete disassembly view which seemed to cause the debugger to get 'lost'.
Keith

=============
Well thank you. The particular way it makes lines unavailable is horrible, it move the program pointer to cracks in the code, comments, blank lines, you can't tell if its going to go into a call or over it, and it crunches together as many as 5 lines to some interior representation, so a couple NOPS doesn't help much. Thanks for answering !
 

You should be able to use a specific command line to force the compiler off in the 'build options' - you don't have to use the line created by clicking on the various options.

It sounds like your problems are particularly bad and probably due to the poor way the CCS compiler integrates with MPLAB. It is probably also the compiler that I found had missing code in the dissassembly listing so it can get completely lost.

I normally use the C30/32 compilers and never have much of a problem even with full optimisation, and that is normally fixed with a dummy statement. Recently I have been using XC8 as well and that seems reasonably well behaved.

I assume the CCS compiler works better under their IDE (I hope).

Keith
 

I don't exactly understand what's the problem. I'm using CCS PCH always with default (level 9) optimization, compiled under CCS IDE and debugged in MPLAB. I don't see specific problems in source level debugging.
 

Maybe the difference is you compiled under the CCS IDE? I only used CCS for a short period and found code missing in the dissassembly listing which was there in the list file. If it is missing from the (.cof ?) file then MPLAB cannot debug it.

Keith
 

Thanks Keith and fvm!

I tried the [x] to use a hand entered switches setting to turn off optimization, no difference.

When you use conditional compiles the listing file is a little hard to interpret, this is about "missing in listing file". then again maybes its got a flaw there.

- - - Updated - - -

fvm said: "I don't exactly understand what's the problem. I'm using CCS PCH always with default (level 9) optimization..."

Little yellow question marks in c lines that are clearly executable, as if there comments for instance and breakpoints pick a nearby line but not the non reacable ones. Since I have never seen it work its easy to find it hard to visualize, just like you have never seen it fail, so similiarly you can't easily visualize it.

- - - Updated - - -

What do you suggest?

(*) Erase apps as much as possible, reinstall

(*) Different versions?
MPLAB version: 8.87
CCS Complier version: PCH 4.134

(*) Try a different computer from scratch ?

I always run it from "inside" MPLAB I guess there must be a way to fool it to not require that. I find it also loses the .pjt file esp when its named "main.pjt"

Huh maybe I'm stupid and something else is wrong with the whole thing ?

Thanks for the help, I'll probably try any suggestion I gots nothing to lose for one thing !!!

Dunno
-Dan
 

I can imagine some cases, where CCS PCH debugging possibly has difficulties:
- very large projects (I experienced problems with PCD, some kind of cof symbol table overflow).
- projects with multiple compiled source files. CCS C works still works more smoothly with included source files.
- stepping over is generally a problem, particularly in hardware debugging

I'm presently using MPLAB V8.83, but I don't believe that the problems are caused by V8.87.
 
I'm working away on it. Will post a Fix / observation / Voodoo incantation if ones discovered that works.

thanks,
Dan
 

The severity drops to nearly non-existent after I made main.c start point main() call an included .c file.

Its technically wrong for that one first line, then recovers and almost never has what Microchip calls a "breakpoint skid". Vastly better.

I can't quite conclude its 'solved' as its not entirely absent and not explained... But if you have the problem its a big improvement. Just guessed it out .

thanks for the ideas dudes
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top