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.

Linker error for CCS4 with MSP430F2132

Other Parts Discussed in Thread: MSP430F2132

I downloaded the core version of CCS4 that is available online. I tried out the sample examples of MSP430F2132 and they worked fine on CCS4. However when I ran my custom code I got tons of "symbols redefined errors". I then modified the MSP430 linker option for command line pattern to ${command}${inputs} ${flags} ${output_flag} ${output}

by doing this I was able to get rid of all the  "symbols redefined errors" but I got the following errors:

WARNING: invalid compiler option --llibc.a (ignored)

"../lnk_msp430f2132.cmd", line 21: error: this declaration has no storage class or type specifier

"../lnk_msp430f2132.cmd", line 22: error: expected a ";"

 

I don't know how to rectify this error so please provide some hints on the error. 

Moreover I tried compiling and building my code in IAR and it just worked fine. I am therefore confused on what exactly is happening. 

 

Please help!

 

 

Thanks,

Rahul 

  • Hi Rahul,

    Can you post your linker file here? It will be easier to point out the errors.

    Regards,

    Sid

  • Hi Sid, 

    Here is the linker file 

     

    /******************************************************************************/

    /* lnk_msp430f2132.cmd - LINKER COMMAND FILE FOR LINKING MSP430F2132 PROGRAMS     */

    /*                                                                            */

    /*   Usage:  lnk430 <obj files...>    -o <out file> -m <map file> lnk.cmd     */

    /*           cl430  <src files...> -z -o <out file> -m <map file> lnk.cmd     */

    /*                                                                            */

    /*----------------------------------------------------------------------------*/

    /* These linker options are for command line linking only.  For IDE linking,  */

    /* you should set your linker options in Project Properties                   */

    /* -c                                               LINK USING C CONVENTIONS  */

    /* -stack  0x0100                                   SOFTWARE STACK SIZE       */

    /* -heap   0x0100                                   HEAP AREA SIZE            */

    /*                                                                            */

    /*----------------------------------------------------------------------------*/

     

     

    /****************************************************************************/

    /* SPECIFY THE SYSTEM MEMORY MAP                                            */

    /****************************************************************************/

     

    MEMORY

    {

        SFR                     : origin = 0x0000, length = 0x0010

        PERIPHERALS_8BIT        : origin = 0x0010, length = 0x00F0

        PERIPHERALS_16BIT       : origin = 0x0100, length = 0x0100

        RAM                     : origin = 0x0200, length = 0x0200

        INFOA                   : origin = 0x10C0, length = 0x0040

        INFOB                   : origin = 0x1080, length = 0x0040

        INFOC                   : origin = 0x1040, length = 0x0040

        INFOD                   : origin = 0x1000, length = 0x0040

        FLASH                   : origin = 0xE000, length = 0x1FDE

        INT00                   : origin = 0xFFE0, length = 0x0002

        INT01                   : origin = 0xFFE2, length = 0x0002

        INT02                   : origin = 0xFFE4, length = 0x0002

        INT03                   : origin = 0xFFE6, length = 0x0002

        INT04                   : origin = 0xFFE8, length = 0x0002

        INT05                   : origin = 0xFFEA, length = 0x0002

        INT06                   : origin = 0xFFEC, length = 0x0002

        INT07                   : origin = 0xFFEE, length = 0x0002

        INT08                   : origin = 0xFFF0, length = 0x0002

        INT09                   : origin = 0xFFF2, length = 0x0002

        INT10                   : origin = 0xFFF4, length = 0x0002

        INT11                   : origin = 0xFFF6, length = 0x0002

        INT12                   : origin = 0xFFF8, length = 0x0002

        INT13                   : origin = 0xFFFA, length = 0x0002

        INT14                   : origin = 0xFFFC, length = 0x0002

        RESET                   : origin = 0xFFFE, length = 0x0002

    }

     

    /****************************************************************************/

    /* SPECIFY THE SECTIONS ALLOCATION INTO MEMORY                              */

    /****************************************************************************/

     

    SECTIONS

    {

        .bss       : {} > RAM                /* GLOBAL & STATIC VARS              */

        .sysmem    : {} > RAM                /* DYNAMIC MEMORY ALLOCATION AREA    */

        .stack     : {} > RAM (HIGH)         /* SOFTWARE SYSTEM STACK             */

     

        .text      : {} > FLASH              /* CODE                              */

        .cinit     : {} > FLASH              /* INITIALIZATION TABLES             */

        .const     : {} > FLASH              /* CONSTANT DATA                     */

        .cio       : {} > RAM                /* C I/O BUFFER                      */

     

        .pinit     : {} > FLASH              /* C++ CONSTRUCTOR TABLES            */

     

        .infoA     : {} > INFOA              /* MSP430 INFO FLASH MEMORY SEGMENTS */

        .infoB     : {} > INFOB

        .infoC     : {} > INFOC

        .infoD     : {} > INFOD

     

        .int00   : {} > INT00                /* MSP430 INTERRUPT VECTORS          */

        .int01   : {} > INT01

        .int02   : {} > INT02

        .int03   : {} > INT03

        .int04   : {} > INT04

        .int05   : {} > INT05

        .int06   : {} > INT06

        .int07   : {} > INT07

        .int08   : {} > INT08

        .int09   : {} > INT09

        .int10   : {} > INT10

        .int11   : {} > INT11

        .int12   : {} > INT12

        .int13   : {} > INT13

        .int14   : {} > INT14

        .reset   : {} > RESET              /* MSP430 RESET VECTOR               */ 

    }

     

    /****************************************************************************/

    /* INCLUDE PERIPHERALS MEMORY MAP                                           */

    /****************************************************************************/

     

    -l msp430f2132.cmd

     

  • Rahul,

    What is the complete link command being passed to the linker as seen in the CCS build window?

    It should be something like:
    'Invoking: Linker'
    "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/msp430/bin/cl430" --silicon_version=mspx -g --diag_warning=225 --printf_support=minimal -z ........... -o "abc.out"  "./abc.obj" -l"libc.a" "../lnk_msp430f2132.cmd"
    <Linking>

    The linker options and input files all appear after the "cl430 -z" where -z is what tells the shell to invoke the linker. If you have switched around your command line to put ${inputs} before ${flags}, the input files may be getting treated as input files to the compiler rather than the linker, which seems to correlate from the type of error mesasge coming out.

    I would recommend leaving the command line as-is and trying to eliminate the "symbol redefined errors" instead. You could look at which symbols give the redefined errors and check whether they are defined in multiple header/command files.

  • Hi,

    The complete link command is 

    'Invoking: Linker'

    "C:/Program Files/Texas Instruments/ccsv4/tools/compiler/msp430/bin/cl430" "./main.obj" "./SelfTestFunc.obj" -l"libc.a" "../lnk_msp430f2132.cmd"  --silicon_version=msp -g --diag_warning=225 --printf_support=minimal -z -m"Self_test.map" --stack_size=80 --heap_size=80 --warn_sections -i"C:/Program Files/Texas Instruments/ccsv4/msp430/include" -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/msp430/lib" -i"C:/Program Files/Texas Instruments/ccsv4/tools/compiler/msp430/include" --reread_libs --rom_model -o "Self_test.out"

    [lnk_msp430f2132.cmd]

    >> WARNING: invalid compiler option --llibc.a (ignored)

    "../lnk_msp430f2132.cmd", line 21: error: this declaration has no storage class or type specifier

    "../lnk_msp430f2132.cmd", line 22: error: expected a ";"

    At end of source: warning: parsing restarts here after previous syntax error

    2 errors detected in the compilation of "../lnk_msp430f2132.cmd".

     

    he linker options and input files all appear after the "cl430 -z" where -z is what tells the shell to invoke the linker. If you have switched around your command line to put ${inputs} before ${flags}, the input files may be getting treated as input files to the compiler rather than the linker, which seems to correlate from the type of error mesasge coming out.

    I would recommend leaving the command line as-is and trying to eliminate the "symbol redefined errors" instead. You could look at which symbols give the redefined errors and check whether they are defined in multiple header/command files.

     

    The "symbol redefined errors" have been looked at. I have not defined it multiple times and its defined in one header file which has been appropriately commanded with the following sequence. 

    #ifndef 

    #define

    #endif

    I have also tried # pragma once and have also tried defining my variables as "extern" but I still get the same "symbol redefined errors" ..... none of the techniques seem to work. 

     

     

    Thanks,

    Rahul 

  • If the linker is complaining about redefined symbols, it usually means that the symbols are defined (not declared) in more than one object file. The exact error message will often tell where the symbols are defined first and second time.

    A common error is that a variable in a header file is not declared but defined (initialized). While with the proper #ifndef/#define/#endif sequence each header file is oly include once per compilation unit (else the compiler would complain), it is included once for each separate compilation unit. And for each defined variable, a global symbol is exported in every object file. The linker will see them as same symbols with different values.

    It is also possible, that you use symbols which are also defined in the libraries you include. This will also cause a redefinition error in the linker.

    Keep in mind that CCE and IAR, while both being C compilers, are independent of each other and might not be fully compatible even on source level or included standard libraries. So that it works on IAR might point to some IAR specific thing (maybe a macro or pragma) that is interpreted differently under CCE and causes the problem.

**Attention** This is a public forum