This page details the FreeRTOS STR91x ARM9 port for the IAR development tools.
The port is provided with an embedded web server demo targeted at the STR910-EVAL development kit (instructions are provided should you wish to use an alternative development board) which:
FreeRTOS has made some modifications to the uIP stack since this demo was created. See the Embedded Ethernet Examples List page for more information.
(1 Paul YU performed the initial integration of lwIP into the existing FreeRTOS demo. ST also contributed. Thanks guys!)
Note: If this project fails to build then it is likely the version of IAR Embedded Workbench being used is too old. If this is the case, then it is also likely that the project file has been (silently) corrupted and will need to be restored to its original state before it can be built even with an updated IAR version.
IMPORTANT! Notes on using the STR9 RTOS port Web Server DemoPlease read all the following points before using this RTOS port.
My application does not run, what could be wrong?
Source Code OrganisationThe FreeRTOS download contains the source code for all the FreeRTOS ports, so contains many more files than used by this demo. See the Source Code Organization section for a description of the downloaded files and information on creating a new project.
The STR9 Web Server demo project workspace rtosdemo.eww can be found in the Demo/ARM9_STR91X_IAR directory and should be opened from within the Embedded Workbench IDE.
The uIP stack is located in Demo/Common/ethernet/uIP/uip-1.0.
The lwIP stack is located in Demo/Common/ethernet/lwIP.
The Demo Application
Demo application setup
Demo project organisation
The RTOSDemo workspace (Demo/ARM9_STR91X_IAR/RTOSDemo.eww) contains a single project, for which the following configurations are provided:
Building the demo application for debugSimply open the rtosdemo.eww workspace file from within the IAR Embedded Workbench IDE, ensure THUMB is the selected configuration if you are using the 32K limited compiler, then select 'Build Target' from the IDE 'Project' menu.
Running the demo application
FunctionalityThe demo application creates more than 40 tasks - consisting predominantly of the standard demo application tasks (see the demo application section for details of the individual tasks). In addition to the standard demo tasks the following tasks are created to demonstrate features of the development board and RTOS.
When executing correctly the demo application will behave as follows:
Configuration and Usage Details
Library FilesThe demo relies heavily on the STMicroelectronics peripheral library files, with the following notes and modifications:
HTML PagesThe HTML pages are converted to constant C structures that are built into the flash image. The Perl script Demo/ARM9_STR91X_IAR/webserver/makdefsdata can be used for this purpose.
CGI ScriptsEach of the served uIP web pages includes some dynamic data to demonstrate the use of the uIP CGI scripting facility. See the uIP documentation for further information.
The RTOS CGI file generates a table containing information on each task executing within the demo. This table is interesting for demonstration purposes, but as it is necessary to leave the RTOS scheduler suspended for an extended period during its creation it is not recommended for use in applications with strict real time requirements.
ENET Driver Re-entrancyThe uIP task is the only task that accesses the uIP and DMA buffers, and therefore explicit re-entrancy is not required for this demo.
PerformanceThe uIP stack only permits one packet to be unacknowledged at any one time. It waits for each packet to be acknowledged individually. Performance is therefore greatly improved by transmitting dynamically generated data as one large packet, rather than multiple small packets. This is demonstrated by the sample CGI scripts included in the source code download. The CGI script used to generate the table of tasks transmits the entire table in one packet and therefore loads quickly. The CGI scripts used to generate the table of TCP/IP connections and the table of TCP/IP statistics both transmit each line within the respective tables individually, and therefore the pages take longer to load. The lwIP TCP/IP stack does not have this limitation.
NOTE! : The processor MUST be in supervisor mode when the RTOS scheduler is started (vTaskStartScheduler is called). The demo applications included in the FreeRTOS download switch to supervisor mode prior to main being called. If you are not using one of these demo application projects then ensure Supervisor mode is entered before calling vTaskStartScheduler().
To use ARM mode the preeprocessor constant _RUN_TASK_IN_ARM_MODE_ must be defined as part of the project settings. Naturally the compiler must also be set to generate ARM code.
RTOS port specific configurationConfiguration items specific to this port are contained in Source/Demo/ARM9_STR91X_IAR/FreeRTOSConfig.h. The constants defined in this file can be edited to suit your application. In particular - the definition configTICK_RATE_HZ is used to set the frequency of the RTOS tick. The supplied value of 1000Hz is useful for testing the RTOS kernel functionality but is faster than most applications require. Lowering this value will improve efficiency.
Each port #defines 'BaseType_t' to equal the most efficient data type for that processor. This port defines BaseType_t to be of type long.
Note that vPortEndScheduler() has not been implemented.
Interrupt service routinesThe task context is automatically saved on entry to an ISR, and restored on exit from an ISR. Interrupt service routines should therefore be defined just like any other function with no special syntax or assembly file wrappers required.
The macro portEND_SWITCHING_ISR() is provided to enable an ISR to perform a task switch if appropriate (for example, if a character being received on a UART has woken a higher priority task that was waiting for the character).
See the functions UART1_IRQHandler() and ENET_IRQHandler() in the files serial.c and uIP_Task.c respectively for examples.
Switching between the pre-emptive and co-operative RTOS kernelsSet the definition configUSE_PREEMPTION within Demo/ARM9_STR91X_IAR/FreeRTOSConfig.h to 1 to use pre-emption or 0 to use co-operative.
Compiler optionsAs with all the ports, it is essential that the correct compiler options are used. The best way to ensure this is to base your application on the provided demo application makefile.
Memory allocationSource/Portable/MemMang/heap_2.c is included in the STR9 demo application project to provide the memory allocation required by the RTOS kernel. Please refer to the Memory Management section of the API documentation for full information.
Serial port driverIt should also be noted that the serial drivers are written to test some of the real time kernel features - and they are not intended to represent an optimised solution.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
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.
FreeRTOS and other embedded software careers at AWS.