Silicon Labs UG235.05 User's Guide

Silicon Labs UG235.05 User's Guide
UG235.05: Using Micrium OS (RTOS) with
Silicon Labs Connect
This chapter of the Connect User’s Guide describes how to run
the Silicon Labs Connect stack on top of the Micrium OS kernel, a
full-featured real-time operating system (RTOS) for embedded
systems. The Connect stack is delivered as part of the Silicon
Labs Flex SDK. The Connect User’s Guide assumes that you
have already installed the Simplicity Studio development environment and the Flex SDK, and that you are familiar with the basics
of configuring, compiling, and flashing Connect-based applications. Refer to UG235.01: Developing Code with Silicon Labs
Connect for an overview of the chapters in the Connect User’s
Guide.
KEY POINTS
• Introduces Micrium OS support.
• Discusses the Micrium RTOS plugin
features.
• Describes the Virtual NCP architecture
details.
The Connect User’s Guide is a series of documents that provides in-depth information
for developers who are using the Silicon Labs Connect Stack for their application development. If you are new to Connect and the Flex SDK, see QSG138: Getting Started with
the Silicon Labs Flex Software Development Kit for the Wireless Gecko (EFR32™) Portfolio.
Connect is supported for EFR32FG, EFR32MG1x, and EFR32BG1x.
silabs.com | Building a more connected world.
Rev. 0.2
UG235.05: Using Micrium OS (RTOS) with Silicon Labs Connect
Introduction
1. Introduction
The Silicon Labs Connect support for Micrium is integrated into the Silicon Labs Application Builder (AppBuilder) utility in Simplicity Studio. To enable this support requires very little effort on the part of application developers. For documentation on the Micrium OS, see
http://doc.micrium.com.
silabs.com | Building a more connected world.
Rev. 0.2 | 2
UG235.05: Using Micrium OS (RTOS) with Silicon Labs Connect
Getting Started
2. Getting Started
Any Connect application can be easily turned into an application running on Micrium OS by simply enabling the Micrium RTOS plugin
as shown in the following figure.
Figure 2.1. Micrium RTOS Plugin
The Micrium RTOS plugin has the following plugin options that allow application developers to customize certain settings:
• CPU usage tracking: If enabled, the Application Framework compiles in some additional code that allows certain debug tools to
have extended debug information from the OS.
• Connect Task call stack size: The size in bytes of the call stack used by the stack task.
• Application Framework Task call stack size: The size in bytes of the call stack used by the Application Framework task.
• Poll CLI: If enabled, the application framework task (which is responsible for processing the incoming serial CLI commands) is allowed to yield only for small periods of time. This results in a more responsive CLI user experience.
• Max callback queue size: Defines the maximum supported number of simultaneous callback messages from the stack task to the
application tasks.
• Application Task (N): Application developers can also optionally enable up to three custom application tasks. For each of these
tasks, application developers can specify the call stack size and the priority.
Note: Although the allowed priority range is nominally 7-14, each custom application task must be assigned a lower priority than
both the stack task and the Application Framework task.
silabs.com | Building a more connected world.
Rev. 0.2 | 3
UG235.05: Using Micrium OS (RTOS) with Silicon Labs Connect
Virtual NCP Architecture Details
3. Virtual NCP Architecture Details
With the Micrium RTOS plugin enabled, the Connect stack runs within a Micrium Task while the Application Framework code runs within a separate Micrium Task. This two-task model is also known as the virtual Network Co-Processor architecture (vNCP) because the
processing and communication between the two tasks is the same as for the host/NCP architecture. The difference is that instead of
running on separate processors and passing messages to each other through the serial port, the application and NCP run on the same
processor but in different Micrium tasks. Message passing is handled using Micrium message queues or protected global data structures and is transparent to the application.
By enabling the Micrium RTOS plugin, the Micrium kernel code is added to the project. The plugin code automatically starts all the OS
tasks used in the configuration. At a minimum, two tasks are created:
• A Connect stack task (highest priority task) responsible for running the Connect stack. This task is responsible for the following
operations:
• Periodically tick the Connect stack by invoking the emberTick() API.
• Process incoming IPC (inter-process communication) commands from application tasks (if any) and send out a response.
• Send callback IPC commands (if any) to the application tasks.
• Attempt whenever possible to suspend itself to allow lower priority application tasks to run.
• An Application Framework task responsible for running the Application Framework code. This task is responsible for the following
operations:
• Periodically tick the application framework plugins (for those that implement a tick callback). This includes, for instance, the processing of incoming CLI commands.
• Run application events.
• Process incoming callback IPC commands (if any) from the stack task.
• Attempt whenever possible to suspend itself to allow lower priority custom application tasks to run.
The Micrium RTOS plugin also supports the creation of up to three custom application tasks. The custom application tasks must have a
lower priority than both the Connect stack task and the Application Framework task. Each of these custom application tasks is started
automatically, and should implement the following two callbacks:
• emberAfPluginMicriumRtosAppTaskNInitCallback(void) – This callback is invoked at initialization time to allow the Nth custom
application task to execute some initialization code.
• emberAfPluginMicriumRtosAppTaskNMainLoopCallback(void *p_arg) – This callback shall contain the Nth task main loop.
Custom application tasks can call stack APIs freely because the underlying IPC protocol ensures that all stack APIs are thread-safe.
Note: As of Flex SDK 2.4, Connect does not support writing tokens from the Application Framework task. Silicon Labs intends to restore this functionality in an upcoming release. For more information on tokens, see UG235.09: Using Other Services with Silicon Labs
Connect.
silabs.com | Building a more connected world.
Rev. 0.2 | 4
Smart.
Connected.
Energy-Friendly.
Products
Quality
Support and Community
www.silabs.com/products
www.silabs.com/quality
community.silabs.com
Disclaimer
Silicon Labs intends to provide customers with the latest, accurate, and in-depth documentation of all peripherals and modules available for system and software implementers using or
intending to use the Silicon Labs products. Characterization data, available modules and peripherals, memory sizes and memory addresses refer to each specific device, and "Typical"
parameters provided can and do vary in different applications. Application examples described herein are for illustrative purposes only. Silicon Labs reserves the right to make changes without
further notice to the product information, specifications, and descriptions herein, and does not give warranties as to the accuracy or completeness of the included information. Without prior
notification, Silicon Labs may update product firmware during the manufacturing process for security or reliability reasons. Such changes will not alter the specifications or the performance
of the product. Silicon Labs shall have no liability for the consequences of use of the information supplied in this document. This document does not imply or expressly grant any license
to design or fabricate any integrated circuits. The products are not designed or authorized to be used within any FDA Class III devices, applications for which FDA premarket approval is
required, or Life Support Systems without the specific written consent of Silicon Labs. A "Life Support System" is any product or system intended to support or sustain life and/or health,
which, if it fails, can be reasonably expected to result in significant personal injury or death. Silicon Labs products are not designed or authorized for military applications. Silicon Labs
products shall under no circumstances be used in weapons of mass destruction including (but not limited to) nuclear, biological or chemical weapons, or missiles capable of delivering
such weapons. Silicon Labs disclaims all express and implied warranties and shall not be responsible or liable for any injuries or damages related to use of a Silicon Labs product in such
unauthorized applications.
Trademark Information
Silicon Laboratories Inc.®, Silicon Laboratories®, Silicon Labs®, SiLabs® and the Silicon Labs logo®, Bluegiga®, Bluegiga Logo®, ClockBuilder®, CMEMS®, DSPLL®, EFM®, EFM32®,
EFR, Ember®, Energy Micro, Energy Micro logo and combinations thereof, "the world’s most energy friendly microcontrollers", Ember®, EZLink®, EZRadio®, EZRadioPRO®, Gecko®,
Gecko OS, Gecko OS Studio, ISOmodem®, Precision32®, ProSLIC®, Simplicity Studio®, SiPHY®, Telegesis, the Telegesis Logo®, USBXpress® , Zentri, the Zentri logo and Zentri DMS, ZWave®, and others are trademarks or registered trademarks of Silicon Labs. ARM, CORTEX, Cortex-M3 and THUMB are trademarks or registered trademarks of ARM Holdings. Keil is a
registered trademark of ARM Limited. Wi-Fi is a registered trademark of the Wi-Fi Alliance. All other products or brand names mentioned herein are trademarks of their respective holders.
Silicon Laboratories Inc.
400 West Cesar Chavez
Austin, TX 78701
USA
http://www.silabs.com
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement