Download FreeRTOS

Quality RTOS & Embedded Software

Achieving Unbrickable MCU FOTA for your FreeRTOS-powered Firmware:
FreeRTOS 202012 LTS end of support announced.
FreeRTOS website now available in Simplified Chinese
New FreeRTOS Long Term Support version now available.
FreeRTOS Extended Maintenance Program (EMP) registration now open.

Philips LPC2138 (ARM7) RTOS Port
For the Rowley CrossFire LPC2138
[RTOS Ports]

This page demonstrates the FreeRTOS Rowley CrossWorks (GCC) LPC2000 port running on a CrossFire LPC2138 embedded evaluation kit (instructions are provided should you wish to use an alternative development board).

The CrossFire LPC2138 is a low cost evaluation platform that includes a USB CrossConnect JTAG debugging interface on board. The evaluation version of the CrossWorks embedded development tools can be used to develop software for the CrossFire board with no compiled code size or time restrictions.

IMPORTANT! Notes on using the LPC2138 RTOS port

Please read all the following points before using this RTOS port.

  1. Source Code Organisation
  2. The Demo Application
  3. Configuration and Usage Details
See also the FAQ My application does not run, what could be wrong?

Source Code Organization

The FreeRTOS download contains the source code for all the FreeRTOS ports and demonstrations and therefore contains many more files than required by this demo. See the Source Code Organization section for a description of the downloaded files and information on creating a new project.

The Rowley CrossWorks / GCC demo project file for the Philips LPC2138 ARM7 microcontroller is called RTOSDemo.hzp and is located in the FreeRTOS/Demo/ARM7_LP2138_Rowley directory.

The Demo Application

Build configurations

Four build configurations are provided as shown in the image below.

Selecting the build configuration within the CrossWorks IDE

RTOS Demo application hardware setup

Connect the CrossFire board to your development host using the supplied USB cable. You will be prompted to install the CrossConnect drivers if you have not previously done so.

The demo application utilises the LED and button that are built onto the CrossFire board, so no additional hardware setup is required.

Building and executing the RTOS demo application

The RTOS demo application can be built and download in a single step by selecting "Build and Debug" from the "Build" menu, or simply hitting F5. The project should build with no errors or warnings.

Building and downloading the demo application


The demo application includes the following tasks:
  • A set of the standard demo tasks
    Including the polled queue, blocking queue, semaphore, math and dynamic priority tasks. See the RTOS demo pages for further information.

  • A print task
    Messages can be written from the CrossFire board for display within the CrossStudio terminal IO window. To ensure exclusive access to this facility only one task - the print task - is permitted to write to the terminal. Other tasks wanting to display a message do not do so directly, but instead send the message to the print task. The print task will block when no messages are waiting to be displayed.

  • A check task
    The check task executes periodically. It monitors the standard demo tasks, writing 'PASS' to the terminal IO (via the print task) should all the tasks be executing without error, and 'FAIL' should an error have been detected at any time.

  • A button handler task The button handler task is unblocked in response to interrupts generated by the button marked 'BUT' on the CrossFire board. Each execution of the button handler task causes a table of task status information to be displayed within the terminal IO window. The button handler task is included to demonstrate switching task context from within an interrupt service routine.

  • An LED task This simply flashes the CrossFire LED every second.
When executing correctly:
  • The LED will flash every second.
  • 'PASS' will be printed to the terminal IO every 5 seconds.
  • Task status information will be printed to the terminal IO each time 'BUT' is pushed.
Example output:

Task          State  Priority  Stack	#
Button		R	3	99	21
PolSEM2		R	0	97	4
SUSP_RX		R	0	93	11
CNT_INC		R	0	102	7
QProdB2		R	0	94	13
QProdB3		R	0	94	14
QConsB6		R	0	94	17
QProdB5		R	0	94	16
IDLE		R	0	104	22
IntMath		R	0	102	0
Print		R	0	93	20
PolSEM1		R	0	97	3
C_CTRL		B	0	98	9
SUSP_TX		B	0	102	10
QProdNB		B	2	99	2
LED		B	2	102	18
BlkSEM1		B	1	90	5
BlkSEM2		B	1	96	6
QConsB1		B	2	99	12
QConsB4		B	2	99	15
Check		B	3	99	19
QConsNB		B	2	99	1
LIM_INC		S	1	103	8


Configuration and Usage Details

This demo uses the standard FreeRTOS LPC2000 GCC port files. Please read the configuration and usage section on the LPC2106 demo documentation page for more information.

Note: The RTOS scheduler does not install a default interrupt handler (to handle spurious interrupts). The application should ensure an appropriate handler is installed.

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