From Silicon Labs: "Micrium OS Examples: 57 Hidden Gems You May Not Know About"
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:
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:
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