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.
Tool/software: Code Composer Studio
I am using msp430f5659 microcontroller. I am trying to interface lcd, uart but after build it gives error: unresolved symbol, reference first. I have read ti forums to resolve the error and i found that i am missing some library but not able to find which one. I have attached screen shots of my console, problem screen. Please suggest me which mistake i am making ?
harish yadav said:I am trying to interface lcd, uart but after build it gives error: unresolved symbol, reference first. I have read ti forums to resolve the error and i found that i am missing some library but not able to find which one.
Harish,
The unresolved symbol error is basically saying that main.c is referencing symbols clear_lcd, lcd_init, etc. but the linker cannot find a definition for it. The definition can either be in a C source file that gets compiled and linked as part of the project or in a library file that gets linked into the project. I don't have knowledge about the project/interface code you are working with to know where these symbols are defined, but I see that you have some source files in the /driverlibrary directory. Do those files contain the definitions for those symbols, I would imagine they should. Alternately the symbol definitions could come from a library but as to which library would be a question for the MSP device forum.
I have defined all the symbols in their respective .c files and declared them in .h file. I think my linker is not able to link all these files but why ? I am not able to resolve this problem please suggest something. I have read about these type of problem in ti forum but everywhere they says some file is missing in file search path. which file not able to find this ?
harish yadav said:I have defined all the symbols in their respective .c files and declared them in .h file.
Could you pick a couple of the unresolved symbols mentioned in the errors and attach the C source files where those functions are defined?
Also please save the full output in the CCS build console to a text file and attach it here.
Since as said it was related to msp430 forum so i posted it there also. I dont know whether it is related to msp or ccs forum.
hello,
this is my lcd.h file:
/*
* lcd.h
*
* Created on: Mar 21, 2017
* Author: acer
*/
#include "inc/hw659.h"
#ifndef DRIVERLIBRARY_LCD_H_
#define DRIVERLIBRARY_LCD_H_
#define lcd_RS BIT1
#define lcd_EN BIT2
#define lcd_D4 BIT3
#define lcd_D5 BIT4
#define lcd_D6 BIT5
#define lcd_D7 BIT6
#define lcd_DIR P1DIR
#define lcd_PORT P1OUT
#define lcd_PORT_MASK (lcd_EN | lcd_D4 | lcd_D5 | lcd_D6 | lcd_D7)
extern void lcd_cmd(char);
extern void lcd_pulse(void);
extern void lcd_init(void);
extern void lcd_data(unsigned char);
extern void set_cursor_pos(int,int );
extern void clearport();
extern void busychck(void);
extern void clear_lcd(void);
extern void display(unsigned char* word);
#endif /* DRIVERLIBRARY_LCD_H_ */
this is my 2 functions in c file in which error occurs:
void set_cursor_pos(int row,int col)
{
char addr;
if(row==0)
addr=0x00; //row 0 then addr=0x00h(RAM addr)
else
addr=0x40; //row 1 den addr=0x40h
addr |=col; //add offset for column
lcd_cmd(0x80|addr); //set DDRAM addr for display
}
void clear_lcd()
{
lcd_cmd(0x01); //CLEAR DISPLAY
//_delay_cycles(1000);
lcd_cmd(0x02); //RETURN HOME
//_delay_cycles(100000);
}
and i am attaching the console text file as u said.
**** Build of configuration Debug for project rmu **** "C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all 'Building target: rmu.out' 'Invoking: MSP430 Linker' "C:/ti/ccsv6/tools/compiler/ti-cgt-msp430_16.12.0.STS/bin/cl430" -vmspx --data_model=restricted --use_hw_mpy=F5 --advice:power="all" --define=__MSP430F5659__ -g --printf_support=full --diag_warning=225 --diag_wrap=off --display_error_number --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU40 -z -m"rmu.map" --heap_size=160 --stack_size=160 --cinit_hold_wdt=on -i"C:/ti/ccsv6/ccs_base/msp430/include" -i"C:/ti/ccsv6/ccs_base/msp430/lib/5xx_6xx_FRxx" -i"C:/ti/ccsv6/tools/compiler/ti-cgt-msp430_16.12.0.STS/lib" -i"C:/ti/ccsv6/tools/compiler/ti-cgt-msp430_16.12.0.STS/include" -i"D:/wrkspce/rmu/driverlibrary" --reread_libs --diag_wrap=off --display_error_number --warn_sections --xml_link_info="rmu_linkInfo.xml" --use_hw_mpy=F5 --rom_model -o "rmu.out" "./main.obj" "./driverlibrary/adc.obj" "./driverlibrary/lcd.obj" "./driverlibrary/modbus.obj" "./driverlibrary/uarta1.obj" "../lnk_msp430f5659.cmd" -llibmath.a -llibc.a <Linking> undefined first referenced symbol in file --------- ---------------- UART_GETSTRING ./main.obj UART_INIT ./main.obj UART_PUTSTRING ./main.obj build_querypacket ./main.obj clear_lcd ./main.obj remark #10371-D: (ULP 1.1) Detected no uses of low power mode state changing instructions display ./main.obj remark #10372-D: (ULP 4.1) Detected uninitialized Port B in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins. remark #10372-D: (ULP 4.1) Detected uninitialized Port C in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins. remark #10372-D: (ULP 4.1) Detected uninitialized Port D in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins. remark #10372-D: (ULP 4.1) Detected uninitialized Port E in this project. Recommend initializing all unused ports to eliminate wasted current consumption on unused pins. >> Compilation failure makefile:147: recipe for target 'rmu.out' failed lcd_init ./main.obj set_cursor_pos ./main.obj error #10234-D: unresolved symbols remain error #10010: errors encountered during linking; "rmu.out" not built gmake: *** [rmu.out] Error 1 gmake: Target 'all' not remade because of errors. **** Build Finished ****
harish yadav said:this is my 2 functions in c file in which error occurs:
Is this in the lcd.c file? Could you please attach that file here and also attach main.c?
Also please do a project rebuild and save off the contents of the CCS build console and attach here. The current build log only shows the link step.
hello,
I am truncating my project to only lcd file and building it but showing the same error. Since my code was previously working on msp430g2553 but i am migrating to msp430f5659. Now i am trying to build my project again on msp430g2553 in this format, initially i define and declare function in header file but from now onwards i am trying to work in stdandar fromat. I am attaching the log file, main.c, lcd.h, hw659.h, driverlib.h file here for msp430g2553 mcu.
Harish,
The issue here is a programming error and is unrelated to either the toolset or the device.
Looking at the build log I see that main.c is being compiled but lcd.c is not. Normally all C source files that are part of the project should be compiled and then the object files generated should be linked as part of the build process. In your project the C source files are main.c and lcd.c but only main.c was being compiled. I took a look at the source file lcd.c and saw the following:
#ifdef DRIVERLIBRARY_LCD_H_
#include"lcd.h"
...
...
#endif
Since DRIVERLIBRARY_LCD_H_ is not defined at that point in the source, the entire code in the file is assumed to not be valid, hence not compiled. If you move the #include "lcd.h" above the #ifdef line, then the symbol definition (and thereby rest of the code) will be valid and the lcd.c file will build.
Let us know if this helps resolve the issue.