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

[SOLVED] Warning: The hex file has the debug bit set....

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



Joined: 04 Feb 2025
Posts: 6

View user's profile Send private message

[SOLVED] Warning: The hex file has the debug bit set....
PostPosted: Tue Feb 04, 2025 5:27 pm     Reply with quote

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! Smile


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

View user's profile Send private message

PostPosted: Wed Feb 05, 2025 4:17 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 05, 2025 9:13 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 05, 2025 11:02 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Feb 05, 2025 1:09 pm     Reply with quote

@Ttelmah, interesting, I did NOT have that set. Unfortunately, setting it still produces the warning.
Ttelmah



Joined: 11 Mar 2010
Posts: 19730

View user's profile Send private message

PostPosted: Thu Feb 06, 2025 3:52 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Feb 06, 2025 9:13 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Feb 06, 2025 2:19 pm     Reply with quote

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:

Code:
#device ICD=TRUE


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! Smile
Ttelmah



Joined: 11 Mar 2010
Posts: 19730

View user's profile Send private message

PostPosted: Fri Feb 07, 2025 2:26 am     Reply with quote

I think aargh may apply here..... Very Happy

You were explicitly selecting ICD mode. Sad
zapados



Joined: 04 Feb 2025
Posts: 6

View user's profile Send private message

PostPosted: Fri Feb 07, 2025 10:20 am     Reply with quote

Ttelmah wrote:
I think aargh may apply here..... Very Happy

You were explicitly selecting ICD mode. Sad


Yes, def. aarghh! Lack of understand that #device ICD=TRUE included DEBUG fuse. Embarassed
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