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.
Hello,
I am using os windows 10 and launchpad tm4c123 gxl with ccsv6.2, while trying to run the following example code came across with the error "unresolved symbols remain and errors encountered during linking"
my code is
#include <stdint.h>
#include <stdbool.h>
#include "lcd.h"
#include "inc/tm4c123gh6pm.h"
#include "systick.h"
#define E 0x80 // on PA7
#define RS 0x40 // on PA6
#define LCDDATA (*((volatile uint32_t *)0x400053FC)) // PORTB
#define LCDCMD (*((volatile uint32_t *)0x40004300)) // PA7-PA6
#define BusFreq 50 // assuming a 50 MHz bus clock
#define T6us 6*BusFreq // 6us
#define T40us 40*BusFreq // 40us
#define T160us 160*BusFreq // 160us
#define T1600us 1600*BusFreq // 1.60ms
#define T5ms 5000*BusFreq // 5ms
#define T15ms 15000*BusFreq // 15ms
void OutCmd(unsigned char command){
LCDDATA = command;
LCDCMD = 0; // E=0, R/W=0, RS=0
SysTick_Wait(T6us); // wait 6us
LCDCMD = E; // E=1, R/W=0, RS=0
SysTick_Wait(T6us); // wait 6us
LCDCMD = 0; // E=0, R/W=0, RS=0
SysTick_Wait(T40us); // wait 40us
}
// Initialize LCD
// Inputs: none
// Outputs: none
void LCD_Init(void){ volatile long delay;
SYSCTL_RCGC2_R |= 0x00000003; // 1) activate clock for Ports A and B
delay = SYSCTL_RCGC2_R; // 2) no need to unlock
GPIO_PORTB_AMSEL_R &= ~0xFF; // 3) disable analog function on PB7-0
GPIO_PORTA_AMSEL_R &= ~0xC0; // disable analog function on PA7-6
GPIO_PORTB_PCTL_R = 0x00000000; // 4) configure PB7-0 as GPIO
GPIO_PORTA_PCTL_R &= ~0xFF000000; // configure PA7-6 as GPIO
GPIO_PORTB_DIR_R = 0xFF; // 5) set direction register
GPIO_PORTA_DIR_R |= 0xC0;
GPIO_PORTB_AFSEL_R = 0x00; // 6) regular port function
GPIO_PORTA_AFSEL_R &= ~0xC0;
GPIO_PORTB_DEN_R = 0xFF; // 7) enable digital port
GPIO_PORTA_DEN_R |= 0xC0;
GPIO_PORTB_DR8R_R = 0xFF; // enable 8 mA drive
GPIO_PORTA_DR8R_R |= 0xC0;
SysTick_Init(); // Volume 1 Program 4.7, Volume 2 Program 2.10
LCDCMD = 0; // E=0, R/W=0, RS=0
SysTick_Wait(T15ms); // Wait >15 ms after power is applied
OutCmd(0x30); // command 0x30 = Wake up
SysTick_Wait(T5ms); // must wait 5ms, busy flag not available
OutCmd(0x30); // command 0x30 = Wake up #2
SysTick_Wait(T160us); // must wait 160us, busy flag not available
OutCmd(0x30); // command 0x30 = Wake up #3
SysTick_Wait(T160us); // must wait 160us, busy flag not available
OutCmd(0x38); // Function set: 8-bit/2-line
OutCmd(0x10); // Set cursor
OutCmd(0x0C); // Display ON; Cursor ON
OutCmd(0x06); // Entry mode set
}
// Output a character to the LCD
// Inputs: letter is ASCII character, 0 to 0x7F
// Outputs: none
void LCD_OutChar(unsigned char letter){
LCDDATA = letter;
LCDCMD = RS; // E=0, R/W=0, RS=1
SysTick_Wait(T6us); // wait 6us
LCDCMD = E+RS; // E=1, R/W=0, RS=1
SysTick_Wait(T6us); // wait 6us
LCDCMD = RS; // E=0, R/W=0, RS=1
SysTick_Wait(T40us); // wait 40us
}
// Clear the LCD
// Inputs: none
// Outputs: none
void LCD_Clear(void){
OutCmd(0x01); // Clear Display
SysTick_Wait(T1600us); // wait 1.6ms
OutCmd(0x02); // Cursor to home
SysTick_Wait(T1600us); // wait 1.6ms
}
//------------LCD_OutString------------
// Output String (NULL termination)
// Input: pointer to a NULL-terminated string to be transferred
// Output: none
void LCD_OutString(char *pt){
while(*pt){
LCD_OutChar(*pt);
pt++;
}
}
//-----------------------LCD_OutUDec-----------------------
// Output a 32-bit number in unsigned decimal format
// Input: 32-bit number to be transferred
// Output: none
// Variable format 1-10 digits with no space before or after
void LCD_OutUDec(uint32_t n){
// This function uses recursion to convert decimal number
// of unspecified length as an ASCII string
if(n >= 10){
LCD_OutUDec(n/10);
n = n%10;
}
LCD_OutChar(n+'0'); /* n is between 0 and 9 */
}
//--------------------------LCD_OutUHex----------------------------
// Output a 32-bit number in unsigned hexadecimal format
// Input: 32-bit number to be transferred
// Output: none
// Variable format 1 to 8 digits with no space before or after
void LCD_OutUHex(uint32_t number){
// This function uses recursion to convert the number of
// unspecified length as an ASCII string
if(number >= 0x10){
LCD_OutUHex(number/0x10);
LCD_OutUHex(number%0x10);
}
else{
if(number < 0xA){
LCD_OutChar(number+'0');
}
else{
LCD_OutChar((number-0x0A)+'A');
}
}
}
Error shows
Description Resource Path Location Type
#10010 errors encountered during linking; "LCD_exam.out" not built LCD_exam C/C++ Problem
gmake: Target 'all' not remade because of errors. LCD_exam C/C++ Problem
unresolved symbol main, first referenced in C:\ti\ccsv6\tools\compiler\arm_15.12.3.LTS\lib\rtsv7M4_T_le_v4SPD16_eabi.lib<args_main.obj>
**** Build of configuration Debug for project Display_example ****
"C:\\ti\\ccsv6\\utils\\bin\\gmake" -k all
'Building target: Display_example.out'
'Invoking: ARM Linker'
"C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/bin/armcl" -mv7M4 --code_state=16 --float_support=FPv4SPD16 -me -g --gcc --define=ccs="ccs" --define=PART_TM4C123GH6PM --diag_wrap=off --diag_warning=225 --display_error_number --abi=eabi -z -m"Display_example.map" --stack_size=512 --heap_size=0 -i"C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/lib" -i"C:/ti/ccsv6/tools/compiler/arm_15.12.3.LTS/include" --reread_libs --diag_wrap=off --warn_sections --display_error_number --xml_link_info="Display_example_linkInfo.xml" --rom_model -o "Display_example.out" "./main.obj" "./tm4c123gh6pm_startup_ccs.obj" "./uartstdio.obj" "./ustdlib.obj" "../tm4c123gh6pm.cmd" -llibc.a -l"C:/ti/TivaWare_C_Series-2.1.3.156/driverlib/ccs/Debug/driverlib.lib"
<Linking>
undefined first referenced
symbol in file
--------- ----------------
clearLCD ./main.obj
initLCD ./main.obj
printLCD ./main.obj
setCursorPositionLCD ./main.obj
>> Compilation failure
makefile:144: recipe for target 'Display_example.out' failed
error #10234-D: unresolved symbols remain
error #10010: errors encountered during linking; "Display_example.out" not built
gmake: *** [Display_example.out] Error 1
gmake: Target 'all' not remade because of errors.
**** Build Finished ****