Can anyone please tell me what this error means and how to fix it ?
Build started: Project: LCD3.2*** Using Compiler 'V5.06 update 7 (build 960)', folder: 'C:\Arm\Keil Suite\ARM\ARMCC\Bin'Build target 'Target 1'linking....\Objects\LCD3.2: Error: L6218E: Undefined symbol main (referred from __rtentry2.o).Not enough information to list image symbols.Not enough information to list load addresses in the image map.Finished: 2 information, 0 warning and 1 error messages.".\Objects\LCD3.2" - 1 Error(s), 0 Warning(s).Target not created.Build Time Elapsed: 00:00:00
Please check if your project contains the main() function.
This function is mandatory for each such project, which typically starts at main().
Yes it does...I do not write C programs without main()
/* p3_1.c: Initialize and display "Hello" on the LCD using 4-bit data mode. */ /* Data pins use Port B, control pins use Port A */ /* This program strictly follows HD44780 datasheet for timing. You may want to adjust the amount of delay for your LCD controller. */ /* The data pins of the LCD are connected to Port B. In 8-bit mode, all eight are used. In 4-bit mode, only pin 7-4 are used. The control pins of the LCD are connected to Port A and the connections are: #define RS 0x20 /* PORTA BIT5 mask #define RW 0x40 /* PORTA BIT6 mask #define EN 0x80 /* PORTA BIT7 mask */ #include "tm4c123gh6pm.h" #define LCD_PORT GPIOB #define RS 1 /* BIT0 mask */ #define RW 2 /* BIT1 mask */ #define EN 4 /* BIT2 mask */ void delayMs(int n); void delayUs(int n); void LCD_nibble_write(unsigned char data, unsigned char control); void LCD_command(unsigned char command); void LCD_data(unsigned char data); void LCD_init(void); int main(void) { LCD_init(); for(;;) { LCD_command(1); /* clear display */ LCD_command(0x80); /* LCD cursor location */ delayMs(500); LCD_data('H'); LCD_data('e'); LCD_data('l'); LCD_data('l'); LCD_data('o'); delayMs(500); } } void LCD_init(void) { SYSCTL->RCGCGPIO |= 0x02; /* enable clock to GPIOB */ LCD_PORT->DIR = 0xFF; /* set all PORTB pins as output */ LCD_PORT->DEN = 0xFF; /* set all PORTB pins as digital pins */ delayMs(20); /* initialization sequence */ LCD_nibble_write(0x30, 0); delayMs(5); LCD_nibble_write(0x30, 0); delayUs(100); LCD_nibble_write(0x30, 0); delayUs(40); LCD_nibble_write(0x20, 0); /* use 4-bit data mode */ delayUs(40); LCD_command(0x28); /* set 4-bit data, 2-line, 5x7 font */ LCD_command(0x06); /* move cursor right */ LCD_command(0x01); /* clear screen, move cursor to home */ LCD_command(0x0F); /* turn on display, cursor blinking */ } void LCD_nibble_write(unsigned char data, unsigned char control) { data &= 0xF0; /* clear lower nibble for control */ control &= 0x0F; /* clear upper nibble for data */ LCD_PORT->DATA = data | control; /* RS = 0, R/W = 0 */ LCD_PORT->DATA = data | control | EN; /* pulse E */ delayUs(0); LCD_PORT->DATA = data; LCD_PORT->DATA = 0; } void LCD_command(unsigned char command) { LCD_nibble_write(command & 0xF0, 0); /* upper nibble first */ LCD_nibble_write(command << 4, 0); /* then lower nibble */ if (command < 4) delayMs(2); /* commands 1 and 2 need up to 1.64ms */ else delayUs(40); /* all others 40 us */ } void LCD_data(unsigned char data) { LCD_nibble_write(data & 0xF0, RS); /* upper nibble first */ LCD_nibble_write(data << 4, RS); /* then lower nibble */ delayUs(40); } /* delay n milliseconds (16 MHz CPU clock) */ void delayMs(int n) { int i, j; for(i = 0 ; i < n; i++) for(j = 0; j < 3180; j++) {} /* do nothing for 1 ms */ } /* delay n microseconds (16 MHz CPU clock) */ void delayUs(int n) { int i, j; for(i = 0 ; i < n; i++) for(j = 0; j < 3; j++) {} /* do nothing for 1 us */ } /* This function is called by the startup assembly code to perform system specific initialization tasks. */ /*void SystemInit(void) { /* Grant coprocessor access /* This is required since TM4C123G has a floating point coprocessor SCB->CPACR |= 0x00f00000; */ }
I posted in Piazza as well that since all of my errors pop up on Build Target, I'd love to know what happens when that is executed. What goes on in linking, for example ? Maybe I could do my own trouble shooting if I better understood what was going on under the hood.
I had some errors in my C file and suppose the linker decided to throw up an error on my main() function for some reason. An extraneous closing brace, now removed, seems to have fixed everything as well as fixing nested comments it didn't like. It builds now but I won't be able to test it on the board until later today.
well, before checking any linker error, you should check if you have any compilation error first. If one C module fails to be compiled, the linker of course cannot find that symbol/module to link...
OK well this is somewhat new to me. Aside from the red mark ups on my code editor, how do i know if it's not compiling properly ? And linking ..... what would be the clues there ?
check line by line in your Build Output window of uVision