Zynq_UDP
Zynq_UDP copied to clipboard
Problem in echo.c file
After following the README file's instructions, I wasn't able to get this code to compile using Xilinx SDK 2018.3 . I wasn't the only person who experienced this, so I thought I'd submit an issue. See Xilinx forum thread https://forums.xilinx.com/t5/Processor-System-Design-and-AXI/UDP-packet-sending-with-Zynq/td-p/563836
13:18:46 **** Auto Build of configuration Debug for project echo_server_udp ****
make pre-build main-build
a9-linaro-pre-build-step
Building file: ../src/echo.c
Invoking: ARM v7 gcc compiler
arm-none-eabi-gcc -Wall -O0 -g3 -c -fmessage-length=0 -MT"src/echo.o" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -I../../echo_server_udp_bsp/ps7_cortexa9_0/include -MMD -MP -MF"src/echo.d" -MT"src/echo.o" -o "src/echo.o" "../src/echo.c"
../src/echo.c: In function 'recv_callback':
../src/echo.c:57:15: error: dereferencing pointer to incomplete type 'struct ip_addr'
RemoteAddr = *addr;
^~~~~
../src/echo.c:57:13: error: 'RemoteAddr' has an incomplete type 'struct ip_addr'
RemoteAddr = *addr;
^
../src/echo.c: In function 'start_application':
../src/echo.c:96:16: warning: passing argument 2 of 'udp_recv' from incompatible pointer type [-Wincompatible-pointer-types]
udp_recv(pcb, recv_callback, NULL);
^~~~~~~~~~~~~
In file included from ../src/echo.c:5:0:
../../echo_server_udp_bsp/ps7_cortexa9_0/include/lwip/udp.h:123:18: note: expected 'udp_recv_fn {aka void (*)(void *, struct udp_pcb *, struct pbuf *, const struct ip4_addr *, short unsigned int)}' but argument is of type 'void (*)(void *, struct udp_pcb *, struct pbuf *, struct ip_addr *, u16_t) {aka void (*)(void *, struct udp_pcb *, struct pbuf *, struct ip_addr *, short unsigned int)}'
void udp_recv (struct udp_pcb *pcb, udp_recv_fn recv,
^~~~~~~~
src/subdir.mk:51: recipe for target 'src/echo.o' failed
make: *** [src/echo.o] Error 1
13:18:47 Build Finished (took 632ms)
I ran into the same issue, and was able to fix it in SDK version 2018.3 by changing all instances of "struct ip_addr" to "struct ip4_addr".
If you look at section 3.1.2 of the project that this demo was based on (liked below), you see a note saying that this will be necessary in newer versions of Vivado.
[https://lancesimms.com/Xilinx/MicroZed_UDP_Server_for_Waveform_Centroiding_Chapter3_Part1.html]