02-24-2015 01:37 AM
Hi,I have built a small baremetal application to test the system built in Qsys. I'm using some predefined functions like alt_cache_system_disable and alt_bridge_init. The header files for these functions are included and paths for the same are added into the projects includes(Properties->C/C++ general->Paths and symbols) from the altera IP libraries. The files generated for the system is also included. The linker throws an error saying undefined reference to these functions. The log is shown below: make all 'Building file: ../test.c' 'Invoking: GCC C Compiler' arm-altera-eabi-gcc -ID:/Altera/embedded/ip/altera/hps/altera_hps/hwlib/include -ID:/Altera/projects/system/hps_isw_handoff/system_HPS_system -I"D:\Altera\embedded\ip\altera\hps\altera_hps\hwlib\src" -O2 -g -Wall -std=c99 -MMD -MP -MF"test.d" -MT"test.d" -c -o "test.o" "../test.c" ../test.c: In function 'main': ../test.c:58:3: warning: implicit declaration of function 'alt_log_printf' [-Wimplicit-function-declaration] alt_log_printf("Bridge Init Success\n"); ^ 'Finished building: ../test.c' ' ' 'Building target: test.axf' 'Invoking: GCC C Linker' arm-altera-eabi-gcc -o "test.axf" ./test.o d:/altera/embedded/host_tools/mentor/gnu/arm/baremetal/bin/../lib/gcc/arm-altera-eabi/4.9.1/../../../../arm-altera-eabi/bin/ld.exe: warning: cannot find entry symbol _start; defaulting to 00008018 ./test.o: In function `main': C:\Users\Administrator\Documents\DS-5 Workspace\test\Debug/../test.c:55: undefined reference to `alt_bridge_init' C:\Users\Administrator\Documents\DS-5 Workspace\test\Debug/../test.c:62: undefined reference to `alt_log_printf' C:\Users\Administrator\Documents\DS-5 Workspace\test\Debug/../test.c:67: undefined reference to `alt_cache_system_disable' collect2.exe: error: ld returned 1 exit status make: *** [test.axf] Error 1 When I looked around, this seems to be a common issue. One of the solution was to include the flag -specs=nosys.spec. When this flag was added, the linker could not find this flag. Any help with this issue is much appreciated. Thanks in advance. Best Regards, Nitin.
02-26-2015 07:43 AM
This error was solved. Unlike normal eclipse, DS-5 requires all the source files of the includes to be added into the project. The target properties under the GCC C compiler has to be set for the respective CPU, architecAdditionally the flag -std=c99 can be included to avoid errors certain C constructs used in a few pre-defined files.