The Simplicity Studio project for the Silicon Labs EFM32 Giant Gecko STK3700 demo application is located in the FreeRTOS/Demo/CORTEX_EFM32_Giant_Gecko_Simplicity_Studio directory. The Simplicity Studio project for the Silicon Labs EFM32 Pearl Gecko SLSTK3401A demo application is located in the FreeRTOS/Demo/CORTEX_EFM32_Pearl_Gecko_Simplicity_Studio directory. These are the directories that should be selected when importing the projects into a Simplicity Studio Eclipse workspace.
The EFM32 Gecko RTOS Demo ApplicationsHardware set upThe demo uses the LED built onto the EFM32 Gecko Starter Kit Boards, so no hardware setup is required.
FunctionalityThe RTOS demo projects can be configured to build either a simple lower power tickless project, or a comprehensive test and demo project. The constant configCREATE_LOW_POWER_DEMO, which is defined at the top of FreeRTOSConfig.h, is used to switch between the two. The following table describes the project that will be built for all valid configCREATE_LOW_POWER_DEMO values for both the Pearl and Giant Gecko projects.
Functionality when ( configCREATE_LOW_POWER_DEMO == 0 )If configCREATE_LOW_POWER_DEMO is set to 0 then main() will call main_full(). main_full() is implemented in the main_full.c C source file.main_full() creates a comprehensive test and demo application that demonstrates:
Most of the tasks created by the comprehensive demo are from the set of standard demo tasks. Standard demo tasks are used by all RTOS port demo applications. They have no specific functionality, and are created just to demonstrate how to use the FreeRTOS API, and test the RTOS port. In addition to the standard demo tasks the comprehensive demo creates "RegTest" tasks, and a 'Check' task:
Functionality when ( configCREATE_LOW_POWER_DEMO != 0 )If configCREATE_LOW_POWER_DEMO is set to 1 or 2 then main() will call main_low_power(). main_low_power() is implemented in the main_low_power.c C source file. See the table above for valid configCREATE_LOW_POWER_DEMO settings for both the EFM32 Giant and Pearl Gecko demos respectively.main_low_power() creates a queue, a "queue send" task, and a "queue receive" task. It then starts the scheduler.
Building and executing the demo applicationNote: The Simplicity Studio Eclipse project uses virtual and linked paths to reference files from outside of the project directory, and might not build if the directory structure has been changed.
RTOS Configuration and Usage DetailsARM Cortex-M3 and M4F FreeRTOS port specific configurationConfiguration items specific to this demo are contained in FreeRTOS/Demo/CORTEX_EFM32_[part]_Gecko_Simplicity_Studio/FreeRTOSConfig.h. The constants defined in this file can be edited to suit your application. In particular -
Attention please!: See the page dedicated to setting interrupt priorities on ARM Cortex-M devices. Remember that ARM Cortex-M cores use numerically low priority numbers to represent HIGH priority interrupts. This can seem counter-intuitive and is easy to forget! If you wish to assign an interrupt a low priority do NOT assign it a priority of 0 (or other low numeric value) as this will result in the interrupt actually having the highest priority in the system - and therefore potentially make your system crash if this priority is above configMAX_SYSCALL_INTERRUPT_PRIORITY. Also, do not leave interrupt priorities unassigned, as by default they will have a priority of 0 and therefore the highest priority possible. The lowest priority on a ARM Cortex-M core is in fact 255 - however different ARM Cortex-M microcontroller manufacturers implement a different number of priority bits and supply library functions that expect priorities to be specified in different ways. For example, on Silicon Labs ARM Cortex-M microcontrollers, the lowest priority you can specify is in fact 7 - this is defined by the constant configLIBRARY_LOWEST_INTERRUPT_PRIORITY in FreeRTOSConfig.h. The highest priority that can be assigned is always zero. 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.
Interrupt service routinesUnlike many FreeRTOS ports, interrupt service routines that cause a context switch have no special requirements, and can be written as per the compiler documentation. The macro portYIELD_FROM_ISR() can be used to request a context switch from within an interrupt service routine.Note that portYIELD_FROM_ISR() will leave interrupts enabled. The following source code snippet is provided as an example. The interrupt uses a direct to task notification to synchronise with a task (not shown), and calls portYIELD_FROM_ISR() to ensure the interrupt returns directly to the task if the task has an equal or higher priority than the interrupted task. void Dummy_IRQHandler(void) { long lHigherPriorityTaskWoken = pdFALSE; /* Clear the interrupt if necessary. */ Dummy_ClearITPendingBit(); /* This interrupt does nothing more than demonstrate how to synchronise a task with an interrupt. A direct to task notification is used for this purpose. Note lHigherPriorityTaskWoken is initialised to zero. */ vTaskNotifyGiveFromISR( xTaskHandle, &lHigherPriorityTaskWoken ); /* If the task referenced by the xTaskHandle handle was in the Blocked state waiting for a notification then calling vTaskNotifyGiveFromISR() will have moved the task into the Ready state. If the task was moved into the Ready state, and the task's priority is higher than the priority of the currently executing task (the task this interrupt interrupted), then lHigherPriorityTaskWoken will have been set to pdTRUE internally within vTaskNotifyFromISR(). Passing pdTRUE into the portYIELD_FROM_ISR() macro will result in a context switch being pended to ensure this interrupt returns directly to the unblocked, higher priority, task. Passing pdFALSE into portYIELD_FROM_ISR() has no effect. */ portYIELD_FROM_ISR( lHigherPriorityTaskWoken ); } Only FreeRTOS API functions that end in "FromISR" can be called from an interrupt service routine - and then only if the priority of the interrupt is less than or equal to that set by the configMAX_SYSCALL_INTERRUPT_PRIORITY configuration constant (or configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY).
Resources used by FreeRTOSWhen configCREATE_LOW_POWER_DEMO is set to 0 the standard FreeRTOS Cortex-M port is used, which requires exclusive use of the SysTick and PendSV interrupts. SVC number #0 is also used.When configCREATE_LOW_POWER_DEMO is set to 1 exclusive access to the RTC, RTCC or BURTC peripheral is required - depending on the configuration. Memory allocationSource/Portable/MemMang/heap_4.c is included in the ARM Cortex-M demo application project to provide the memory allocation required by the RTOS kernel. The comprehensive demo also demonstrates RTOS objects being created using statically allocated, rather than dynamically allocated, memory. Please refer to the Memory Management section of the API documentation for full information.MiscellaneousNote that vPortEndScheduler() has not been implemented.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.
|
Latest News
NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS. Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019 Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed. View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS. Careers
FreeRTOS and other embedded software careers at AWS. FreeRTOS Partners
|