I need to be able to have _DEBUG defined in my Debug target but not my Release target. This seems to be already set up in CW, but the makefiles seem to be ignoring it.
In Project->Properties->C/C++ Build->Settings, in the Target Settings tab, in Coldfire Compiler->Language Settings, in Other flags,
I have -define _DEBUG=1.
However, when I compile the "Other flags" are ignored.
You can see this in the output below in the line starting with "C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwccmcf".
**** Build of configuration Debug_MCF52258_Int_Flash for project app_NGUC_SingleBoard_52258 ****
"C:\\Freescale\\CW MCU v10.6\\gnu\\bin\\mingw32-make" all
'Building file: ../Sources/_Components/SystemInformation.cpp'
'Executing target #65 ../Sources/_Components/SystemInformation.cpp'
'Invoking: ColdFire Compiler'
"C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwccmcf" @@"Sources/_Components/SystemInformation.args" -o "Sources/_Components/SystemInformation_cpp.obj" "../Sources/_Components/SystemInformation.cpp" -MD -gccdep
'Finished building: ../Sources/_Components/SystemInformation.cpp'
' '
'Building target: Singleboard_D_V3_.elf'
'Executing target #66 Singleboard_D_V3_.elf'
'Invoking: ColdFire Linker'
"C:/Freescale/CW MCU v10.6/MCU/ColdFire_Tools/Command_Line_Tools/mwldmcf" -o "Singleboard_D_V3_.elf" @@"Singleboard_D_V3_.args"
'Finished building target: Singleboard_D_V3_.elf'
' '
This project is for the MCF52258.
Please tell me how I can get the compiler to actually use the Other flags. Thank you.
Solved! Go to Solution.
Well I finally found the answer. The code that depends on _DEBUG was actually being compiled. However, CW was visually indicating that it was not compiled. As you can see in the image from my post from Jan 8, the code that depends on _DEBUG is grayed out, indicating that it was not compiled. That, however, is in error.
The problem arises because _DEBUG is defined in the compiler command line rather than in the code. Apparently, CW does not recognize such defines, and shows the code grayed out when it should not (and conversely shows other code as being compiled when it is not).
I would call this a CW bug, but maybe it's simply a "missing feature". I'm using CW 10.6, but I remember this being a problem with 9.2 as well. Maybe it's systemic.
Hi Frank,
I've performed some tests with MCU V10.6.4 + all patches and TWR-MCF5225X board (MCF52559).
I've created a project containing 3 targets based on same source files.
The difference is done via compiler option where I've defined macro by 3 ways:
- my_debug_1 -> add option -define MY_DEBUG_1=1 in the Coldfire compiler ¦ Language Settings + Other Flags,
- my_debug_2 -> add macro MY_DEBUG_2 in the Coldfire Compiler ¦ Preprocessor,
- my_debug_3 -> add option -define MY_DEBUG_3=1 in the Coldfire Compiler + Command.
To be running on my board I've modified the debug configuration for each target.
Open the debug configuration to see:
Test_debug_1,
Test_debug_2,
Test_debug_3.
On my side the 3 targets are working as expected.
Please have a look in attachment.
Have a great day,
Pascal
NXP Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I cannot compile your project. I get the error
undefined macro '_lint' used in #if or #elif conditional (included from:
C:\Freescale\CW MCU v10.6\MCU\ColdFire_Support\ewl\EWL_C\include\ewlGlobals.h:12
C:\Freescale\CW MCU v10.6\MCU\ColdFire_Support\ewl\EWL_C\include\ansi_parms.h:13
C:\Freescale\CW MCU v10.6\MCU\ColdFire_Support\ewl\EWL_C\include\stdio.h:11
C:\projects\workspace\Test\Sources\main.c:10)
Test line 189, external location: C:\Freescale\CW MCU v10.6\MCU\ColdFire_Support\ewl\EWL_C\include\coldfire\ansi_prefix.CF.h
So I went into ansi_prefix.CF.h and defined _lint. It compiles, but none of your defines are being used.
I'm using CW 10.6.3 so I'll try updating to 10.6.4. I've noticed there is also an Update 5 to 10.6.4. Is this the latest patch set?
Hi Frank,
On my side I don't get errors but warnings.
You can remove them by unchecking the option "Undefined Macro in #if" in ColdFire Compiler + Warnings.
Attached you will find the same project running under MCU V10.6.3.
It's working on my side.
Regarding the update, the last one is Update 6 on MCU v10.6.4 which is a new installation.
You can have several instance and so keep the MCU v10.6.3
Have a great day,
Pascal
NXP Technical Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
I looked into this a bit more and found that the define is happening in the .args file. I did find this there:
-define __CODEWARRIOR__=1
-define _DEBUG=1
However the code that uses _DEBUG is not being compiled.
I included a screenshot so that you can see that the code depending on _DEBUG is not being compiled (it is grayed out). This occurs for both the Debug and Release targets.
Well I finally found the answer. The code that depends on _DEBUG was actually being compiled. However, CW was visually indicating that it was not compiled. As you can see in the image from my post from Jan 8, the code that depends on _DEBUG is grayed out, indicating that it was not compiled. That, however, is in error.
The problem arises because _DEBUG is defined in the compiler command line rather than in the code. Apparently, CW does not recognize such defines, and shows the code grayed out when it should not (and conversely shows other code as being compiled when it is not).
I would call this a CW bug, but maybe it's simply a "missing feature". I'm using CW 10.6, but I remember this being a problem with 9.2 as well. Maybe it's systemic.