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.

MPLAB v8.86 and DEBUG/RELEASE

Status
Not open for further replies.

RedAlert

Member level 1
Joined
Oct 13, 2001
Messages
38
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Location
Somewhere in Israel
Activity points
176
Hi,

I am using MPLAB version 8.86, PIC18F452, XC8 compiler and PICkit 3 Debugger/Programmer and have the following questions -

1) What is the difference between Debug and Release when I compile ?

2) I need to protect Block 0 code so I use CP0 in configuration to ON (#pragma config CP0 = ON), but the problem is that this cannot be ON while debugging so I need to automate this in code (rather manually doing it) that when in Debugger mode CP0 will be OFF and when in Programming mode CP0 will be ON; Can someone purpose a solution to that ?
(I tried #ifdef __DEBUG but this seem to work only on the Debug/Release selection in the toolbar but not on Debugger -> Select Tool -> PICkit 3)

Thanks in advance.
 

1) What is the difference between Debug and Release when I compile ?

Code compiled or assembled with the Debug configuration includes hooks, small debug routines, for the debugger, while the Release configuration removes these debug routines or hooks. The Debug configuration also includes elements like the symbol table to facilitate the debugging process by aiding the reference to the original code during breakpoints, etc.

The debugger will not perform as expected without these code hooks. Also it should be mentioned the Release configuration typically results in a significantly smaller binary, due to the fact these unneeded elements are stripped out for the Release version.


2) I need to protect Block 0 code so I use CP0 in configuration to ON (#pragma config CP0 = ON), but the problem is that this cannot be ON while debugging so I need to automate this in code (rather manually doing it) that when in Debugger mode CP0 will be OFF and when in Programming mode CP0 will be ON; Can someone purpose a solution to that ?
(I tried #ifdef __DEBUG but this seem to work only on the Debug/Release selection in the toolbar but not on Debugger -> Select Tool -> PICkit 3)

You will need to select either the Debug or Release configuration , the MPLAB IDE is not equipped with mindreader optimization. :lol:

Otherwise, you have the right idea, simply create two Configuration Register macros, one for Debug configuration and the other for Release configuration using the preprocessor directives to detect which configuration you are currently compiling.

BigDog
 

The debugger will not perform as expected without these code hooks
What do you mean by code hooks? can you give examples or links that explains this fully?

You will need to select either the Debug or Release configuration
So what you say is that there is no way to detect in code if I selected Debugger -> Select Tool -> PICkit 3 or Programmmer -> Select Programmer -> PICkit 3 and I need to use the Debug/Release configuration?

I still don't know if this is a bug or no in MPLAB IDE, but when I Select PICkit 3 as Debugger shouldn't the Debug configuration should be selected automatically and when I select PICkit 3 as a programmer then Release configuraion should selected automatically ?

Part of the code I use -
Code:
#include <xc.h>
#include <delays.h>

#pragma config config WDT = OFF, BOR = OFF, LVP = OFF, OSC = HS


#ifdef __DEBUG
#pragma config CP0 = OFF
#else
#pragma config CP0 = ON
#endif

And as you see I can automate the CP0 only in Debug/Release configuration selection but not when selecting PICkit 3 as a debugger while this is what I need...

Thanks again
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top