The demo application presented on this page is pre-configured to execute on the official SAM3U-EK evaluation kit from Atmel. The demo uses the FreeRTOS IAR ARM Cortex-M3 port and can be compiled and debugged directly from the IAR Embedded Workbench for ARM.
Note: If this project fails to build then it is likely the version of IAR Embedded Workbench being used is too old. If this is the case, then it is also likely that the project file has been (silently) corrupted and will need to be restored to its original state before it can be built even with an updated IAR version.
The FreeRTOS ARM Cortex-M3 port includes a full interrupt nesting model. Interrupt priorities must be set in accordance with the instructions on the Customisation page for correct operation.
Atmel also provide a comprehensive demo project for their SAM3S-EK evaluation kit that uses the FreeRTOS port. This includes GUI, QTouch, FAT file system and USB functionality.
IMPORTANT! Notes on using the Atmel ARM Cortex-M3 DemoPlease read all the following points before using this RTOS port.
My application does not run, what could be wrong?
Source Code OrganisationThe IAR workspace file for the SAM3 FreeRTOS demo is called RTOSDemo.eww and is located in the FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR directory.
The FreeRTOS zip file download contains the files for all the ports and demo application projects. It therefore contains many more files than used by this demo. See the Source Code Organization section for a description of the downloaded files and information on creating a new project.
The Demo Application
Demo application hardware setupThe demo application includes an interrupt driven UART test where one task transmits characters that are then received by another task. For correct operation of this functionality a loopback connector must be fitted to the UART1 9 way connector on the evaluation board (pins 2 and 3 must be connected together on the 9 way connector - normally a paper clip is sufficient for this purpose).
The demo application uses the LEDs and LCD built onto the prototyping board so no other hardware setup is required.
Building and executing the demo application
FunctionalityThe demo application creates 33 tasks prior to starting the RTOS scheduler. These tasks consist predominantly of the standard demo application tasks (see the demo application section for details of the individual tasks). Their only purpose is to test the RTOS kernel port and provide a demonstration of how to use the various API functions.
The following tasks and tests are created in addition to the standard demo tasks:
When executing correctly the demo application will behave as follows:
RTOS port specific configurationConfiguration items specific to this demo are contained in FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/FreeRTOSConfig.h. The constants defined in this file can be edited to suit your application. In particular -
The lowest priority on a ARM Cortex-M3 core is in fact 255 - however different ARM Cortex-M3 vendors implement a different number of priority bits and supply library functions that expect priorities to be specified in different ways. Use the supplied examples as a reference.
Each port #defines 'BaseType_t' to equal the most efficient data type for that processor. This port defines BaseType_t to be of type long.
Note that vPortEndScheduler() has not been implemented.
Interrupt service routinesIn the demo application the vector table remains in flash.
Unlike most ports, interrupt service routines that cause a context switch have no special requirements and can be written as per the compiler documentation. The macro portEND_SWITCHING_ISR() can be used to request a context switch from within an ISR. An example ISR called vSerialISR() is provided in FreeRTOS/Demo/CORTEX_AT91SAM3U256_IAR/serial/serial.c, this should be used as a reference example.
Compiler optionsAs 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 allocationSource/Portable/MemMang/heap_2.c is included in the ARM Cortex-M3 demo application project to provide the memory allocation required by the real time RTOS kernel. Please refer to the Memory Management section of the API documentation for full information.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.