This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

BIOS definitions of TRUE/FALSE causing problems with C macro expressions

Other Parts Discussed in Thread: CCSTUDIO

BIOS Team,

This problem relates to BIOS5.41 on C6000. The following definitions of TRUE/FALSE are causing problems for us.

#define FALSE ((Bool)0) /* C:/CCStudio_v3.3/bios_5_41_02_14/packages/ti/bios/include/std.h */
#define TRUE ((Bool)1) /* C:/CCStudio_v3.3/bios_5_41_02_14/packages/ti/bios/include/std.h */

The macro code below (3rd party code) is skipped because TRUE and FALSE are already defined in the BIOS std.h file.

#ifndef TRUE
  #define TRUE                      (1)
  #define FALSE                     (0)
#endif

This then causes a compiler error at line X below because of the preprocessor can't handle the (bool) casting.

#define   THIS_FLAG      TRUE
 
#if  THIS_FLAG           // Line X
...
#endif

Unfortunately this affects a significant amount of 3rd party code. What solutions can you suggest? Does BIOS really need these definitions of TRUE/FALSE or can we just redefine these for use as preprocessor variables?

Ruben

  • I've never seen this problem before.   I don’t think we really need that (Bool) cast.  I think customer can safely change his logic above to the following:

     

    #ifdef TRUE

      #undef TRUE

      #undef FALSE
      #define TRUE                      (1)
      #define FALSE                     (0)
    #endif