Updated Jan 2025
SMP Demo for the XMOS XCORE.AI Explorer Board
Introduction
This demo uses the
Symmetric Multiprocessing (SMP) version of the FreeRTOS kernel.
It targets the XCORE.AI,
which has 16 cores. The demo project uses XMOS XTC Tools
to build the FreeRTOS XCORE.AI port (note the tools require a Linux host or a Linux like environment).
It demonstrates support for FreeRTOS symmetric multiprocessing (SMP)
in the kernel.
Source Code Organization
The project files for this demo are located in the
FreeRTOS/Demo/XCORE.AI_xClang/RTOSDemo
FreeRTOS/Source/portable/ThirdParty/xClang/XCORE.AI
The SMP Demo Application
The constant
mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
testing_main.h
When mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1
When
mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
When mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0
When
mainCREATE_SIMPLE_BLINKY_DEMO_ONLY
- Message buffers
- Stream buffers
- Task notifications
- Queues
- Semaphores
- Mutexes
- Event groups
- Software timers
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 to 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.
- Download the XMOS XTC Tools
.
- Uncompress the archive to your chosen installation directory. The example below will install to your home directory:
1$ tar -xf archive.tgz -C ~
- Configure the default set of environment variables:
1$ cd ~/XMOS/XTC/15.1.02$ source SetEnv
- Check that your tools environment has been setup correctly:
1$ xcc --help
- Make the XTAG drivers accessible to all users. This step is only required to be done once on a given development machine.
1$ cd ~/XMOS/XTC/15.1.0/scripts2$ sudo ./setup_xmos_devices.sh
- Check that the XTAG devices are available and accessible:
1$ cd ~/XMOS/XTC/15.1.0/scripts2$ ./check_xmos_devices.sh3Searching for xtag3 devices...40 found5Searching for xtag4 devices...61 found7Success: User <username> is able to access all xtag4 devices
- Check that the device is available for debugging:
1$ xrun -l2### Available XMOS Devices34 ID Name Adapter ID Devices5 -- ---- ---------- -------6 0 XMOS XTAG-4 2W3T8RAG P[0]7
Build and Run the demo application
- Go to the RTOSDemo directory:
1$ cd FreeRTOS/Demo/XCORE.AI_xClang/RTOSDemo
- Build the demo:
1$ make
- Run the demo:
1$ make run
RTOS Configuration and Usage Details
- Configuration items specific to this demo are in the file
. 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:FreeRTOS/Demo/XCORE.AI_xClang/RTOSDemo/src/FreeRTOSConfig.h
- - Set the number of cores.configNUM_CORES
- - Enable/Disable simultaneously running tasks with multiple priorities.configRUN_MULTIPLE_PRIORITIES
- - Enable/Disable setting a task's affinity to certain cores.configUSE_CORE_AFFINITY
- 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.Source/Portable/MemMang/heap_4.c
- vPortEndScheduler() has not been implemented.