Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++
12597 Discussions

added new source to bsp, undefined reference in nios eclipse

Honored Contributor II

Im on day 3 of my altera/nios/qsys/eclipse adventure 


Ive generated an altera avalon spi/nios within qsys and have it working well. its 8 bits by default and i wanted to change that to 16 or 32 bits wide. I created copies of the altera_avalon_sp.h and altera_avalon_spi.c files (with an _32wide suffix) and saved them in the same location as the original files. I made my changes (alt_u8 to alt_u32 types), updated the .h file name in the .c source and saved everything. 


I went to compile the top level source (helloworld_spi.c) and got an undefined reference to my new function. 


I have tried to regenerate the bsp files, added the -lm to the nios application properties, and tried rebuilding the bsp, app project and everything that i can think of. 


Can anyone help? Im an admitted newb, but i have to start somewhere... 


thanks for all your help! 


heres the error: 


[BSP build complete] 

Info: Linking helloWorld_spi.elf 

nios2-elf-g++ -lm -T'../helloWorld_spi_bsp//linker.x' -msys-crt0='../helloWorld_spi_bsp//obj/HAL/src/crt0.o' -msys-lib=hal_bsp -L../helloWorld_spi_bsp/ -Wl, -O0 -g -Wall -mno-hw-div -mhw-mul -mno-hw-mulx -o helloWorld_spi.elf obj/default/hello_world.o -lm  

obj/default/hello_world.o: In function `main': 

C:\Users\...\Desktop\jksSPI_V1\software\helloWorld_spi/hello_world.c:70: undefined reference to `alt_avalon_spi_command_32wide' 

collect2.exe: error: ld returned 1 exit status 

make: *** [helloWorld_spi.elf] Error 1 



**** Build Finished ****
0 Kudos
0 Replies