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/EVM430-FR6047: Linker errors: "undefined symbol"

Part Number: EVM430-FR6047
Other Parts Discussed in Thread: MSP430FR6047

Tool/software: Code Composer Studio

The linker is giving me "undefined symbol" errors on most of the statements in the original post:

#include <msp430.h>
#include <driverlib.h>
#include <stdint.h>

void main(void) {
    // WDTCTL = WDTPW | WDTHOLD; // Stop watchdog timer
    WDT_A_hold(WDT_A_BASE);

    //P7.5 output
    GPIO_setAsOutputPin(GPIO_PORT_P7,GPIO_PIN5);


    /*
    * Disable the GPIO power-on default high-impedance mode to activate
    * previously configured port settings
    */
    PMM_unlockLPM5();

    while(1)
    {
        //toggle pins
        GPIO_toggleOutputOnPin(GPIO_PORT_P7,GPIO_PIN5);

        __delay_cycles(1000000);
    }
}

Here are the linker errors:

Building target: "rioGpioBlink01.out"
Invoking: MSP430 Linker
"C:/ti/ccsv8/tools/compiler/ti-cgt-msp430_18.1.6.LTS/bin/cl430" -vmspx --data_model=restricted --use_hw_mpy=F5 --advice:power=all --advice:hw_config=all --define=__MSP430FR6047__ --define=_MPU_ENABLE -g --printf_support=minimal --diag_warning=225 --diag_wrap=off --display_error_number --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU40 -z -m"rioGpioBlink01.map" --heap_size=160 --stack_size=160 --cinit_hold_wdt=on -i"C:/ti/ccsv8/ccs_base/msp430/include" -i"C:/ti/ccsv8/ccs_base/lib" -i"C:/ti/ccsv8/ccs_base/msp430/lib/5xx_6xx_FRxx" -i"C:/ti/ccsv8/ccs_base/msp430/lib/FR59xx" -i"C:/ti/ccsv8/tools/compiler/ti-cgt-msp430_18.1.6.LTS/lib" -i"C:/ti/ccsv8/tools/compiler/ti-cgt-msp430_18.1.6.LTS/include" --priority --reread_libs --define=_MPU_ENABLE --diag_wrap=off --display_error_number --warn_sections --xml_link_info="rioGpioBlink01_linkInfo.xml" --use_hw_mpy=F5 --rom_model -o "rioGpioBlink01.out" "./blink.obj" "../lnk_msp430fr6047.cmd" -llibmpu_init.a -llibmath.a -llibc.a
<Linking>
warning #10420-D: For FRAM devices, at start up, the GPIO power-on default high-impedance mode needs to be disabled to activate previously configured port settings. This can be done by clearing the LOCKLPM5 bit in PM5CTL0 register.

undefined first referenced
symbol in file
--------- ----------------
GPIO_setAsOutputPin ./blink.obj
GPIO_toggleOutputOnPin ./blink.obj
PMM_unlockLPM5 ./blink.obj
WDT_A_hold ./blink.obj

To get the program to compile, I had to add a directory to the #include search path so it would find <driverlib.h>

C:\ti\msp\UltrasonicWaterFR604x_02_20_00_04\driverlib\MSP430FR5xx_6xx
${CCS_BASE_ROOT}/msp430/include
${PROJECT_ROOT}
${CG_TOOL_ROOT}/include

Apparently, now the linker isn't finding the correct version of driverlib.lib. Here's the library search path:

${CCS_BASE_ROOT}/msp430/include
${CCS_BASE_ROOT}/lib
${CCS_BASE_ROOT}/msp430/lib/5xx_6xx_FRxx
${CCS_BASE_ROOT}/msp430/lib/FR59xx
${CG_TOOL_ROOT}/lib
${CG_TOOL_ROOT}/include

I guess I'm not sure how the correct versions of the headers and libs were supposed to be installed. Is there a simple way to make sure the correct driverlib is installed and found by the linker?

Thanks!

  • Hello,

    I recommend updating your version of CCS if it is not already the latest.  You can download from the link below.

    http://software-dl.ti.com/ccs/esd/documents/ccs_downloads.html

    Also, there is a later version of the FR604x water demo example code(2.20.00.08) available below that I recommend using as there are some bug fixes.

    http://software-dl.ti.com/msp430/msp430_public_sw/mcu/msp430/USSSWLib/USSSWLibWater/latest/

    I think if you update both and import the new project, it should be able to find the correct version of driverlib.  Let me know if this resolves the issue for you.

  • After installing CCS 9.10 and the new water demo code, I was still stuck with the linker errors. To fix the errors, it turned out that I needed to add links to three source files to the project:

    • gpio.c
    • pmm.c
    • wdt_a.c

    since the program uses functions that are defined there:

    #include <driverlib.h>
    #include <msp430fr6047.h>
    /**
     * main.c
     */
    int main(void)
    {
        //Stop WDT
        WDT_A_hold(WDT_A_BASE);                        // Requires wdt_a.c
        //P7.5 output
        GPIO_setAsOutputPin(GPIO_PORT_P7,GPIO_PIN5);   // Requires gpio.c

        PMM_unlockLPM5();                              // Requires pmm.c
        while(1)
        {
          //toggle pins
          GPIO_toggleOutputOnPin(GPIO_PORT_P7,GPIO_PIN5);  // Requires gpio.c
          __delay_cycles(1000000);
        }
    }
     
    I've done some C programming before, and the build configs have caused a lot of headaches in each new environment.