Skip to content

Latest commit

 

History

History
155 lines (130 loc) · 6.13 KB

File metadata and controls

155 lines (130 loc) · 6.13 KB

FreeRTOS SMP Demo for XMOS XCORE.AI Explorer Board

FreeRTOS-SMP Kernel is still being tested.

This page documents a demo that uses the FreeRTOS symmetric multiprocessing (SMP) version. The demo targets the XCORE.AI, which has 16 cores. The project uses XMOS XTC Tools to build the FreeRTOS XCOREAI port. This application demonstrates the Symmetric Multiprocessing (SMP) support in the FreeRTOS Kernel.


IMPORTANT! Notes on using the FreeRTOS XCORE.AI demo application

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

  1. Source Code Organization
  2. The Demo Application
  3. Building and Running the RTOS Demo Application
  4. RTOS Configuration and Usage Details

Also see the FAQ My application does not run, what could be wrong?


Source Code Organization

The project files for this demo are located in the FreeRTOS/Demo/XCORE.AI_xClang/RTOSDemo directory of the FreeRTOS SMP Demo Git repository. FreeRTOS Port files compiled in the project are in the FreeRTOS/Source/portable/ThirdParty/xClang/XCOREAI directory.


The Demo Application

The constant mainCREATE_SIMPLE_BLINKY_DEMO_ONLY, which is defined at the top of testing_main.h, is used to switch between a simple "blinky" style getting started project and a more comprehensive test and demo application.

When mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1

When mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1, the demo application creates two tasks, each of which periodically toggles an on-board LED (LED 0 by one task and and LED 1 by the other).

When mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0

When mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0, the demo application implements a comprehensive test and demo that, among other things, demonstrates and/or tests:

The created tasks are from the set of standard demo tasks. Standard demo tasks are used by all FreeRTOS port demo applications. They have no specific functionality, and were created simply to demonstrate how to use the FreeRTOS API, and test the RTOS port.

Two "check" tasks are created to periodically inspect the standard demo tasks (which contain self monitoring code) to ensure all the tasks are functioning as expected. One check task monitors the demo tasks running on tile 0 and toggles LED 0 each time it executes. The other check task monitors the demo tasks running on tile 1 and toggles LED 1 each time it executes. This gives visual feedback of the system health. If both the LEDs toggle every 3 seconds, then the check tasks have not discovered any problems. If any LED toggles every 200ms, then the check task has discovered a problem in one or more tasks.


Building and Running the RTOS Demo Application

Hardware setup

Plug the xTAG programmer into the evaluation board. Ensure both the xTAG and evaluation board are connected to the computer via USB.

Toolchain installation

The development tools require a Linux host or a Linux style environment.

  1. Download the XMOS XTC Tools.
  2. Uncompress the archive to your chosen installation directory. The example below will install to your home directory:
$ tar -xf archive.tgz -C ~
  1. Configure the default set of environment variables:
$ cd ~/XMOS/XTC/15.1.0
$ source SetEnv
  1. Check that your tools environment has been setup correctly:
$ xcc --help
  1. Make the XTAG drivers accessible to all users. This step is only required to be done once on a given development machine.
$ cd ~/XMOS/XTC/15.1.0/scripts
$ sudo ./setup_xmos_devices.sh
  1. Check that the XTAG devices are available and accessible:
$ cd ~/XMOS/XTC/15.1.0/scripts
$ ./check_xmos_devices.sh
Searching for xtag3 devices...
0 found
Searching for xtag4 devices...
1 found
Success: User <username> is able to access all xtag4 devices
  1. Check that the device is available for debugging:
$ xrun -l
Available XMOS Devices
----------------------

  ID  Name            Adapter ID    Devices
  --  ----            ----------    -------
  0   XMOS XTAG-4     2W3T8RAG      P[0]

Build and Run the demo application

  1. Go to the RTOSDemo directory:
$ cd FreeRTOS/Demo/XCORE.AI_xClang/RTOSDemo
  1. Build the demo:
$ make
  1. Run the demo:
$ make run

RTOS Configuration and Usage Details

  • Configuration items specific to this demo are contained in FreeRTOS/Demo/XCORE.AI_xClang/RTOSDemo/src/FreeRTOSConfig.h. The constants defined in that file can be edited to suit your application. The following configuration options are specific to the SMP support in the FreeRTOS Kernel:
    • configNUM_CORES - Set the number of cores.
    • configRUN_MULTIPLE_PRIORITIES - Enable/Disable simultaneously running tasks with multiple priorities.
    • configUSE_CORE_AFFINITY - Enable/Disable setting a task's affinity to certain cores.
  • Source/Portable/MemMang/heap_4.c is included in the project to provide the memory allocation required by the RTOS kernel. Please refer to the Memory Management section of the API documentation for complete information.
  • vPortEndScheduler() has not been implemented.