|Hint: Use the tree menu to navigate groups of related pages|
SAMA5D4 (ARM Cortex-A5) RTOS Demo
Including FreeRTOS+CLI, and Using the IAR Embedded Compiler
IntroductionThis page documents the FreeRTOS demo for the Atmel ATSAMA5D4 embedded processor, which has an ARM Cortex-A5 core, and uses the Atmel Advanced Interrupt Controller (AIC). A pre-configured RTOS example project that targets the SAMA5D4-EK evaluation hardware is provided for the IAR Embedded Workbench for ARM embedded development tools.
IMPORTANT! Notes on using the ARM Cortex-A5 RTOS 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
- The FAQ My application does not run, what could be wrong?
- Instruction on using the RTOS on ARM Cortex-A processors that don’t use a Generic Interrupt Controller (GIC).
Source Code OrganisationThe official FreeRTOS zip file download includes source files for all the RTOS ports, and all the RTOS demo projects. Only a small subset of the files are required by this Atmel SAMA5D4 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 used to build this demo is located in the FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR directory. The project includes source files from the /FreeRTOS-Plus/Source directory, so will not build if the /FreeRTOS-Plus directory has been moved from its default location, or deleted.
The Atmel SAMA5D4 ARM Cortex-A5 Demo Application
Hardware and software set upNo hardware configuration specific to this demo is required.
FunctionalityThe constant mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is used to switch between a basic ‘blinky’ style demo, and a larger test and demo application. mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is defined at the top of main.c.
Functionality when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1When mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 1 main() calls main_blinky().
main_blinky() creates a very basic demo that creates just two tasks and one queue. The first task (the queue send task) repeatedly sends the number 100 to the second task (the queue receive task) over the queue. The queue receive task toggles an LED each time it receives the data. The data is sent to the queue every 200 milliseconds, so the queue receive task will toggle the LED every 200 milliseconds.
Functionality when mainCREATE_SIMPLE_BLINKY_DEMO_ONLY is set to 0
main_full() creates a comprehensive demo and test application that demonstrates:
- The FreeRTOS+CLI command line interface and interpreter. [Note the FreeRTOS+CLI license is different from the FreeRTOS kernel license]
- Atmel’s own USB CDC driver – which provides the input and output for the CLI.
- Software timers.
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. That means a terminal program cannot be connected to the virtual COM port until the RTOS application is actually running, and must be disconnected from, and then reconnected to, the CDC virtual COM port each time the RTOS demo is re-started. If the dumb terminal is not disconnected from the CDC port before the RTOS demo is stopped or restarted then it might be necessary to shut down and restart the dumb terminal program before another connection can be created.
Many of the other tasks created in the full demo are from the set of standard demo tasks. The standard demo tasks are used by the RTOS demos applications for every RTOS port, and have no specific functionality. Their purpose is to demonstrate the RTOS API functions being used, and test the RTOS architecture port.
The demo also creates a ‘check’ task. The check task periodically inspects the status of the standard RTOS demo tasks to ensure they are functioning as expected. The check task toggles an LED to give a visual indication of the system status; If the LED is toggling every 3 seconds then all the tasks are executing as expected. If the LED is toggling every 200ms then the check task has detected a possible error in one or more of the demo tasks..
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 RTOS demo applicationNote the RTOS demo project references common files from the /FreeRTOS-Plus and /FreeRTOS/Demo/Common directories and will not compile if either of these directories have been deleted or moved from their default locations.
- Open FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/RTOSDemo.eww in the IAR Embedded Workbench (EWARM) IDE.
- Set mainCREATE_SIMPLE_BLINKY_DEMO_ONLY at the top of main.c to generate either the simple blinky demo, or the full test and demo application, as described above.
- Select “Build All” from the IDE’s “Project” menu, or press F7, to build the RTOS demo.
- Ensure the target hardware is powered, and connected to the host computer using both the target’s J-Link USB connection for the debugger, and (if running the full demo with CLI), the target’s USB-A connection.
- Select “Download and Debug” from the IDE’s “Project” window. The built executable with be downloaded to the ARM Cortex-A5 RAM before a debug session is started.
FreeRTOS ARM Cortex-A port specific configurationAttention please!: The SAMA5D4 uses a proprietary Atmel interrupt controller, rather than ARM’s own Generic Interrupt Controller (GIC). Separate web pages provide instruction on using the RTOS in both scenarios. When using the SAMA5D4 please refer to the web page that provides instruction on using the RTOS on ARM Cortex-A embedded processors that do not incorporate an ARM GIC.
Configuration items specific to this demo are contained in the FreeRTOS/Demo/CORTEX_A5_SAMA5D4x_EK_IAR/FreeRTOSConfig.h header file.