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




FreeRTOS Web Server Demo
Using Eclipse and OpenOCD for a completely open
source development environment

[Embedded Ethernet Examples]


Please note: Due to problems in early LPC2368 devices the MAM (memory accelerator) mode must be set to zero in order for this demo to execute correctly.

The demo described by this page uses FreeRTOS.org, Eclipse Europa, the Yagarto GCC tools, OpenOCD and the uIP mini TCP/IP stack to create a simple web server example for an NXP LPC2368 ARM7 microcontroller. The demo is configured for use on the MCB2368 prototyping board (instructions are provided should you wish to use an alternative development board).

The Europa version of Eclipse includes enhancements that facilitate cross development.

The FreeRTOS zip file contains every thing required other than the Eclipse and Yagarto tools. Please follow these instructions carefully to install and configure Eclipse correctly for use with this demo application.

The included OpenOCD executable and associated configuration files are set for use with a Macraigor Wiggler compatible JTAG interface.

Note that uIP and OpenOCD are licensed separately from FreeRTOS.org. Users must familiarise themselves with the respective licenses.

FreeRTOS has made some modifications to the uIP stack since this demo was created. See the Embedded Ethernet Examples List page for more information.

This demo is also available pre-configured for use with Rowley CrossStudio. An alternative demo targeted at the LPC2378 using the HiTOP development tools is available from Hitex.

Note to Linux users: Although all the tools used are cross platform - I have only tested the LPC2368/Eclipse build on a windows host.


IMPORTANT! Notes on using the Eclipse LPC23xx Web Server Demo

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

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

Source Code Organisation

The Eclipse workspace for the Eclipse LPC2368 demo is located in the FreeRTOS/Demo/ARM7_LPC2368_Eclipse directory. This is the directory to select when prompted for a workspace location during the Eclipse startup process. Be sure to read the Eclipse installation and configuration instructions prior to building the project.

The FreeRTOS zip file download contains the files for all the ports and demo application projects. It therefore 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 Demo Application

Demo application setup

Connect the MCB2300 development board to a computer running a web browser either directly using a point to point (crossover) cable, or via a hub/router using a standard Ethernet cable. The prototyping board may also allow the use of a standard Ethernet cable when connecting point to point, but I have not tried this configuration.

The IP address used by the demo is set by the constants uipIP_ADDR0 to uipIP_ADDR3 within the file FreeRTOS/Demo/ARM7_LPC2368_Eclipse/RTOSDemo/webserver/uIP_Task.c. The IP addresses used by the web browser computer and the prototyping board must be compatible. This can be ensured by making the first three octets of both IP addresses identical. For example, if the web browser computer uses IP address 192.168.100.1, then the prototyping board can be given any address in the range 192.168.100.2 to 192.168.100.254 (barring any addresses already present on the network).

The constants uipMAC_ADDR0 to uipMAC_ADDR5 within the same file define the MAC address used by the target hardware. You must ensure that the configured MAC address is unique on the network to which the prototyping board is being connected.

The demo application uses the LEDs and LCD built onto the prototyping board so no other hardware setup is required.


Building the demo application

Again - please refer to the Eclipse installation and configuration instructions for more detailed information.
  1. Ensure the Yagarto (or equivalent) GCC tools are installed, and that the Yagarto/bin directory is included within your PATH environment variable.
  2. Open the FreeRTOS/Demo/ARM7_LPC2368_Eclipse Eclipse workspace.
  3. Ensure the FreeRTOS_ROOT variable has been configured.
  4. Press F7 (or select "Build All" from the "Project" menu) to build the demo application.


Running the demo application

Once again - please refer to the Eclipse installation and configuration instructions for more detailed information.
  1. Ensure the Wiggler JTAG debug interface is connected and that the MCB2300 development board is power up.
  2. Ensure an Ethernet cable is connected as described above.
  3. Select "OpenOCD Programmer" from the "Run | External Tools" menu - then wait for the programming to complete.
If you then wish to commence a debugging session:
  1. Select "OpenOCD Server" from the "Run | External Tools" menu.
  2. Switch to the debugging perspective.
  3. Select the OpenOCD server executable within the Debug pane.
  4. Click the "Debug RTOSDemo" speed button (the one with the little green bug icon).


Functionality

The demo application creates 27 tasks. These tasks consist predominantly of the standard demo application tasks (see the demo application section for details of the individual tasks).

The following tasks/functions are created in addition to the standard demo tasks:

  • The uIP task
    This task handles all the network processing. It will spend most of its time blocked on a semaphore - waiting to be woken by interrupts generated by incoming network packets.

  • An LCD task
    This is a 'gatekeeper' task. It is the only task that is permitted to write to the LCD, thus ensuring consistent access. Other tasks wishing to write to the LCD send the string to be displayed to the LCD task rather than accessing the LCD directly.

  • The 'check' tick hook
    The 'check' tick hook is responsible for ensuring that all the standard demo tasks are executing as expected. It only executes every five seconds (from within the RTOS tick interrupt). Any errors discovered by the check function are latched until the processor is reset. At the end of each execution the check function sends either a pass or fail message to the 'LCD' task for display on the LCD (via the LCD task as described above).

When executing correctly the demo application will behave as follows:

  • LEDs P2.0, P2.1 and P2.3 are under control of the 'flash' tasks. Each will flash at a constant frequency, with LED P2.0 being the fastest and LED P2.3 being the slowest.
  • The 'check' function will write "PASS" to the display every 5 seconds.
  • The target hardware will serve the web pages described below to a standard web browser. To connect to the target:
    1. Open a web browser on the connected computer.
    2. Type "HTTP://" followed by the target IP address into the browsers address bar.


      Entering the IP address into the web browser
      (obviously use the correct IP address for your system)


Served Web Pages

The top of each served page includes a menu containing a link to every other page.


The served RTOS stats page

The RTOS stats page provides run time information on the state of each task within the system - including the stack high water mark (the minimum amount of stack there has been available at any time since the task started executing). The page will reload approximately every two seconds - depending on network load.

This page is transmitted in three sections - the HTML header and menu, the dynamically generated content, then finally the HTML footer. This makes the page relatively fast to load. It could be optimised further by transmitting the entire page in one go.

The continuous reloading can sometimes make navigating away from the RTOS stats page a little tricky.


The served IO page

The IO page provides a simple interface that permits data to be sent to the LEDs and LCD on the MCB2300 development board.

The three check boxes permit the state of the LEDs on outputs P2.5, P2.6 and P2.7 to be set and queried. The text box can be used to write a message to the LCD, but does not query the text currently being display. Changes are sent to the target hardware by clicking the "Update IO" button.

Note that the 'check' task updates the display every 5 seconds, so any text sent from a web client will soon be overwritten.

The TCP Stats and Connections pages display run time networking information. Note that these pages transmit each line individually so will not load quickly. This demonstrates how memory usage can be optimised through the use of a small transmit buffer by sacrificing the achieved data throughput.



RTOS Configuration and Usage Details

This demo uses the FreeRTOS LPC2000 GCC port - important usage information can be found on the standard LPC2000 GCC demo documentation page.





[ 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