Sockets in a socket set have a number of associated event bits of interest. An event bit of interest becoming set will cause the socket to unblock a call to FreeRTOSselect. Event bits of interest are set using the FreeRTOSFDSET API function, and cleared using the FreeRTOSFDCLR API function.
This page documents a FreeRTOS demo application for the Xilinx Zynq-7000 SoC,which incorporates a dual core ARM Cortex-A9 processor.
The demo is pre-configured to build with theXilinx SDK tools(version 2016.1 at the time of writing) and execute on theZC702evaluation board.
The project uses the default hardware design and board support package (BSP) shippedwith the SDK, and builds FreeRTOS and lwIP as part of the application (rather than partof the BSP).
IMPORTANT! Notes on using the FreeRTOS ARM Cortex-A9 port on the Xilinx Zynq-7000 SoCPlease read all the following points before using this RTOS port.Also see the FAQ My application does not run, what could be wrong?, andthe page that provides instruction on using FreeRTOS on ARM Cortex-A embedded processors.Source Code OrganizationThe FreeRTOS download contains the source code for all the FreeRTOS ports, andevery demo application. That means it contains many more files than are requiredto use the Zynq port, or the official Zynq demo application.See the Source Code Organizationsection of this web site for a description of the downloaded files, andinformation on creating a new project.
The directory structure used by the demo application is shown and describedbelow. The root CORTEX_A9_Zynq_ZC702 directory is itselflocated in FreeRTOS/Demo.Notes relating to the directory structure:
The Zynq-7000 SoC Demo ApplicationFunctionalityThe constant mainSELECTED_APPLICATION, which is #defined at the topof main.c, is used to switch between a simply Blinky style demo, a morecomprehensive test and demo application, and an lwIP demo, as described in thenext two sections.Functionality with mainSELECTED_APPLICATION set to 0If mainSELECTED_APPLICATION is set to 0 then main() will callmain_blinky(), which is implemented in main_blinky.c.
main_blinky() creates a very simple demo that includes two tasks and one queue.One task repeatedly sends the value 100 to the other task through the queue.The receiving task toggles an LED each time it receives the message. The messageis sent every 200 milliseconds, so the LED toggles every 200 milliseconds.
Functionality with mainSELECTED_APPLICATION set to 1If mainSELECTED_APPLICATION is set to 1 then main() will call main_full(),which is implemented in main_full.c.
main_full() creates a comprehensive test and demo applicationthat demonstrates:
Most of the tasks created by the demo are from the set of standard demotasks. These are used by all FreeRTOS demo applications, andhave no specific functionality or purpose other than to demonstrate the FreeRTOSAPI being used and test the RTOS kernel port.
The following tasks are created in addition to the standard demo tasks:
Functionality with mainSELECTED_APPLICATION set to 2If mainSELECTED_APPLICATION is set to 2 then main() will call main_lwIP(),which is implemented in main_lwIP.c.
The lwIP example can be configured to use either a static or dynamic IPaddress:
When connected correctly the demo uses the lwIP sockets API to createa FreeRTOS+CLI command console, and the lwIP raw API to create abasic HTTP web server. Server side includes (SSI) are used to generate dynamicdata in the served web pages.To connect to the http server simply type the IP address of the target intothe address bar of a web browser.
To connect to FreeRTOS+CLI, open a command prompt and enter 'telnet <ipaddr>'where <ipaddr> is the IP address of the target. Once connected type 'help'to see a list of registered commands. Note this example does not implementa real telnet server, it just uses the telnet port number to allow easyconnection using telnet tools.
Hardware setupThe demo uses the default hardware configuration.
All of the 5-way boot selection switches must be switched tothe right hand side when the board is viewed with the integrated Digilent JTAG module on thelower edge. This enables booting via JTAG.
Build InstructionsImporting the demo application project into the SDK Eclipse workspaceTo import the Xilinx Software Development Kit (SDK) project into an existing or new Eclipse Workspace:
Building the demo application
Starting a debug session
RTOS Configuration and Usage DetailsFreeRTOS ARM Cortex-A port specific configurationAttention please!: Refer to the the page that providesinstruction on using FreeRTOS on ARM Cortex-A embedded processors,paying particular attention to the value and meaning of theconfigMAX_API_CALL_INTERRUPT_PRIORITY setting, andthe special notes regarding using the floating point unit with GCC.
Configuration items specific to this demo are contained in /FreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/FreeRTOSConfig.h.The constants defined in this file can be edited to suit your application.
Interrupt vector tableBy default, SDK projects define the interrupt vector table as part of the BSP. Thismakes it difficult to install the FreeRTOS handlers using the methods describedon the page aboutrunning FreeRTOS on ARM Cortex-A embedded processors. Therefore this demodefines its own interrupt vector table in FreeRTOS_asm_vectors.S.The vector table defined by the BSP is replaced by the vector table defined inFreeRTOS_asm_vectors.S at run time by calling vPortInstallFreeRTOSVectorTable(),which in the demo, is done in the prvSetupHardware() function.
The vector table defined in FreeRTOS_asm_vectors.S is placed in a linkersegment called .freertos_vectors, and the linker script lscript.ld placesthe .freertos_vectors segment at the beginning of the .text region.
[Application Defined] Interrupt service routinesThis demo uses drivers provided by Xilinx to configure the interrupt controller,and install application defined interrupts. Examples can be found inFreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/serial.c andFreeRTOS/Demo/CORTEX_A9_Zynq_ZC702/RTOSDemo/src/Full_Demo/IntQueueTimer.c.
The Xilinx drivers require interruptservice routines (ISRs) to accept a void * parameter, although the parameteris not always used. The required ISR prototype is therefore:
The interrupt handler called prvUART_Handler() in serial.cprovides an example of an interrupt handler that does not use its parameter. Theinterrupt handler called prvTimerHandler() in IntQueueTimer.cprovides an example of an interrupt that uses its parameter to determine whichperipheral generated the interrupt, as in that case the same interrupt handlerimplementation is installed as the handler for more than one timer.
If an ISR causes a task of equal or higher priority than the currently executingtask to leave the Blocked state then the ISR must request a context switch beforethe ISR exits. When this is done the interrupt will interrupt one RTOS task,but return to a different RTOS task.
The macros portYIELD_FROM_ISR() (or portEND_SWITCHING_ISR()) can be used torequest a context switch from within an ISR.The following source code snippet is provided as an example. The example ISRuses a semaphore to synchronise with a task (not shown), and calls portYIELD_FROM_ISR()to ensure the interrupt returns directly to the task. The prvUART_Handler() andprvTimerhandler() functions already referenced provide further examples.
Only FreeRTOS API functions that end in 'FromISR' can be called from aninterrupt service routine - and then only if the priority of the interruptis less than or equal to that set by the configMAX_API_CALL_INTERRUPT_PRIORITYconfiguration constant (meaning a numerically higher value).
Resources used by FreeRTOSInformation is provided on the Using FreeRTOS on ARM Cortex-A Embedded Processors page.This demo is configured to generate the tick interrupt from the SCU timer.Memory allocationSource/Portable/MemMang/heap_4.c is included in the ARM Cortex-A demo application project to provide the memoryallocation required by the RTOS kernel.Please refer to the Memory Management section of the API documentation forfull information.MiscellaneousNote that vPortEndScheduler() has not been implemented.
[ Back to the top ][ About FreeRTOS ][ Privacy ][ Sitemap ][ Report an error on this page (with anti-spam) ]
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
FreeRTOS Support ArchiveThe FreeRTOS support forum can be used for active support both from Amazon Web Services and the community. In return for using our software forfree, we request you play fair and do your bit to help others! Sign upto receive notifications of new support topics then help where you can.This is a read only archive of threads posted to the FreeRTOS support forum.The archive is updated every week, so will not always contain the very latest posts.Use these archive pages to search previous posts. Use the Live FreeRTOS Forumlink to reply to a post, or start a new support thread. [FreeRTOS Home] [Live FreeRTOS Forum] [FAQ] [Archive Top] [May 2015 Threads] lwip for Zynq
Posted by seanbzd on May 11, 2015
Is there a lwip package available from freertos that I can use on my microzed? I tried to follow instructions from http://www.freertos.org/FreeRTOS-Plus/FreeRTOSPlusTCP/TCPNetworkingTutorialAddingSourceFiles.html but I'm stuck on step 2 talking about 'creating network drivers for other chips'. The downloaded package says 'ToBeReleasedSoon.txt' for this step. Any ideas? Thanks.
lwip for Zynq
Hi Sean,
A driver for FreeRTOS+TCP (not lwIP) is almost ready. It is developed and tested on a Microzed. TCP runs very fast with a nett speed up to 10 MB/sec (on a 100 mbit LAN).
If you like drop an email to http://www.freertos.org/RTOS-contact-and-support.html and we will send you the driver as it is now.
Regards.
lwip for Zynq
Sean - I'm not sure if you realise, but the title of your post mentions lwIP, but the link in your post is to FreeRTOS+TCP - which are completely different products.
If you want lwIP then there is a demo in the FreeRTOS .zip file download (http://www.freertos.org/RTOS-Xilinx-Zynq.html), if you want FreeRTOS+TCP then we can send you the code (as per Hein's post).
Regards.
lwip for Zynq
And if you decide to use lwIP, you may also contact us :-)I'm curious about the experiences with the EMAC drivers that are used for lwIP.
Thanks,Hein
lwip for Zynq
My mistake, for some reason I thought TCP was part of the lwip. I'm interested in freeRTOS+TCP for now. As suggested, i sent an email to the support group asking for it. Thanks.
lwip for Zynq
When reading your post, many people will think: TCP is part of lwIP!
Some history:
lwIP (light-weight IP) and uIP (micro-IP) are both TCP/IP stacks, originally developed by Adam Dunkels. They are libraries for embedded applications which allow you to communicate through Ethernet / Internet. The libraries have been ported to many platforms and they are supported by, but not depending on FreeRTOS.
Since about half a year, FreeRTOS has its own TCP/IP-stack which is called FreeRTOS+TCP. It supports TCP, UDP, ICMP and it includes higher protocols like DHCP, nameservers (DNS, LLMNR, NBNS) and HTTP and FTP.
Regards.
lwip for Zynq
Hein, Thanks for the clarification.
I have imported the FreeRTOS+TCP project I received over email from Richard. The HW platform says it is for ZC702. I have Microzed xc7z010 board I'm using. I've built the project I received, customized IP Address, default gateway etc..and when I try to run it, the application is having problems like, allocating heap memory, creating Queues in the main() etc...should the project as-is not expected to work on the board that I have? probably a stupid question but i am more of a application programmer.
lwip for Zynq
Hein has sent you a hardware project for the Microzed xc7z010.
Regards.
lwip for Zynq
Thanks. I was able to get the standalone project I received from Hein work build and work. Now I'm trying to port just the TCP portion of it into my application. But it has references to the FreeRTOS+FAT. It is not clear to me whether this is needed for TCP to work? I would like to port the minimum set possible into my application because I'm only interested in TCP.
lwip for Zynq
FreeRTOS+FAT is only needed if you want to run the FTP or HTTP servers.
Regards.
lwip for Zynq
Hi Sean,
In order to include TCP/UDP into your Xilinx application you only need to include these source files:
As you are one of the first users of this port, please keep us informed about how things are going.
Your platform has a lot of fast DDR RAM. If you want really high-speed TCP connections, allow bigger buffers.
If performance is important, just play with the parameters (see also the socket option
FREERTOS_SO_WIN_PROPERTIES ). You can also look at the communication with a capture program like Wireshark.
Regards.
[ Back to the top ][ About FreeRTOS ][ Privacy ][ Sitemap ][ Report an error on this page (with anti-spam) ]
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
Comments are closed.
|
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |