|Latest News Items: FreeRTOS V8 released - FAT file system released - Tick suppression demo'ed SAM4L, RX100 & STM32L|
AT91SAM3U ARM Cortex-M3 FreeRTOS demo
|FreeRTOS is now an integral part of the Atmel ASF driver library for SAM. Click to view the application note.|
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.
My application does not run, what could be wrong?
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 uses the LEDs and LCD built onto the prototyping board so no other hardware setup is required.
The following tasks and tests are created in addition to the standard demo tasks:
The LCD task is a 'gatekeeper' task. It is the only task that is permitted to access the LCD directly. Other tasks or interrupts wishing to write a message to the LCD send the message on a queue to the LCD task instead of accessing the LCD themselves. The LCD task just blocks on the queue waiting for messages - waking and displaying the messages as they arrive.
This only executes every five seconds. Its main function is to check that all the standard demo tasks are still operational. Should any unexpected behaviour within a demo task be discovered the 'check' function will write an error to the LCD (via the LCD task). If all the demo tasks are executing with their expected behaviour then the check task writes PASS to the LCD (again via the LCD task), as described above. This mechanism can be tested by removing the loopback connector from UART1, and in so doing deliberately generating an error in the COMTest tasks.
The check function executes within the context of an interrupt service routine so is a good example of how using a gatekeeper task to control the LCD permits even interrupts to output LCD messages.
When executing correctly the demo application will behave as follows:
This sets the frequency of the RTOS tick. The supplied value of 1000Hz is useful for testing the RTOS kernel functionality but is faster than most applications require. Lowering this value will improve efficiency.
See the RTOS kernel configuration documentation for full information on these configuration constants.
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.
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.