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.

DriverLib, C++, and MSP432

Other Parts Discussed in Thread: MSP430FR5969

Hi,

I'm having problems compiling with MSP432, driverlib, and using C++.

I have MSPWare_2_10_00_15 and I'm using the MSP432P4xx folder. I import the empty project into CCS 6.1 from MSPWare/Libraries/MSP432P4xx using Resource Explorer. This compiles fine. Then I change main.c to main.cpp and compile with errors. It seems these three functions are declared elsewhere, maybe the library file?

Description    Resource    Path    Location    Type
#339 linkage specification is incompatible with previous "__nop" (declared at line 45)    .ccsproject    /empty_project    line 45, external location: C:\ti\ccsv6\ccs_base\arm\include\CMSIS\cmsis_ccs.h    C/C++ Problem
#339 linkage specification is incompatible with previous "__wfe" (declared at line 57)    .ccsproject    /empty_project    line 57, external location: C:\ti\ccsv6\ccs_base\arm\include\CMSIS\cmsis_ccs.h    C/C++ Problem
#339 linkage specification is incompatible with previous "__wfi" (declared at line 51)    .ccsproject    /empty_project    line 51, external location: C:\ti\ccsv6\ccs_base\arm\include\CMSIS\cmsis_ccs.h    C/C++ Problem

I've done a few tests:

  1. I've done the same thing with the MSP430FR5969 driverlib empty project. This compiles fine with the main.cpp. There's no library file.
  2. I've done the same thing with the MSP432 empty project (no driverlib). This compiles fine with the main.cpp.
  3. I've also turned on the Disable Intrinsic Functions checkbox on the MSP432 driverlib empty project. This compiles fine with the main.cpp. This fix is not ideal though.

Please help,

Thanks,

Titus

  • Titus Appel said:
    It seems these three functions are declared elsewhere, maybe the library file?

    From investigating, the __nop, __nop and __wfe functions are intrinsic functions in the TI ARM v5.2.x compiler.

    While the __nop, __nop and __wfe intrinsic functions are not documented in the ARM Optimizing C/C++ Compiler v5.2 User's Guide SPNU151J, I found that the previous TI ARM compiler v5.1.11 doesn't have the __nop, __nop and __wfe intrinsic functions. i.e. using main.cpp with the driverlib empty_project for a MSP432P401R generates compile errors when used with TI ARM compiler v5.2.4, but compiles without error when using TI ARM compiler v5.1.11.

    Therefore, the problem is a C++ linkage conflict between the __nop, __wfi and __wfe functions in the ccsv6/ccs_base/arm/include/CMSIS/cmsis_ccs.h include file and the built-in intrinsic functions in the TI ARM v5.2.x compiler.

    Another work-around is to edit the ccsv6/ccs_base/arm/include/CMSIS/cmsis_ccs.h in the CCS 6.1 include file to place the __nop, __wfi and __wfe functions in a #if block:

    #if !defined (__TI_COMPILER_VERSION__)  || (__TI_COMPILER_VERSION__ < 5002000)
    
    // No Operation
    __attribute__( ( always_inline ) ) static inline void __nop(void)
    {
    	__asm("  nop");
    }
    
    // Wait For Interrupt
    __attribute__( ( always_inline ) ) static inline void __wfi(void)
    {
    	__asm("  wfi");
    }
    
    // Wait For Event
    __attribute__( ( always_inline ) ) static inline void __wfe(void)
    {
    	__asm("  wfe");
    }
    
    #endif
    

    This means that if compiling with the TI ARM v5.2.x or later compiler that the conflicting __nop, __wfi and __wfe functions in the cmsis_ccs.h include file are #ifdef'ed out and the compiler intrinsic versions are used instead. Whereas if using a different compiler the functions in the cmsis_ccs.h include file are used instead. This is not ideal as you have to modify the CCS installation.

  • Hello all,

    A little late on this topic- but I have brought this to the attention to the compiler/CCS team and we are looking into fixing this in the next version.

    Best Regards,
  • Yesterday -after the latest update- this error popped up in my MSP432 projects. There were a couple of symbols related to the passwords on certain protected modules that needed to be changed too.

    I added the conditional on the cmsis file and it worked though.

    Regards,
    Pibe

**Attention** This is a public forum