Altera_Forum
Honored Contributor
12 years agoUsing the SDRAM Controller with Qsys
I am trying to use Eclipse to program an application using the lcd. My qsys system uses an sdram controller. I receive a single error in the alt_main.c which was generated in the bsp.
The error states undefined reference to main. It occurs in the return line of the code extern int main (int, char **, char **); void alt_main (void) { #ifndef ALT_NO_EXIT int result;
# endif
/* ALT LOG - please see HAL/sys/alt_log_printf.h for details */ ALT_LOG_PRINT_BOOT("[alt_main.c] Entering alt_main, calling alt_irq_init.\r\n"); /* Initialize the interrupt controller. */ alt_irq_init (NULL); /* Initialize the operating system */ ALT_LOG_PRINT_BOOT("[alt_main.c] Done alt_irq_init, calling alt_os_init.\r\n"); ALT_OS_INIT(); /* * Initialize the semaphore used to control access to the file descriptor * list. */ ALT_LOG_PRINT_BOOT("[alt_main.c] Done OS init, calling alt_sem_create.\r\n"); ALT_SEM_CREATE (&alt_fd_list_lock, 1); /* Initialize the device drivers/software components. */ ALT_LOG_PRINT_BOOT("[alt_main.c] Calling alt_sys_init.\r\n"); alt_sys_init(); ALT_LOG_PRINT_BOOT("[alt_main.c] Done alt_sys_init.\r\n"); #if !defined(ALT_USE_DIRECT_DRIVERS) && (defined(ALT_STDIN_PRESENT) || defined(ALT_STDOUT_PRESENT) || defined(ALT_STDERR_PRESENT)) /* * Redirect stdio to the apropriate devices now that the devices have * been initialized. This is only done if the user has requested these * devices be present (not equal to /dev/null) and if direct drivers * aren't being used. */ ALT_LOG_PRINT_BOOT("[alt_main.c] Redirecting IO.\r\n"); alt_io_redirect(ALT_STDOUT, ALT_STDIN, ALT_STDERR); #endif
#ifndef ALT_NO_C_PLUS_PLUS /* * Call the C++ constructors */ ALT_LOG_PRINT_BOOT("[alt_main.c] Calling C++ constructors.\r\n"); _do_ctors (); #endif/* ALT_NO_C_PLUS_PLUS */ #if !defined(ALT_NO_C_PLUS_PLUS) && !defined(ALT_NO_CLEAN_EXIT) && !defined(ALT_NO_EXIT) /* * Set the C++ destructors to be called at system shutdown. This is only done * if a clean exit has been requested (i.e. the exit() function has not been * redefined as _exit()). This is in the interest of reducing code footprint, * in that the atexit() overhead is removed when it's not needed. */ ALT_LOG_PRINT_BOOT("[alt_main.c] Calling atexit.\r\n"); atexit (_do_dtors); #endif
/* * Finally, call main(). The return code is then passed to a subsequent * call to exit() unless the application is never supposed to exit. */ ALT_LOG_PRINT_BOOT("[alt_main.c] Calling main.\r\n"); #ifdef ALT_NO_EXIT main (alt_argc, alt_argv, alt_envp); #else
result = main (alt_argc, alt_argv, alt_envp); close(STDOUT_FILENO); exit (result); #endif
ALT_LOG_PRINT_BOOT("[alt_main.c] After main - we should not be here?.\r\n"); } This error does not occur when using on-chip memory, however that won't be sufficient for the project according to eclipse. How should I approach fixing the error?