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.

Preprocessor Definitions in startup_ccs.c



I've been using Code Composer's project properties dialog to set up pre-processsor definitions.

I attempted to add a new pre-processor definition today and use it as I have in the past to set up the interrupts table in startup_ccs.c.

For instance I just added a PART_BOOSTXLSENSHUB definition to my list of flags

project -> Properties -> CCS Build -> ARM Compiler -> Summary of flags set:

...--define=PART_TM4C123GH6PM --define=TARGET_IS_TM4C123_RB1 --define=DEBUG --define=PART_CONSOLE --define=PART_LED --define=PART_COM_INPUT --define=PART_BOOSTXLSENSHUB...

In startup_ccs.c I have a few conditionals

//*****************************************************************************
//
// External declarations for the interrupt handlers used by the application.
//
//*****************************************************************************
// To be added by user
#ifdef PART_COM_INPUT
    #warning "PART_COM_INPUT"
    extern void comIntHandler(void);
#endif

#ifdef PART_SDCARD
    #warning "PART_SDCARD"
    extern void sysTickHandler(void);
#endif

#ifdef PART_BOOSTXLSENSHUB
    #warning "PART_BOOSTXLSENSHUB"
    extern void mpu9150IntGPIO(void);
    extern void tmp006IntGPIO(void);
    extern void boostxlsenshubIntHandler(void);
#endif

and then later on

#pragma DATA_SECTION(g_pfnVectors, ".intvecs")
void (* const g_pfnVectors[])(void) =
{
    (void (*)(void))((uint32_t)&__STACK_TOP),
                                            // The initial stack pointer
    ...
    IntDefaultHandler,                      // Debug monitor handler
    0,                                      // Reserved
    IntDefaultHandler,                      // The PendSV handler
    #ifdef PART_SDCARD
        sysTickHandler,                     // The SysTick handler
    #else
        IntDefaultHandler,                  // The SysTick handler
    #endif
    IntDefaultHandler,                      // GPIO Port A
    #ifdef PART_BOOSTXLSENSHUB
        mpu9150IntGPIO,                     // GPIO Port B
    #else
        IntDefaultHandler,                  // GPIO Port B
    #endif
    ...

When I build this project I'm expecting to see a #warning for PART_BOOSTXLSENSHUB and PART_COM_INPUT.

What I actually get is 

Description	Resource	Path	Location	Type
#1181-D #warning directive: "PART_COM_INPUT"	startup_ccs.c	/project_base123g	line 59	C/C++ Problem
#1181-D #warning directive: "PART_SDCARD"	startup_ccs.c	/project_base123g	line 64	C/C++ Problem

I found this strange. Since PART_SDCARD wasn't currently in my flag list.

I did some digging and found that in .cproject there were two sections with PART_ definitions, one that corresponded with what I had added to the flags list.

<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compilerID.DEFINE.572145206" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compilerID.DEFINE" valueType="definedSymbols">
	<listOptionValue builtIn="false" value="css=&quot;css&quot;"/>
	<listOptionValue builtIn="false" value="PART_TM4C123GH6PM"/>
	<listOptionValue builtIn="false" value="TARGET_IS_TM4C123_RB1"/>
	<listOptionValue builtIn="false" value="DEBUG"/>
	<listOptionValue builtIn="false" value="PART_CONSOLE"/>
	<listOptionValue builtIn="false" value="PART_LED"/>
	<listOptionValue builtIn="false" value="PART_COM_INPUT"/>
	<listOptionValue builtIn="false" value="PART_BOOSTXLSENSHUB"/>
</option>

And another section that contained flags that were visible to the startup_ccs.c file

<option id="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compilerID.DEFINE.1353091247" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compilerID.DEFINE" valueType="definedSymbols">
	<listOptionValue builtIn="false" value="css=&quot;css&quot;"/>
	<listOptionValue builtIn="false" value="PART_TM4C123GH6PM"/>
	<listOptionValue builtIn="false" value="TARGET_IS_TM4C123_RB1"/>
	<listOptionValue builtIn="false" value="DEBUG"/>
	<listOptionValue builtIn="false" value="PART_CONSOLE"/>
	<listOptionValue builtIn="false" value="PART_LED"/>
	<listOptionValue builtIn="false" value="PART_COM_INPUT"/>
	<listOptionValue builtIn="false" value="PART_COM_LOCK"/>
	<listOptionValue builtIn="false" value="PART_SDCARD"/>
	<listOptionValue builtIn="false" value="FLAG_SDCARD_READ_CMD"/>
</option>

I can't seem to find where in the CCS project properties these flags are set. Is this something that has changed between CCS updates? I'm currently running "Version: 6.0.0.00190".

  • Hello Jamie

    Did you try to Clean-Rebuild it and instead of Build?

    Regards
    Amit
  • Clean-Rebuild didn't do the trick, it made no changes to .cproject

  • Hello Jamie,

    Please send in your CCS Project?

    Regards
    Amit
  • I just attempted to replicate the error scenario. Imported uart_echo, added a pre-processor flag and checked for it's existance in startup_ccs.c

    I wasn't able to replicate the problem.

    Taking a look at the .cproject file there was no startup_ccs.c section (that was in the problematic project)

    <fileInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1027142496.207093999" name="startup_ccs.c" rcbsApplicability="disable" resourcePath="startup_ccs.c" toolsToInvoke="com.ti.ccstudio.buildDefinitions.TMS470_5.1.exe.compilerDebug.1620507170.1109733085">
        <tool id="com.ti.ccstudio.buildDefinitions.TMS470_5.1.exe.compilerDebug.1620507170.1109733085" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.1.exe.compilerDebug.1620507170">
            <option id="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compilerID.DEFINE.1353091247" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compilerID.DEFINE" valueType="definedSymbols">
                <listOptionValue builtIn="false" value="css=&quot;css&quot;"/>
                <listOptionValue builtIn="false" value="PART_TM4C123GH6PM"/>
                <listOptionValue builtIn="false" value="TARGET_IS_TM4C123_RB1"/>
                <listOptionValue builtIn="false" value="DEBUG"/>
                <listOptionValue builtIn="false" value="PART_CONSOLE"/>
                <listOptionValue builtIn="false" value="PART_LED"/>
                <listOptionValue builtIn="false" value="PART_COM_INPUT"/>
                <listOptionValue builtIn="false" value="PART_COM_LOCK"/>
                <listOptionValue builtIn="false" value="PART_SDCARD"/>
                <listOptionValue builtIn="false" value="FLAG_SDCARD_READ_CMD"/>
            </option>
            <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compiler.inputType__C_SRCS.1865819232" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compiler.inputType__C_SRCS"/>
            <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compiler.inputType__CPP_SRCS.557310513" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compiler.inputType__CPP_SRCS"/>
            <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compiler.inputType__ASM_SRCS.1082508177" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compiler.inputType__ASM_SRCS"/>
            <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compiler.inputType__ASM2_SRCS.852164449" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_5.1.compiler.inputType__ASM2_SRCS"/>
        </tool>
    </fileInfo>

    I'm not sure how that section was introduced to the problem project. When it was removed the standard flags became visible to startup_ccs.c

  • Hello Jamie,

    Sometimes tools don't do what they are expected to do!!!

    Regards
    Amit