Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

Zynq/FreeRTOS/lwip confusion

Posted by krbvroc1 on January 18, 2017

I am trying to come up to speed with this environment and have confused myself. I am using the FreeRTOS 8.2.3 and LWIP1.4.1 that comes with Vivado (came with my Zybo [Zynq 7010] trainer board).

lwip says to use the RAW API for high performance TCP which I want to do. I planned on running the lwip it its own thread. The lwip RAW API examples show a simple mainloop design that would appear to chew up 100% CPU in a tight loop polling for packets to process. I would seem a better design to invoke the receiver from the DMA ISR (or use a task notification / semaphore) so it is interrupt / DMA driven.

It seems that in order to use the RAW API I have to define my lwip with NO_SYS even though I am running with FreeRTOS. (That is how vivado configured it). I understand I will need to limit my interaction with lwip to a single thread and use FreeRTOS to communicate with the thread.

The very first thing I notice is that lwip says to create its threads using a systhreadnew() call. If I am reading the lwip/Xilinx library correctly, that appears to be a wrapper for pthreadcreate(). How is that going to work with FreeRTOS and using xTaskCreate() and trying to communicate using a queue or task notify between the two. On the surface it doesn't make sense and the whole thing is confusing. Or do I ignore the lwip docs and use xTaskCreate() for my single lwip task -- perhaps systhread_new is only when using socket/netconn API. I really just want to let lwip run in a single task and interact with that task via the FreeRTOS stuff described in the book like task notifications, event groups, etc.


Zynq/FreeRTOS/lwip confusion

Posted by rtel on January 18, 2017

Not an expert of lwIP, but it was not originally designed to run multi-threaded, so what you are saying is not a surprise. We have run it that way too - so long as you only use the code from one thread it works.

Don't ignore the lwIP docs. You need to use a FreeRTOS port layer so systhreadnew() calls xTaskCreate(). Xilinx have one, as do we, in fact if you use the SDK wizard to create a FreeRTOS project you have the option of adding lwIP into the mix too. Alternatively the main FreeRTOS download has an lwIP example for the Zynq (http://www.freertos.org/RTOS-Xilinx-Zynq.html) and we have our own multi-threaded TCP running on the Zynq too: http://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusTCP/TCPIPFATExamplesXilinxZynq.html


Zynq/FreeRTOS/lwip confusion

Posted by krbvroc1 on January 18, 2017

I guess this is why I am confused. I used the SDK to create a FreeRTOS project and I added in the lwip to the BSP settings and I generated the FreeRTOS hello world example that the SDK creates for me. So far that is all I have done and the examples passes.

I would think the Xilinx SDK would have handled this. But when I look at the lwipopt include file it has NOSYS set (and there is no mention of OSIS_FREERTOS). I would think both of those would need to be set for the FreeRTOS layer to be present that you mention. But then the lwip documentation talks about RAW API mode is for standalone without an OS. I got the impression that FreeRTOS port layer is only for the higher level socket/netconn API, not the RAW API. That is why I was thinking maybe for RAW API only I should use xTaskCreate() and run the lwip stuff in that task. Since it is single threaded it should not be creating or communicating with any other tasks.

I don't know if I have the liberty to use the FreeRTOS+TCP and I know I need to support multiple (x3) netif.


Zynq/FreeRTOS/lwip confusion

Posted by heinbali01 on January 19, 2017

If you decide to use lwIP, why not the latest 2.0.0 version ?

FreeRTOS+TCP has recently been extended with the possibility to use multiple interfaces (NIC's). That works well with IPv4 sockets. That version has not been released officially, but anyone is welcome to try out this beta release.

FreeRTOS+TCP is simple to use as it only offers a BSD socket interface and API's. It does have optimisations like zero-copy send()/recv().


Zynq/FreeRTOS/lwip confusion

Posted by rtel on January 19, 2017

There is an example integration here, but it is VERY OLD: https://interactive.freertos.org/hc/en-us/community/posts/210028826-FreeRTOS-Win32-project-with-lwIP-web-server


Zynq/FreeRTOS/lwip confusion

Posted by krbvroc1 on January 19, 2017

I did see that a 2.0.0 version of lwip was released but I thought it might be smarter to stick with what comes with the Xilinx SDK tools and with what they maintain rather than having to port something new.

Xilinx already provides the network driver layer (with DMA support) for the emacps and axiethernet MAC on 1.4.1. Does the FreeRTOS+TCP provide that currently for both those?


Zynq/FreeRTOS/lwip confusion

Posted by heinbali01 on January 20, 2017

FreeRTOS+TCP does not yet support 'axiethernet'. If you write a networkInterface.c for it, you'll will get free support from us :-)


Zynq/FreeRTOS/lwip confusion

Posted by epok13 on February 6, 2017

Hi, This post just to say I ran into the same error type with Vivado 2016.4 and zynq's ps7_ethernet.

It seems that OSISFREERTOS definition is missing, but even when I manually define it (e.g. in lwipopts.h), I still obtain errors when creating a sample FreeRTOS LwIP echo server.

I'll try manually dealing with RAWAPI instead of SOCKETAPI for now, as the sample echo server code for FreeRTOS seems to exclusively use sockets.

There seems to be an issue in Xilinx SDK configuration of LwIP socket + FreeRTOS. If I can't get anywhere, I'll go to Xilinx forums for help.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner