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.

C6000-CGT: There is a build error when compiling SYS/BIOS 6.83.0 with new CGT 8.5.0.LTS

Part Number: C6000-CGT
Other Parts Discussed in Thread: TMS320C6678, SYSBIOS

Tool/software:

When I build project containing SYS/BIOS with new CGT 8.5.0.LTS, I got an error:

"C:/TI/bios_6_83_00_18/packages/ti/posix/ccs/time.h", line 103: error #102: "timespec" has already been declared in the current scope
"C:/TI/bios_6_83_00_18/packages/ti/posix/ccs/time.h", line 108: error #102: "itimerspec" has already been declared in the current scope

2 errors detected in the compilation of "C:/TI/bios_6_83_00_18/packages/ti/posix/tirtos/clock.c"

With older CGT 8.3.13 all work fine.

I use:

CCS 12.8.1, SYS/BIOS 6.83.0.18.

  • Hello,

    Which device are you working with?

    Thanks

    ki

  • Thank you. I will bring this thread to the attention of the device experts.

  • Hi Valentin,

    Is this on TMS320C6678 or a different part number?

    Regards,

    Takuma

  • Hi Takuma,

    Exactly on TMS320C6678

  • Hi Valentin,

    Let me check on this from our end and let you know.

    Regards,

    Betsy Varughese

  • Hi Valentin,

    I could able to reproduce the issue with CGT 8.5.0.LTS using the test code below. 

    #include <stdio.h>
    //#include <time.h>                  // C66xx CGT run time header
    #include <ti/posix/ccs/time.h>       // POSIX header from BIOS
    
    int main(void)
    {
    #ifdef _STRUCT_TIMESPEC
        printf("C66x CGT runtime defines timespec\n");
    #endif
    
    #ifdef ti_posix_ccs_time__include
        printf("POSIX from BIOS defines timespec\n");
    #endif
    
        struct timespec ts;
        ts.tv_sec = 1;
        ts.tv_nsec = 1000;
        printf("timespec.tv_sec = %ld, tv_nsec = %ld\n", (long)ts.tv_sec, ts.tv_nsec);
        return 0;
    }
    

    I was able to idenify the root cause (see, the attached screenshot)

    In CGT v8.5, the runtime library’s <time.h> header introduces an additional include chain:

    • <time.h> now includes <sys/timespec.h>,
    • which in turn includes <sys/_timespec.h>.

    Through this chain, both struct itimerspec and struct timespec are defined by the compiler’s standard headers. This creates a conflict with the TI-RTOS POSIX layer (ti/posix/ccs/time.h), which also declares the same structures, leading to the redefinition errors.

    In earlier CGT versions (e.g., v8.3), <time.h> did not include <sys/timespec.h>, so timespec and itimerspec were not pulled in from the runtime library. As a result, only the TI-RTOS POSIX header provided those definitions, and no conflict occurred.

    To avoid this (If you want to use CGT v8.5) ,

    When working with BIOS/TI-RTOS, include "#include <ti/posix/ccs/time.h>" to ensure you are using the POSIX layer.

    If you only require the compiler’s standard runtime support, include "#include <time.h>" to rely on the CGT runtime library.

    Regards,

    Betsy Varughese

  • Unfortunately, this error appears before the compiler starts with my own code. Error appears when it compiles BIOS itself. In my example -bios_6_83_00_18/packages/ti/posix/tirtos/clock.c

    I think, I need to alter BIOS's code.

  • Hi Valentin,

    Unfortunately, this error appears before the compiler starts with my own code. Error appears when it compiles BIOS itself. In my example -bios_6_83_00_18/packages/ti/posix/tirtos/clock.c

    This actually points to a toolchain vs. BIOS header clash only. (See the attached screenshot above (CGT v8.5)) 

    (as you have confirmed its working fine with CGT v8.3)

    Regards,

    Betsy Varughese

  • Looks like you're right. It's needed to alter BIOS code (because it is out of support as I know).

  • Hi Valentin,

    Yes, Exactly. According to the release notes, BIOS 6.83.00.18 was validated with C66x CGT 8.3.2 LTS, so it is recommended to use that specific compiler version for best compatibility.

    Best Regards,

    Betsy Varughese

  • I've built a solution!

    It should be made two edits in SYS/BIOS sources:

    1. [packages/ti/posix/ccs/time.h] Add inclusion of <time.h> instead of defining `timespec` and `itimerspec` by BIOS itself. But only for CGT for C6000 and version >= 8.5.0

    ...
    #elif defined(__TMS320C6X__) && (__TI_COMPILER_VERSION__ >= 8'005'000)
    #include <time.h>
    #else
    ...

    This makes project buildable.

    2. [packages/ti/sysbios/hal/Seconds.xdt] Second correction is needed to suppress the warning about constant 2208988800 that overflows 32-bit integer. Because this constant appears in autogenerated c-code the edit should be made in template `Seconds.xdt` - just add `u` making the constant unsigned.

        t += 2208988800u;

    Below is a link to the patch-file

    https://gist.github.com/chemandante/660e1c13fe0f4a83c5bb6a6e8c420867