zynq-sdk中设置了LWIP库,但是使用freertos编写网络程序却报错,已解决

在zynq的sdk中添加了lwip和freertos库,在使用库API后编译报错如下:

arm-none-eabi-gcc -Wall -O0 -g3 -c -fmessage-length=0 -MT"src/freertos_tcp_perf_server.o" -mcpu=cortex-a9 -mfpu=vfpv3 -mfloat-abi=hard -I../../210304_bsp/ps7_cortexa9_0/include -MMD -MP -MF"src/freertos_tcp_perf_server.d" -MT"src/freertos_tcp_perf_server.o" -o "src/freertos_tcp_perf_server.o" "../src/freertos_tcp_perf_server.c"
../src/freertos_tcp_perf_server.c:13:8: error: unknown type name 'sys_thread_t'
 static sys_thread_t main_thread_handle;
        ^~~~~~~~~~~~
../src/freertos_tcp_perf_server.c: In function 'tcp_recv_perf_traffic':
../src/freertos_tcp_perf_server.c:30:21: error: storage size of 'local' isn't known
  struct sockaddr_in local, remote;
                     ^~~~~
../src/freertos_tcp_perf_server.c:30:28: error: storage size of 'remote' isn't known
  struct sockaddr_in local, remote;
                            ^~~~~~
../src/freertos_tcp_perf_server.c:41:2: warning: implicit declaration of function 'getsockname' [-Wimplicit-function-declaration]
  getsockname(sock, (struct sockaddr *)&local, (socklen_t *)&size);
  ^~~~~~~~~~~
../src/freertos_tcp_perf_server.c:41:48: error: 'socklen_t' undeclared (first use in this function)
  getsockname(sock, (struct sockaddr *)&local, (socklen_t *)&size);
                                                ^~~~~~~~~
../src/freertos_tcp_perf_server.c:41:48: note: each undeclared identifier is reported only once for each function it appears in
../src/freertos_tcp_perf_server.c:41:59: error: expected expression before ')' token
  getsockname(sock, (struct sockaddr *)&local, (socklen_t *)&size);
                                                           ^
../src/freertos_tcp_perf_server.c:42:2: warning: implicit declaration of function 'getpeername' [-Wimplicit-function-declaration]
  getpeername(sock, (struct sockaddr *)&remote, (socklen_t *)&size);
  ^~~~~~~~~~~
../src/freertos_tcp_perf_server.c:42:60: error: expected expression before ')' token
  getpeername(sock, (struct sockaddr *)&remote, (socklen_t *)&size);

原因已查明:软件生成的lwip库默认是RAW裸机API,将下图中的api_mode改为SOCKET_API即可,然后重新编译。
zynq-sdk中设置了LWIP库,但是使用freertos编写网络程序却报错,已解决_第1张图片

你可能感兴趣的:(zynq,freertos,tcpip,嵌入式)