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.

CCS/MSP432E401Y: Support for ARM-CGT-CLANG?

Part Number: MSP432E401Y

Tool/software: Code Composer Studio

Seeing that ti-cgt-armllvm_1.1.0-STS is available, was able to download the Linux installer and after installing outside of CCS 10.1.1.00004 was able to get CCS to recognise the compiler.

Using CCS was able to create an empty example project for a MSP432E401Y but upon compiling get the error:

**** Build of configuration Debug for project MSP432E401Y_TI_clag_hello ****

/home/mr_halfword/ti/ccs1011/ccs/utils/bin/gmake -k -j 12 all -O 
 
Building file: "../main.c"
Invoking: ARM Compiler
"/home/mr_halfword/ti/ccs1011/ccs/tools/compiler/ti-cgt-armllvm_1.1.0-STS/bin/tiarmclang" -c -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -mthumb -Og -I"/home/mr_halfword/ti/ccs1011/ccs/ccs_base/arm/include" -I"/home/mr_halfword/ti/ccs1011/ccs/ccs_base/arm/include/CMSIS" -I"/home/mr_halfword/workspace_v10/MSP432E401Y_TI_clag_hello" -I"/home/mr_halfword/ti/ccs1011/ccs/tools/compiler/ti-cgt-armllvm_1.1.0-STS/include" -D__MSP432E401Y__ -Dgcc -gstrict-dwarf -gdwarf-3 -MMD -MP -MF"main.d_raw" -MT"main.o"   -o"main.o" "../main.c"
Finished building: "../main.c"
 
Building file: "../startup_msp432e401y_ccs.c"
Invoking: ARM Compiler
"/home/mr_halfword/ti/ccs1011/ccs/tools/compiler/ti-cgt-armllvm_1.1.0-STS/bin/tiarmclang" -c -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -mthumb -Og -I"/home/mr_halfword/ti/ccs1011/ccs/ccs_base/arm/include" -I"/home/mr_halfword/ti/ccs1011/ccs/ccs_base/arm/include/CMSIS" -I"/home/mr_halfword/workspace_v10/MSP432E401Y_TI_clag_hello" -I"/home/mr_halfword/ti/ccs1011/ccs/tools/compiler/ti-cgt-armllvm_1.1.0-STS/include" -D__MSP432E401Y__ -Dgcc -gstrict-dwarf -gdwarf-3 -MMD -MP -MF"startup_msp432e401y_ccs.d_raw" -MT"startup_msp432e401y_ccs.o"   -o"startup_msp432e401y_ccs.o" "../startup_msp432e401y_ccs.c"
Finished building: "../startup_msp432e401y_ccs.c"
 
Building file: "../system_msp432e401y.c"
Invoking: ARM Compiler
"/home/mr_halfword/ti/ccs1011/ccs/tools/compiler/ti-cgt-armllvm_1.1.0-STS/bin/tiarmclang" -c -mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mlittle-endian -mthumb -Og -I"/home/mr_halfword/ti/ccs1011/ccs/ccs_base/arm/include" -I"/home/mr_halfword/ti/ccs1011/ccs/ccs_base/arm/include/CMSIS" -I"/home/mr_halfword/workspace_v10/MSP432E401Y_TI_clag_hello" -I"/home/mr_halfword/ti/ccs1011/ccs/tools/compiler/ti-cgt-armllvm_1.1.0-STS/include" -D__MSP432E401Y__ -Dgcc -gstrict-dwarf -gdwarf-3 -MMD -MP -MF"system_msp432e401y.d_raw" -MT"system_msp432e401y.o"   -o"system_msp432e401y.o" "../system_msp432e401y.c"
subdir_rules.mk:7: recipe for target 'system_msp432e401y.o' failed
In file included from ../system_msp432e401y.c:35:
In file included from /home/mr_halfword/ti/ccs1011/ccs/ccs_base/arm/include/msp.h:73:
In file included from /home/mr_halfword/ti/ccs1011/ccs/ccs_base/arm/include/msp432e401y.h:196:
In file included from /home/mr_halfword/ti/ccs1011/ccs/ccs_base/arm/include/CMSIS/core_cm4.h:160:
In file included from /home/mr_halfword/ti/ccs1011/ccs/ccs_base/arm/include/CMSIS/cmsis_compiler.h:48:
/home/mr_halfword/ti/ccs1011/ccs/ccs_base/arm/include/CMSIS/cmsis_gcc.h:657:54: error: unknown register name 'vfpcc' in asm
  __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc", "memory");
                                                     ^
1 error generated.
gmake: *** [system_msp432e401y.o] Error 1
gmake: Target 'all' not remade because of errors.

**** Build Finished ****

Is the new ARM-CGT-CLANG compiler supported in CCS 10 yet?

The error in the above example was in the following inline function in cmsis_gcc.h :

/**
  \brief   Set FPSCR
  \details Assigns the given value to the Floating Point Status/Control register.
  \param [in]    fpscr  Floating Point Status/Control value to set
 */
__attribute__((always_inline)) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
{
#if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
     (defined (__FPU_USED   ) && (__FPU_USED    == 1U))     )
  __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc", "memory");
#else
  (void)fpscr;
#endif
}

According to Issue 411803002: Fix for building ARM/linux using clang. (Closed), different conditional compilation is required using __clang__ to select an intrinsic instead of __ASM statement for use with a LLVM-based compiler.

  • The following change to the __set_FPSCR function allowed to compile with ti-cgt-armllvm_1.1.0-STS, but I haven't tested the modified function still works:

    /**
      \brief   Set FPSCR
      \details Assigns the given value to the Floating Point Status/Control register.
      \param [in]    fpscr  Floating Point Status/Control value to set
     */
    __attribute__((always_inline)) __STATIC_INLINE void __set_FPSCR(uint32_t fpscr)
    {
    #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
         (defined (__FPU_USED   ) && (__FPU_USED    == 1U))     )
    #ifdef __clang__
        __builtin_arm_set_fpscr (fpscr);
    #else
      __ASM volatile ("VMSR fpscr, %0" : : "r" (fpscr) : "vfpcc", "memory");
    #endif
    #else
      (void)fpscr;
    #endif
    }
    

  • The files in ccs_install_root/ccs/ccs_base/arm/include are released separately from the compiler.  While I don't know for sure, I suspect they have not been integrated and tested with the TI ARM clang compiler.  I'll confirm that and get back to you.

    Thanks and regards,

    -George

  • Hi Chester,

    Chester Gillon said:
    Is the new ARM-CGT-CLANG compiler supported in CCS 10 yet?

    From what you've described, CCS does seem to support the CLANG compiler.

    George Mock said:
    The files in ccs_install_root/ccs/ccs_base/arm/include are released separately from the compiler.  While I don't know for sure, I suspect they have not been integrated and tested with the TI ARM clang compiler.  I'll confirm that and get back to you.

    George is right here. Unfortunately, the MSP432E4 SDK does not support TIARMCLANG at this time. As an alternative, perhaps you could use the GCC compiler which seems to support Clang extensions. Those extensions are mentioned in the ARM Optimizing C/C++ Compiler v20.2.0.LTS User's Guide.

    CLANG LANGUAGE EXTENSIONS

    Regards,

    James