View previous topic :: View next topic |
Author |
Message |
zapados
Joined: 04 Feb 2025 Posts: 6
|
[SOLVED] Warning: The hex file has the debug bit set.... |
Posted: Tue Feb 04, 2025 5:27 pm |
|
|
When doing a "production" build in MPLAB X (Production --> Clean and Build Project), I'm getting this warning:
Warning: The hex file has the debug bit set. The debug bit has been cleared during load to memory. The original hex file has not been modified.
The debug bit should not be set!
Here are my environment & build details:
MPLAB X v6.20
CCS C Compiler v5.119
Working with a PIC18F2520
If I load the "debug bit set" hex into MPLAB IPE, then export it from MPLAB IPE, and diff. against the one which was loaded in, it does show differences so I think the warning is legit.
Any help is appreciated! Thank you. Cheers! 
Last edited by zapados on Thu Feb 06, 2025 2:20 pm; edited 1 time in total |
|
 |
jaka
Joined: 04 May 2014 Posts: 37 Location: Finland
|
|
Posted: Wed Feb 05, 2025 4:17 am |
|
|
Have you tried adding the following line:
#fuses NODEBUG
(or just add NODEBUG to your existing #fuses line) |
|
 |
zapados
Joined: 04 Feb 2025 Posts: 6
|
|
Posted: Wed Feb 05, 2025 9:13 am |
|
|
This is what I have going on for the DEBUG fuses stuff:
Code: | //#define ICD_DEBUG
#ifdef ICD_DEBUG
#FUSES NOWDT
#FUSES DEBUG
#else
#FUSES WDT
#FUSES WDT16384
#FUSES NODEBUG
#endif |
Even if I hack it with:
Code: |
//#define ICD_DEBUG
#ifdef ICD_DEBUG
#FUSES NOWDT
#FUSES DEBUG
#else
#FUSES WDT
#FUSES WDT16384
#FUSES NODEBUG
#endif
// TEST TEST TEST!!!
#FUSES NODEBUG // NODEBUG mode forced!!
|
I still get the warning. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19730
|
|
Posted: Wed Feb 05, 2025 11:02 am |
|
|
Suggests you may have debug turned on in the project configuration.
Production
Project Configuration
Customise
Building
Tick the box 'use 'clean' target from makefile'
Problem is that if the make has got debug in it as the default, It'll build
with debug whatever you do.
This takes you back to the clean setup, so the debug should then be removed. |
|
 |
zapados
Joined: 04 Feb 2025 Posts: 6
|
|
Posted: Wed Feb 05, 2025 1:09 pm |
|
|
@Ttelmah, interesting, I did NOT have that set. Unfortunately, setting it still produces the warning. |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19730
|
|
Posted: Thu Feb 06, 2025 3:52 am |
|
|
OK.
Thing is the debug fuse is overridden by the build configuration.
Now that should be set by the build line being sent to the compiler,
having +ICD when you build for debug, but not when you build
for production. Check the command line being generated in the
settings, and see if that has been explicitly added.
The setup between MPPLAB and CCS is at times very annoying.
In the Properties window, select 'Building', and in both the right
hand windows, scroll to the bottom and check there is the line:
IsDebug "true" for a Debug run, "false" otherwise
If one of these has got deleted it could give your behaviour.
Then in the left window select the 'Compiler Options' tab for the
CCS C Compiler. Bottom right window, select 'Generated Command Line'.
This should be:
+F =9 +EA +DF +LN +T +A +M +J +Z -P
The =9 will change if you have altered the optimisation, but if anything
else is different, post what you are getting, or hit the top right 'Reset'
button to put these settings back to default.
I worry about your #if code posted. Get rid of it!......
Just REM it out. Rules out one thing. It perhaps suggests that you have a
line in the setup to explicitly define ICD_DEBUG, and that this is what is
overriding the MPLAB settings.
I always just use _DEBUG to test for debugging being enabled, and it
is this that the IsDebug setting generates in the settings. |
|
 |
zapados
Joined: 04 Feb 2025 Posts: 6
|
|
Posted: Thu Feb 06, 2025 9:13 am |
|
|
Ttelmah wrote: | OK.
Thing is the debug fuse is overridden by the build configuration.
Now that should be set by the build line being sent to the compiler,
having +ICD when you build for debug, but not when you build
for production. Check the command line being generated in the
settings, and see if that has been explicitly added.
The setup between MPPLAB and CCS is at times very annoying.
In the Properties window, select 'Building', and in both the right
hand windows, scroll to the bottom and check there is the line:
IsDebug "true" for a Debug run, "false" otherwise
If one of these has got deleted it could give your behaviour.
Then in the left window select the 'Compiler Options' tab for the
CCS C Compiler. Bottom right window, select 'Generated Command Line'.
This should be:
+F =9 +EA +DF +LN +T +A +M +J +Z -P
The =9 will change if you have altered the optimisation, but if anything
else is different, post what you are getting, or hit the top right 'Reset'
button to put these settings back to default.
I worry about your #if code posted. Get rid of it!......
Just REM it out. Rules out one thing. It perhaps suggests that you have a
line in the setup to explicitly define ICD_DEBUG, and that this is what is
overriding the MPLAB settings.
I always just use _DEBUG to test for debugging being enabled, and it
is this that the IsDebug setting generates in the settings. |
I do have the IsDebug macro present in both sections. https://imgur.com/a/pcJctAk
I have tried commenting out the entire debug fuses chunk of code, sadly no change, still get the warning. :(
My compiler line is almost exactly the same, but +Y=9 instead of +F=9:
+Y=9 +EA +DF +LN +T +A +M +J +Z -P
I think the +F may have been a typo or legacy option, as the +Y matches up with the documentation found here: https://www.ccsinfo.com/downloads/ccs_c_manual.pdf
Thank you for your help![/url] |
|
 |
zapados
Joined: 04 Feb 2025 Posts: 6
|
|
Posted: Thu Feb 06, 2025 2:19 pm |
|
|
Thank you for all your help everyone! This issue is now resolved. Shoutout to the CCS support!
The problem was, the code contained this line:
This also sets the #FUSES DEBUG, etc.
Removing that line, and all the conditional #define ICD_DEBUG and WDT and DEBUG/NODEBUG stuff, and now I no longer get the warning and it appears to work correctly from early testing. Sweet!  |
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19730
|
|
Posted: Fri Feb 07, 2025 2:26 am |
|
|
I think aargh may apply here.....
You were explicitly selecting ICD mode.  |
|
 |
zapados
Joined: 04 Feb 2025 Posts: 6
|
|
Posted: Fri Feb 07, 2025 10:20 am |
|
|
Ttelmah wrote: | I think aargh may apply here.....
You were explicitly selecting ICD mode.  |
Yes, def. aarghh! Lack of understand that #device ICD=TRUE included DEBUG fuse.  |
|
 |
|