From Silicon Labs: "Micrium OS Examples: 57 Hidden Gems You May Not Know About"

Dec 14, 2018
 

 

Background

The Micrium OS Examples in Simplicity Studio are very easy to access: You connect your Starter Kit and Simplicity Studio will display the list of examples as shown below:

Figure 1. Micrium OS Examples in Simplicity Studio

 

For more information on how to access the Micrium OS Examples from Simplicity Studio you can see this document:

https://www.silabs.com/documents/public/training/wireless/micrium-os-examples.pdf

 

 

Revealing the 57 Hidden Gems

In this blog, I’m going to show you how to access the additional Micrium OS Examples that are not available from Simplicity Studio's Launcher Perspective.

There are 57 examples that demonstrate how to initialize the Micrium OS modules to perform the most basic operations:

Micrium OS Module Example
CANopen CANopen Module Initialization Example
CANopen Node Start Example
CANopen Object Dictionary Read/Write Example
File System File System Module Initialization Example
File Read/Write Example
File Read/Write with Posix API Example
File Multi-Descriptors Example
Entry Path Example
Block Device Read/Write Example
Media Polling Example
Network FTP Client Send Data from a buffer to a file on an FTP Server
Upload a file to an FTP Server
Receive a file into a buffer
Download a file from an FTP server
HTTP Client HTTP Client Initialization Example
HTTP Client GET Request Examples
HTTP Client POST Request Examples
HTTP Client PUT Request Examples
HTTP Client Persistent Connection Examples
HTTP Client Multi-connection Examples
HTTP Server HTTP Server Initialization Example
Simple Server That Uses No File System
Basic Server That Uses the HTTP Static File System
Basic Server That Uses Micrium OS File System
Server That Handles REST Requests
Server That Handles Webpages, REST Requests and Authentication Support
Basic Secure Server That Uses SSL-TLS and the HTTP Static File System
IPerf IPerf Initialization Example
MQTT Client MQTT Client Initialization Example
MQTT Client Connect Example
MQTT Client Publish Example
MQTT Client Subscribe Example
MQTT Client Echo Example
Network Core Network Module(s) Initialization Example
Network Core Initialization Example
Start Network Interface(s) Example
SMTP Client SMTP Client Initialization Example
SMTP Client Send Email Example
SNTP Client SNTP Client Initialization Example
Basic SNTP Current Time Retrieve
Telnet Server Telnet Server Initialization Example
Telnet Server Instance Example
TFTP Client Download and Upload a File to a TFTP Server
USB Device Audio Class USB Device Audio Class Loopback Example
CDC ACM Class USB Device CDC ACM Class Terminal Example
CDC EEM Class USB Device CDC EEM Class Example
USB Device Core USB Device Core Initialization Example
HID Class USB Device HID Class Mouse Example
MSC Class USB Device MSC Class Ramdisk LUN Example
USB Device MSC Class Ramdisk Shared Example
Vendor Class USB Device Vendor Class Loopback Example
USB Host Android Accessory Class USB Host Android Accessory Class Example
CDC ACM Class USB Host CDC ACM Class Example
USB Host Core USB Host Module Simple Initialization Example
Simple Device Port Operation Example
MSC Class USB Host MSC Class Example
USB-to-Serial Class USB Host USB-to-Serial Class Example

Table 1. The Hidden Micrium OS Examples

 

 

How to run the hidden Micrium OS Examples

The process of including, configuring and initializing the examples is the same for all the examples and can be summarized as follows:

Start off with one of the examples available through Simplicity Studio by connecting your Kit and selecting an Example from the list as illustrated in Figure 1.

If the example project does not have the Micrium OS module files, then you need to include them by inserting in your project the folder located at ${StudioSdkPath}/platform/micrium_os/[module]/includeand ${StudioSdkPath}/platform/micrium_os/[module]/source/[module] and configuring your compiler's include paths with the new paths.

Locate the header file rtos_description.h and insert the macro necessary to enable the module. For the full list of macros see this document.

Make sure you have in your project all the configuration files located in STUDIO_SDK_LOC\platform\micrium_os\cfg

Explore the examples listed in Table 1, select the one that you want and follow the corresponding hyperlink.

       The hyperlink will take you to the example's documentation which provides four things:

  • Description: Brief description of the example
  • Configuration: The name of the #define that needs to be defined in ex_description.h
  • Location: The location of the files that need to be included
  • API: The API that needs to be called from your application to start the example

Locate the header file ex_description.h and define the corresponding macro if necessary as described in the example's documentation section: Configuration.

Include in your Simplicity Studio project the required files as listed in the example's documentation section: Location. In this step you can either create a link to the original folder or make a copy of the files and place them in your own workspace directory.

Configure your compiler's include paths with the new paths where the header files are located.

Insert a #include in your application, of the header file where the API to start the example is declared and call the API from your application to get the example started as described in the example's documentation section: API.

 

 

Example

To illustrate the process, I'm going to provide an example where one is interested in running an HTTP server:

Connect the SLSTK3701A and select the example SLSTK3701A_micriumos_net from Simplicity Studio.

Inspect which modules are included in the project by looking at the folder net in the Project Explorer. There you will notice that the module HTTP Server is missing.

Include the HTTP Server module by creating a new Linked Folder located at STUDIO_SDK_LOC\platform\micrium_os\net\source\http\server

Open the new folder Properties and either include or exclude the folder from compilation as necessary from the section C/C++ Build.

Open the Project Properties and insert the location to the new header files ${StudioSdkPath}/app/micrium_os_example/net/http/server in the section C/C++ General -> Paths and Symbols

Locate and open the header file rtos_description.h and insert the following line to enable the new HTTP Server Module: #define  RTOS_MODULE_NET_HTTP_SERVER_AVAIL

Copy the configuration files from STUDIO_SDK_LOC\platform\micrium_os\cfg to your own workspace directory and make sure the compiler is aware of this include path.

Look at Table 1, locate the Example Basic Server That Uses the HTTP Static File System and explore the documentation.

Open the header file ex_description.h and insert the following line to enable the example: #define  EX_HTTP_SERVER_INIT_AVAIL

Create a new Folder named Examples and then create a Linked Folder in it that points to STUDIO_SDK_LOC\app\micrium_os_example\net\http\server

Open the Project Properties and insert the path ${StudioSdkPath}/app/micrium_os_example/net in the section C/C++ General -> Paths and Symbols

Open the file ex_main.c and insert the following line at the top: #include  "http/server/ex_http_server.h"

From the same file ex_main.c, locate the calls to the functions Ex_NetworkInit() and Ex_Net_CoreStartIF() and insert right after them, a call the following API to get the example started: Ex_HTTP_Server_InstanceCreateStaticFS();

 

Source: https://www.silabs.com/community/blog.entry.html/2018/12/05/micrium_os_examples-ezP3 

 

Looking to integrate Silicon Labs products with your design? Our Applications Engineers offer free design and technical help for your latest designs. Contact us today!

 


 

Symmetry Electronics Logo

 

Why partner with Symmetry Electronics? Symmetry's technical staff is specially trained by our suppliers to provide a comprehensive level of technical support. Our in-house Applications Engineers provide free design services to help customers early in the design cycle, providing solutions to save them time, money and frustration. Contact Symmetry for more information.



Subscribe

Sign up to get tech news, product updates and store promos from Symmetry Electronics.

Subscribe

Blog Archive

  2019
  2018
  2017
  2016
  2015
  2014
  2013
  2012
  2011
  2010
  2009

Previously Viewed Products