|Hint: Use the tree menu to navigate groups of related pages|
SAMA5D3 (ARM Cortex-A5) RTOS Demo
Including FreeRTOS+CLI – Using the IAR Embedded Compiler
IntroductionThis page documents a FreeRTOS demo application for the Atmel ATSAMA5D3 embedded processor, which has an ARM Cortex-A5 core and an Atmel Advanced Interrupt Controller (AIC). The pre-configured RTOS example project builds uses the IAR Embedded Workbench for ARM compiler and IDE, and targets the SAMA5D3 Xplained evaluation board.
IMPORTANT! Notes on using the FreeRTOS Atmel SAMA5 demo projectPlease read all the following points before using this RTOS port.
- Source Code Organisation
- The Demo Application Functionality
- Build Instructions
- RTOS Configuration and Usage Details
Source Code OrganisationThe FreeRTOS zip file contains source code for all the RTOS ports and all the RTOS demo applications. Only a small subset of these files are required by the Atmel SAMA5 ARM Cortex-A5 RTOS demo application. The Source Code Organization page describes the structure of the FreeRTOS zip file download, and provides information on creating a new RTOS project.
The IAR Embedded Workbench project file is located in the FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR directory.
The IAR project includes files that are contained in the /FreeRTOS-Plus directory, so the project will not build if the /FreeRTOS-Plus directory has been deleted or moved from its default location.
The Atmel SAMA5 ARM Cortex-A5 Demo Application
Hardware and software set upNo specific hardware configuration is required.
FunctionalityThe constant mainCREATE_SIMPLE_BLINKY_DEMO_ONLY, which is defined at the top of main.c, is used to switch between a very basic ‘blinky’ demo, and a comprehensive test and demo application.
Functionality with mainCREATE_SIMPLE_BLINKY_DEMO_ONLY set to 1If mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 then main() will call main_blinky().
main_blinky() creates a very simple demo that includes two tasks and one queue. The first task (the queue send task) uses the queue to repeatedly send the number 100 to the second task (the queue receive task). The receiving task toggles an LED each time it receives the message. The message is sent every 200 milliseconds, so the LED toggles every 200 milliseconds.
Functionality with mainCREATE_SIMPLE_BLINKY_DEMO_ONLY set to 0
main_full() creates a comprehensive test and demo application that demonstrates:
- The FreeRTOS+CLI command line interface. [Note the FreeRTOS+CLI license is different from the FreeRTOS kernel license]
- The Atmel USB device CDC driver.
- Software timers.
The SAM5 ARM Cortex-A5 Xplained evaluation board is powered through its USB device port, so the USB CDC device will enumerate as soon as the RTOS demo application starts executing, and will re-enumerate each time the RTOS demo application is restarted. This means a terminal program cannot be connected to the virtual COM port until the RTOS application is running, and must be disconnected from and then reconnected to the virtual COM port each time the RTOS demo application is stopped and re-started.
Most of the other tasks created by the full demo are from the set of standard demo tasks. These are used by all the RTOS demo applications for all compilers and all architectures. They have no specific functionality, but do demonstrate the RTOS API being used and test the RTOS kernel port.
Finally, a ‘check’ task is created. The check task periodically queries the standard RTOS demo tasks to ensure the standard demo tasks are still executing and functioning as expected. The check task also toggles an LED to give a visual indication of the system status. If the check task has not detected any potential errors then it will toggle the LED every three seconds. If the check task has detected a potential error then it will toggle the LED every 200ms.
NOTE: Some of the standard demo tasks check their own timing, and the timing checks will fail (resulting in an error being reported to the ‘check’ task) if excessive time is spent processing USB interrupts.
Building and executing the demo applicationNote that the RTOS demo project references common files from the /FreeRTOS-Plus and /FreeRTOS/Demo/Common directories, so the project will not compile if /FreeRTOS-Plus has been deleted or moved from its default location.
- Open FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/RTOSDemo.eww from within the Embedded Workbench (EWARM) IDE.
- Open main.c and set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY to generate either the simple blinky demo or the full test and demo application as required.
- Select “Build All” from the IDE’s “Project” menu, or press F7, to build the demo. The demo should build without the FreeRTOS related files generating any errors or warnings.
- Ensure the target hardware is connected to the host computer using the target’s USB connector.
- Select “Download and Debug” from the IDE’s “Project” window to download the built executable to the ARM Cortex-A5 RAM and start a debug session.
FreeRTOS ARM Cortex-A port specific configurationAttention please!: Some ARM Cortex-A processors incorporate ARM’s own Generic Interrupt Controller (GIC), while others, such as the SAMA5D3, incorporate proprietary interrupt controllers. Separate web pages are provided to give instructions on using the RTOS in both scenarios. In this case please refer to the web page that provides instruction on using the RTOS on ARM Cortex-A embedded processors that do not incorporate ARM’s Generic Interrupt Controller.
Configuration items specific to this demo are contained in the FreeRTOS/Demo/CORTEX_A5_SAMA5D3x_Xplained_IAR/FreeRTOSConfig.h header file.