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.

Compiler/MSP430F5529: Symbol "CdcWriteCtrl" has already been defined when using whole program optimizations

Part Number: MSP430F5529

Tool/software: TI C/C++ Compiler

I am trying to enable optimizations on some code I have written based on the C6_SendDataBackground USB CDC example from the USB developers package. When I switch to release mode and enable the whole program optimizations I receive the following errors:

<Linking>
error: symbol "CdcWriteCtrl" has already been defined
error: symbol "CdcReadCtrl" has already been defined
error: symbol "CdcWriteCtrl" has already been defined
error: symbol "CdcReadCtrl" has already been defined
error: symbol "CdcWriteCtrl" has already been defined
error: symbol "CdcReadCtrl" has already been defined
error: symbol "CdcWriteCtrl" has already been defined
error: symbol "CdcReadCtrl" has already been defined
error: symbol "CdcWriteCtrl" has already been defined
error: symbol "CdcReadCtrl" has already been defined
error: symbol "CdcWriteCtrl" has already been defined
error: symbol "CdcReadCtrl" has already been defined

I am able to replicate this error with the C6_SendDataBackgound example by switching to release and setting the Optimization Level to 4.

Is there a way to work around this error by changing the provided code in the example or is this a bug in the compiler?

The compiler version is 18.1.3.LTS.

These are the flags set:

-vmspx --data_model=restricted -O4 --use_hw_mpy=F5 --include_path="C:/ti/ccs820/ccsv8/ccs_base/msp430/include" --include_path="C:/Users/kevin/workspace_v8/C6_SendDataBackground" --include_path="C:/Users/kevin/workspace_v8/C6_SendDataBackground/driverlib/MSP430F5xx_6xx" --include_path="C:/Users/kevin/workspace_v8/C6_SendDataBackground/USB_config" --include_path="C:/ti/ccs820/ccsv8/tools/compiler/ti-cgt-msp430_18.1.3.LTS/include" --advice:power="none" --define=__MSP430F5529__ --define=DEPRECATED --printf_support=minimal --diag_warning=225 --diag_wrap=off --display_error_number --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40

Thanks

  • Hello Kevin,

    I'll have to confer with our USB Stack expert here. I should be able to get back to you by Thursday.
  • Hello Kevin,

    We are still looking into this and seems to be an issue with the USB Stack. Hopefully we can get back to you by Wednesday next week.
  • Hello Kevin,

    Thank you for finding this issue.  The fix for this issue for you to be able to compile the code without error at level 4 optimization requires three changes to CdcUsb.h, CdcUsb.c and usb.c files.

    1) In CdcUsb.h file, the existing _CdcWrite and _CdcRead structures have to be declared with typedef as follows:

    typedef struct _CdcWrite {
    ....
     }_CdcWrite;
    
    typedef struct _CdcRead {
     ...
    }_CdcRead;

     

    2) In CdcUsb.c file, define the structures as follows:

    _CdcWrite CdcWriteCtrl[CDC_NUM_INTERFACES]; 
    _CdcRead CdcReadCtrl[CDC_NUM_INTERFACES];

    3) In usb.c file extern the structures as follows:

    extern _CdcWrite CdcWriteCtrl[CDC_NUM_INTERFACES]; 
    extern _CdcRead CdcReadCtrl[CDC_NUM_INTERFACES];

    A bug report has been filed against the USB stack to correct this issue in the next release of the stack.

    Regards,

    Arthi

**Attention** This is a public forum