Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists