UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

Reply

Undefined references for simple hello world

Accepted Solution Solved
Newbie
Posts: 1
Registered: ‎05-21-2017
Accepted Solution

Undefined references for simple hello world

Hi this is very frustrating. I've been following a few simple tutorials but I'm getting these undefined reference errors. I'm on a fresh ubuntu install. I did install the ia32-libs package as suggested elsewhere.

 

 

#include <stdio.h>
#include "platform.h"
#include "xil_printf.h"
#include "xparameters.h"
#include "ps7_init.h"

int main()
{
    init_platform();

    ps7_post_config();

    for(int i=0;i<10;i++)
    	Xil_Out32(XPAR_AXI_BRAM_CTRL_0_S_AXI_BASEADDR + 4*i, i+0xaabbccdd);

    cleanup_platform();
    return 0;
}
20:48:16 **** Build of configuration Debug for project helloSadri ****
make pre-build main-build 
a9-linaro-pre-build-step
 
Building file: ../src/helloworld.c
Invoking: ARM v7 gcc compiler
arm-none-eabi-gcc -Wall -O0 -g3 -c -fmessage-length=0 -MT"src/helloworld.o" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -I../../helloSadri_bsp/ps7_cortexa9_0/include -MMD -MP -MF"src/helloworld.d" -MT"src/helloworld.o" -o "src/helloworld.o" "../src/helloworld.c"
../src/helloworld.c: In function 'main':
../src/helloworld.c:61:6: warning: implicit declaration of function 'Xil_Out32' [-Wimplicit-function-declaration]
      Xil_Out32(XPAR_AXI_BRAM_CTRL_0_S_AXI_BASEADDR + 4*i, i+0xaabbccdd);
      ^~~~~~~~~
Finished building: ../src/helloworld.c
 
Building file: ../src/platform.c
Invoking: ARM v7 gcc compiler
arm-none-eabi-gcc -Wall -O0 -g3 -c -fmessage-length=0 -MT"src/platform.o" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -I../../helloSadri_bsp/ps7_cortexa9_0/include -MMD -MP -MF"src/platform.d" -MT"src/platform.o" -o "src/platform.o" "../src/platform.c"
Finished building: ../src/platform.c
 
Building target: helloSadri.elf
Invoking: ARM v7 gcc linker
arm-none-eabi-gcc -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -Wl,-build-id=none -specs=Xilinx.spec -Wl,-T -Wl,../src/lscript.ld -L../../helloSadri_bsp/ps7_cortexa9_0/lib -o "helloSadri.elf"  ./src/helloworld.o ./src/platform.o   -Wl,--start-group,-lxil,-lgcc,-lc,--end-group
./src/helloworld.o: In function `main':
/home/ra/fpga/oled2/oled2.sdk/helloSadri/Debug/../src/helloworld.c:58: undefined reference to `ps7_post_config'
/home/ra/fpga/oled2/oled2.sdk/helloSadri/Debug/../src/helloworld.c:61: undefined reference to `Xil_Out32'
collect2: error: ld returned 1 exit status
make: *** [helloSadri.elf] Error 1
makefile:39: recipe for target 'helloSadri.elf' failed

20:48:16 Build Finished (took 434ms)

 


Accepted Solutions
Highlighted
Instructor
Posts: 9,048
Registered: ‎08-14-2007

Re: Undefined references for simple hello world

Looks like you forgot to include xil_io.h.

 
-- Gabor

View solution in original post


All Replies
Highlighted
Instructor
Posts: 9,048
Registered: ‎08-14-2007

Re: Undefined references for simple hello world

Looks like you forgot to include xil_io.h.

 
-- Gabor
Newbie
Posts: 1
Registered: ‎12-12-2017

Re: Undefined references for simple hello world

Yep, worked for me- had this problem with zybo tutorial - led_controller_test_tut_4A.c

thanks