Microblaze Spartan-3A Demo


The demo application has been tested on the following evaluation kit:

The Microblaze demo includes an FPGA Firmware design with several peripherals to demonstrate their integration with the RTOS.

The demo uses:


IMPORTANT! Notes on using the Microblaze 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

See the Source Code Organization section of the FreeRTOS site for a description of the downloaded files and information on creating a new project.

The Demo Application

Microblaze Demo application setup

The Microblaze Demo application is designed to run a set of Common Demo Tasks, one of which is a UART loopback check. To enable this demo task to run without failing, please install a loopback (pins 2 and 3 of the UART connector).

The Spartan-3A is programmed and debugged using the Xilinx Platform Cable USB II Programmer/Debugger. You may be prompted to install various USB drivers the first time a USB connection is made between the evaluation board and a PC.

Build Instructions

Within the ‘Xilinx Platform Studio’ open the your own project or the provided 'FreeRTOS_Demo_v7_XDK-Design/FreeRTOS_Demo_Design/FreeRTOS_Demo_Design.xmp'.

Select the ‘Project→Export Hardware Design to SDK’ menu item. This will generate a BitStream that can be used to program the hardware as well as generating a workspace for the SDK.

Launch the ‘Xilinx Software Development Kit’. When prompted for a Workspace, either create a new one or select the workspace that has been generated in the XPS project / SDK directory.

Within the XSDK select the ‘File→Import’ menu item and follow the wizard to import a ‘General→Existing Projects into Workspace’. Select the ‘Root Directory’ of the ‘FreeRTOS_Core_0’ project. Ensure that ‘Copy projects into workspace’ is ticked. The include paths are all relative to the project within the workspace.

Once the project has been included, ensure that it is linked with a Board Support Package. If a clean workspace was created, then it may be necessary to create a ‘File→New→Xilinx Hardware Platform Specification’ navigating to the XPS Project / SDK / SDK_Export / hw / system.xml which describes the hardware to the SDK. Additionally, a ‘File→New→Xilinx Board Support Package’ is required, linking it to the Hardware Description that was created in the last step and select the ‘standalone’ from ‘Board Support Package OS’.

Once a Hardware Description and Board Support Package are present in the workspace, right-click on the ‘FreeRTOS Demo’ project in the ‘Project Explorer’ view and select ‘Change referenced BSP’ to match the Board Support Package that was just created.

The Software can be built by selecting 'Build All..' from the 'Project' menu.

Use the ‘Xilinx Platform Studio’ to open the FPGA project and select the ‘Device Configuration→Download Bitstream’ menu item to program the FPGA. Note that there may be some licensing constraints imposed by the IP cores used in the FPGA design.

Switch to the ‘Xilinx Software Development Kit’. Select ‘Run→Debug Configurations…’ and within the dialog, right click ‘Xilinx C/C++ ELF’ and select ‘New Configuration’. This configuration should be set to download the ‘Debug/FreeRTOSDemo.elf’ file from the ‘FreeRTOS_Demo’ project. The default options for the rest of the configuration should be sufficient. Finally click the ‘Debug’ button. A reminder will be displayed regarding programming the FPGA.


Functionality

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

When executing the demo application will behave as follows:


RTOS Configuration and Usage Details

RTOS Port specific configuration

Configuration items specific to these demos are contained in FreeRTOS_Core_0/Demo/MicroBlaze/FreeRTOSConfig.h. The constants defined in this file can be edited to suit your application. In particular -

Each port #defines 'portBASE_TYPE' to equal the most efficient data type for that processor. This port defines portBASE_TYPE to be of type long.

Note that vPortEndScheduler() has not been implemented.

Interrupt service routines

The MicroBlaze port uses the XPS Interrupt Controller to support Interrupt Service Routines. Please install ISRs by calling xPortInstallInterruptHandler() as defined in 'FreeRTOS_Core_0/Source/portable/GCC/MicroBlaze/port.c'.

Switching between the pre-emptive and co-operative real time kernels

Set the definition configUSE_PREEMPTION within FreeRTOS/Demo/MicroBlaze/FreeRTOSConfig.h to 1 to use pre-emption or 0 to use co-operative.

Compiler options

As 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 files.

Memory allocation

Source/Portable/MemMang/heap_3.c is included in the MircoBlaze demo application project to provide the memory allocation required by the real time kernel. Please refer to the Memory Management section of the API documentation for full information.

The Linker script used to define the memory regions is 'FreeRTOS_Core_0/src/ldscript.ld'.






Copyright (C) 2010 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOS 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..