Altera_Forum
Honored Contributor
13 years agoundefined reference to 'main'
Hi Guys,
I have only just started with the NIOS II and associated tools so I accept I could have done a million things wrong, but: I have tried creating a simple application that contains a UART module, NIOS II/e and on chip RAM. I build the BSP without any problems (although it does seem to add drivers from a previous tutorial I did), i then create the application and point to the newly created BSP. I add the main.c source file which is listed below: # include <stdint.h> # include "system.h" int main(void) { volatile uint32_t *uart = (volatile uint32_t*) UART_BASE; char *str = "Hello from NIOS II\n"; while (1) { char *ptr = str; while (*ptr != '\0') { while ((uart[2] & (1<<6)) == 0); uart[1] = *ptr; ptr++; } } return 0; } but when i compile I get 2 errors: make:***[simpleNIOS2.elf] Error 1 undefined reference to 'main' the first appears in my application file and the second in the alt_main.c file within the BSP. Can anyone point out where I might have gone wrong? many thanks David