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.

Compile Error in Timer Blink LED Program

Other Parts Discussed in Thread: MSP430F5438, MSP430G2231

Hello Freinds,

I am running a simple program for timer blink led, on MSP430F5438 Board in windows 7 , CCS6

#include <msp430g2231.h>


#define LED_0 BIT0 
#define LED_1 BIT6
#define LED_OUT P1OUT
#define LED_DIR P1DIR



unsigned int timerCount = 0;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer
LED_DIR |= (LED_0 + LED_1); // Set P1.0 and P1.6 to output direction
LED_OUT &= ~(LED_0 + LED_1); // Set the LEDs off

CCTL0 = CCIE;
TACTL = TASSEL_2 + MC_2; // Set the timer A to SMCLCK, Continuous
// Clear the timer and enable timer interrupt

__enable_interrupt();

__bis_SR_register(LPM0 + GIE); // LPM0 with interrupts enabled

} 


// Timer A0 interrupt service routine
#pragma vector=TIMERA0_VECTOR
__interrupt void Timer_A (void)
{
timerCount = (timerCount + 1) % 8;
if(timerCount ==0)
P1OUT ^= (LED_0 + LED_1);
}

I am getting error message : 


**** Build of configuration Debug for project blinkinLEDPressButton ****

"C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all
'Building file: ../main.c'
'Invoking: MSP430 Compiler'
"C:/ti/ccsv6/tools/compiler/ti-cgt-msp430_4.4.3/bin/cl430" -vmspx --abi=eabi --data_model=restricted --use_hw_mpy=F5 --include_path="C:/ti/ccsv6/ccs_base/msp430/include" --include_path="C:/ti/ccsv6/tools/compiler/ti-cgt-msp430_4.4.3/include" --advice:power=all -g --define=__MSP430F5438__ --diag_warning=225 --display_error_number --diag_wrap=off --silicon_errata=CPU15 --silicon_errata=CPU18 --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40 --printf_support=minimal --preproc_with_compile --preproc_dependency="main.pp" "../main.c"
"../main.c", line 54: remark #1530-D: (ULP 5.1) Detected modulo operation(s). Recommend moving them to RAM during run time or not using as these are processing/power intensive
"C:\Users\Nitish\AppData\Local\Temp\0118410", WARNING! at line 141: [W0005] NOP required before set of GIE bit.
BIS.W r15,SR

No Assembly Errors, 1 Assembly Warning
'Finished building: ../main.c'
' '
'Building target: blinkinLEDPressButton.out'
'Invoking: MSP430 Linker'
"C:/ti/ccsv6/tools/compiler/ti-cgt-msp430_4.4.3/bin/cl430" -vmspx --abi=eabi --data_model=restricted --use_hw_mpy=F5 --advice:power=all -g --define=__MSP430F5438__ --diag_warning=225 --display_error_number --diag_wrap=off --silicon_errata=CPU15 --silicon_errata=CPU18 --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU23 --silicon_errata=CPU40 --printf_support=minimal -z -m"blinkinLEDPressButton.map" --heap_size=160 --stack_size=160 --cinit_hold_wdt=on -i"C:/ti/ccsv6/ccs_base/msp430/include" -i"C:/ti/ccsv6/tools/compiler/ti-cgt-msp430_4.4.3/lib" -i"C:/ti/ccsv6/tools/compiler/ti-cgt-msp430_4.4.3/include" -i"C:/ti/ccsv6/ccs_base/msp430/lib/5xx_6xx_FRxx" --reread_libs --warn_sections --display_error_number --diag_wrap=off --xml_link_info="blinkinLEDPressButton_linkInfo.xml" --use_hw_mpy=F5 --rom_model -o "blinkinLEDPressButton.out" "./main.obj" "../lnk_msp430f5438.cmd" -l"libmath.a" -l"libc.a"
<Linking>
remark #10372-D: (ULP 4.1) Detected uninitialized Port 2 in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins.

undefined first referenced
symbol in file
--------- ----------------
P1DIR ./main.obj
P1OUT ./main.obj
TACCTL0 ./main.obj
TACTL ./main.obj

error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "blinkinLEDPressButton.out" not built

>> Compilation failure
gmake: *** [blinkinLEDPressButton.out] Error 1
gmake: Target `all' not remade because of errors.

**** Build Finished ****

Can somebody help me please to figure out this, as i am new in this field.

Thanks

  • nitish rajoria said:
    undefined first referenced
    symbol in file
    --------- ----------------
    P1DIR ./main.obj
    P1OUT ./main.obj
    TACCTL0 ./main.obj
    TACTL ./main.obj

    Those errors are due to a mix of device types:

    - The program includes msp430g2231.h

    - But the linker command file for a MSP430F5348 is used

    Are you trying to port a program created for a MSP430G2231 to a MSP430F5438?

    [If the program is changed to include msp430f5438.h instead of msp430g2231.h then get compile errors instead since CCTL0, TACTL and TIMERA0_VECTOR aren't defined for a MSP430F5438]

**Attention** This is a public forum