Hi Pavel, sorry my post wasn't finished and i wanted to edit it, but i forgot my password blablabla.. Anyway.
Yeah by Redpitaya OS i mean Ubuntu on SD card, and i'm actually trying to compile it from there
Why does the Xilinx Includes and fonction should be removed ?
Because i'm trying with Helloworld right now, but it will be used with a more complicated code using those xilinx fonction
Here the post with everything that i wanted to post
Hi guys,
Coming with more information and test.
To resmue, i'm trying to compile and running a C program created with Xilinx SDK on Redpitaya OS.
It's just the simple Helloworld created with SDK
Code: Select all
#include <stdio.h>
#include <platform.h>
#include <xil_printf.h>
int main()
{
init_platform();
print("Hello World\n\r");
print("Successfully ran Hello World application");
cleanup_platform();
return 0;
}
but when i'm trying to compile it on my laptop with ubuntu 20.04.2 LTS or Redpitaya OS i'm running into some issues.
First i'm having this one
Code: Select all
Grekt:~/xilinx_sdk_workspace/workspace/HelloWorld/src$ gcc helloworld.c -o helloworld
helloworld.c:49:10: fatal error: platform.h: No such file or directory
49 | #include <platform.h>
| ^~~~~~~~~~~~
compilation terminated.
I've resolved it by copying every header from xilinx vivado/SDK installation to the working directory where i'm compiling, or into /usr/include
But it's not really convenient
Then when i'd every headers needed, i had this issue :
Code: Select all
Grekt:~/xilinx_sdk_workspace/workspace/HelloWorld/src$ gcc helloworld.c -o helloworld
/usr/bin/ld: /tmp/ccBivcU1.o: in function `main':
helloworld.c:(.text+0xe): undefined reference to `init_platform'
/usr/bin/ld: helloworld.c:(.text+0x1a): undefined reference to `print'
/usr/bin/ld: helloworld.c:(.text+0x26): undefined reference to `print'
/usr/bin/ld: helloworld.c:(.text+0x30): undefined reference to `cleanup_platform'
collect2: error: ld returned 1 exit status
I asked on a discord server who's programming in C how can i solve this, and they said that i had to add another piece of program to get it right.
So i've searched into xilinx directory to get every program and added them to the working directory.
And the compilation worked !
but then, when i tried to run the program i had this error :
Code: Select all
Grekt:~/xilinx_sdk_workspace/workspace/HelloWorld/src$ gcc helloworld.c platform.c print.c outbyte.c xuartps_hw.c -o helloworld
Grekt:~/xilinx_sdk_workspace/workspace/HelloWorld/src$ ./helloworld
Segmentation fault (core dumped)
Code: Select all
Grekt:~/xilinx_sdk_workspace/workspace/HelloWorld/src$ ./helloworld
AddressSanitizer:DEADLYSIGNAL
=================================================================
==47264==ERROR: AddressSanitizer: SEGV on unknown address 0x00009bff8005 (pc 0x55fc4708f400 bp 0x7ffef322d330 sp 0x7ffef322d320 T0)
==47264==The signal is caused by a READ memory access.
#0 0x55fc4708f3ff in Xil_In32 /usr/include/xil_io.h:153
#1 0x55fc4708f4a8 in XUartPs_SendByte /home/gagagou/xilinx_sdk_workspace/workspace/HelloWorld/src/xuartps_hw.c:83
#2 0x55fc4708f3c7 in outbyte /home/gagagou/xilinx_sdk_workspace/workspace/HelloWorld/src/outbyte.c:14
#3 0x55fc4708f343 in print /home/gagagou/xilinx_sdk_workspace/workspace/HelloWorld/src/print.c:29
#4 0x55fc4708f226 in main /home/gagagou/xilinx_sdk_workspace/workspace/HelloWorld/src/helloworld.c:57
#5 0x7f6efac760b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
#6 0x55fc4708f14d in _start (/home/gagagou/xilinx_sdk_workspace/workspace/HelloWorld/src/helloworld+0x114d)
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /usr/include/xil_io.h:153 in Xil_In32
==47264==ABORTING
And i don't know what to do to make it working.
Does anyone already compile C program on Redpitaya OS and if yes, did they had to include xilinx header by hand, or there is something to do to get it right.