This blog should serve as a guide to adding Micrium OS File System(NOR device) on a Flex Gecko and get at least the FS core initialized, perform low/high-level if the Storage device requires it and execute a simple read/write application.
I will now share with you my experience while going through this exercise.
Getting Started
I decided to perform a clean installation of Simplicity Studio in order to avoid conflicts inflicted by software updates over time. After installing the tool, before even attempting to add anything, I first had to make sure that I had the necessary SDKs. Here's what I installed:
Gecko SDK Suite - 2.5.3
Micrium OS - 5.6.0
Flex SDK - 2.5.3.0
I then mounted a Flex Gecko, EFR32FG13(BRD4255A) in my case, onto a Wireless Started Kit Mainboard (BRD4001A). After that, I connected it to the PC using the provided USB cable.
Simplicity Studio recognized a Flex Gecko connected to a WSTK and displayed the link to examples from the Flex SDK (see Figure 1).
Figure 1 - Initial Setup Validation
Loading a Basic Flex SDK Example
As a starting point, I decided to go with the "Connect(Soc): Sensor" example from the Flex SDK.
You can find this by expanding the list of projects under the "Connect Examples" link:
Figure 2 - Flex SDK Examples Link
You will then be presented with sensor.isc opened where you can configure Sensor. Since we are adding Micrium OS to the example, let's click on the "Plugins" tab and select the "Micrium RTOS" check box and "Application Task (1)" as shown on Figure 3. Make sure to press 'CRTL + S' to save the modifications and then clicked on "Generate".
Figure 3 - Sensor Project Configuration
Click the 'OK' button on the Generation validation pop-up window.
Figure 4 - Generation validation
At this point, you should now be set with a Flex Gecko example that builds and runs. However, I did find that the default project settings have compiler optimization set to "Optimize for size (-Os)" which will eventually make debugging the project rather difficult. Therefore, I switched optimizations to "None (-O0)".
Figure 5 - Compiler Optimizations
Installing Micrium OS File System
Assuming your credentials have the right access permissions to install Micrium OS File System, you will need to click on the 'Help->Update Software' menu. The "Installation Manager" window should pop-up. Please select the "Package Manager" option as shown on Figure 6. If you are not sure your credentials have the proper access to Micrium OS File System, please contact our sales department.
Figure 6 - Installation Manager
On the "Package Manager" window select the 'SDKs' tab and Micrium OS as Categories, then click on the 'Install' button Figure 7. Close the window once the installation is completed.
Figure 7 - Package Manager
Adding Micrium OS File System to the Workspace
The BRD4255A board has a 8-Mbit Macronix MX25R8035F SPI flash; therefore, our workspace will have all the Micrium OS File System files required to run the NOR(MX25R8035F) device. Since we already generated a Flex Gecko example that builds and runs, let's go ahead and start adding the Micrium OS File System source files into the workspace. First, locate the Micrium OS directory, it should be in:
Right-click on the 'sensor' workspace and select 'Import->MCU project'. Once the "Import Project" window pops-up, please select the 'More Import Options" as shown on Figure 8.
Figure 8 - Import Project
During the next window, select the "General->File System" import source and click next. At this point, we will be adding all the necessary Micrium OS File System files to the workspace.
Figure 9 - BSP file for the NOR-SPI device.
Figure 10 Micrium OS common files
Figure 11 Micrium OS drivers for NOR-SPI
Figure 12 Micrium OS File System
Adding Micrium OS FS Examples to the Workspace
Locate the Micrium OS examples directory, it should be in:
Make a copy of the "micrium_os_example" folder and place it in the directory where the sensor example was generated. In my case the sensor example workspace was generated at:
Now that you have Micrium OS and File System as part of your project, let's go ahead and make some minor adjustments to the default Micrium OS configuration. Start by expanding the Includes section in the Project Explorer panel, then expand the "protocol/flex/connect/plugins/micrium-rtos/config" folder as shown in Figure 13 and 14. The files we will be modifying are "common_cfg.h", "os_cfg.h", and "rtos_description", so please double-click on those to open it in the editor.
Figure 13 Project Explorer Sensor Includes section
Figure 14 Micrium OS configurations.
Let's start by modifying "rtos_description.h" by adding the following File System defines:
As soon as you try to edit the "rtos_description.h", you will be presented a Warning indicating you are editing an SDK file. Click on "Make a Copy", and choose the same option when modifying "common_cfg.h" and "os_cfg.h".
Make a copy of "fs_core_cfg.h" and "fs_storage_cfg.h" and place them in the external_copied_files folder in your sensor directory. In my case the location was at:
Initialize Micrium OS File System and Simple Demo.
The micrium_os_example folder provides examples for initializing the File System and executing a simple Read/Write demo; therefore, let's make additional modifications to the project,which will allow us to run FS and simple demo.
In the Project Explorer, locate the micrium_os_example folder and open ex_description.h. Add the following define:
At this point, we are ready to modify the flex-callbacks.c file and add the FS initialization and demo. Please open the file and modify the emberAfPluginMicriumRtosAppTask1MainLoopCallback() function as shown below as well as the includes.
Figure 17 - flex-callbacks.c file
We need to add one minor modification to bsp_fs_nor_spi.c, so please open the file (Figure16).
Figure 16 BSP for FS-NOR_SPI
Modify bsp_fs_nor_spi.c dependencies section as shown below, but keep in mind that as soon as you try to edit the it, you will be presented a Warning indicating you are editing an SDK file. Click on "Make a Copy"
Figure 18 - bsp_fs_nor_spi.c file
The bsp_fs_nor_spi.c file is very important, since it will be here that you will need to modify SPI pin configurations for the specific NOR device on your board. For the BRD4255A board you do not need to do anything else since all the pin configurations have been implemented; however, if you are using a different board then make sure your schematics match the PIN configurations on this file.
At this point you should be able to compile and flash the board. The example is very simple, the FS performs a low/high level format on the NOR storage device, then it opens a file and does a write/read operation. As soon as it is done, you should see LED0 blinking on the board. Keep in mind the low/high level format takes a few seconds to complete.
I'm pleased to announce the latest SDK that includes improvements and bug fixes for our Bluetooth, Thread, Zigbee, and MCU product families. This release provides the following:
Official Blog of Silicon Labs
Adding Micrium OS File System on a Flex Gecko
This blog should serve as a guide to adding Micrium OS File System(NOR device) on a Flex Gecko and get at least the FS core initialized, perform low/high-level if the Storage device requires it and execute a simple read/write application.
I will now share with you my experience while going through this exercise.
Getting Started
I decided to perform a clean installation of Simplicity Studio in order to avoid conflicts inflicted by software updates over time. After installing the tool, before even attempting to add anything, I first had to make sure that I had the necessary SDKs. Here's what I installed:
I then mounted a Flex Gecko, EFR32FG13(BRD4255A) in my case, onto a Wireless Started Kit Mainboard (BRD4001A). After that, I connected it to the PC using the provided USB cable.
Simplicity Studio recognized a Flex Gecko connected to a WSTK and displayed the link to examples from the Flex SDK (see Figure 1).
Figure 1 - Initial Setup Validation
Loading a Basic Flex SDK Example
As a starting point, I decided to go with the "Connect(Soc): Sensor" example from the Flex SDK.
You can find this by expanding the list of projects under the "Connect Examples" link:
Figure 2 - Flex SDK Examples Link
You will then be presented with sensor.isc opened where you can configure Sensor. Since we are adding Micrium OS to the example, let's click on the "Plugins" tab and select the "Micrium RTOS" check box and "Application Task (1)" as shown on Figure 3. Make sure to press 'CRTL + S' to save the modifications and then clicked on "Generate".
Figure 3 - Sensor Project Configuration
Click the 'OK' button on the Generation validation pop-up window.
Figure 4 - Generation validation
At this point, you should now be set with a Flex Gecko example that builds and runs. However, I did find that the default project settings have compiler optimization set to "Optimize for size (-Os)" which will eventually make debugging the project rather difficult. Therefore, I switched optimizations to "None (-O0)".
Figure 5 - Compiler Optimizations
Installing Micrium OS File System
Assuming your credentials have the right access permissions to install Micrium OS File System, you will need to click on the 'Help->Update Software' menu. The "Installation Manager" window should pop-up. Please select the "Package Manager" option as shown on Figure 6. If you are not sure your credentials have the proper access to Micrium OS File System, please contact our sales department.
Figure 6 - Installation Manager
On the "Package Manager" window select the 'SDKs' tab and Micrium OS as Categories, then click on the 'Install' button Figure 7. Close the window once the installation is completed.
Figure 7 - Package Manager
Adding Micrium OS File System to the Workspace
The BRD4255A board has a 8-Mbit Macronix MX25R8035F SPI flash; therefore, our workspace will have all the Micrium OS File System files required to run the NOR(MX25R8035F) device. Since we already generated a Flex Gecko example that builds and runs, let's go ahead and start adding the Micrium OS File System source files into the workspace. First, locate the Micrium OS directory, it should be in:
Right-click on the 'sensor' workspace and select 'Import->MCU project'. Once the "Import Project" window pops-up, please select the 'More Import Options" as shown on Figure 8.
Figure 8 - Import Project
During the next window, select the "General->File System" import source and click next. At this point, we will be adding all the necessary Micrium OS File System files to the workspace.
Figure 9 - BSP file for the NOR-SPI device.
Figure 10 Micrium OS common files
Figure 11 Micrium OS drivers for NOR-SPI
Figure 12 Micrium OS File System
Adding Micrium OS FS Examples to the Workspace
Locate the Micrium OS examples directory, it should be in:
Make a copy of the "micrium_os_example" folder and place it in the directory where the sensor example was generated. In my case the sensor example workspace was generated at:
In addition, we need to add the following include path to the project
Configuring Micrium OS and File System
Now that you have Micrium OS and File System as part of your project, let's go ahead and make some minor adjustments to the default Micrium OS configuration. Start by expanding the Includes section in the Project Explorer panel, then expand the "protocol/flex/connect/plugins/micrium-rtos/config" folder as shown in Figure 13 and 14. The files we will be modifying are "common_cfg.h", "os_cfg.h", and "rtos_description", so please double-click on those to open it in the editor.
Figure 13 Project Explorer Sensor Includes section
Figure 14 Micrium OS configurations.
Let's start by modifying "rtos_description.h" by adding the following File System defines:
As soon as you try to edit the "rtos_description.h", you will be presented a Warning indicating you are editing an SDK file. Click on "Make a Copy", and choose the same option when modifying "common_cfg.h" and "os_cfg.h".
Figure 15 Warning
Modify the following defines in "os_cfg.h" file
Modify the following defines in "common_cfg.h" file
The value of LIB_MEM_CFG_HEAP_SIZE is used by the FS stack and examples so the value will depend on your application.
It is time to add the File system configurations by locating the configuration templates at:
Make a copy of "fs_core_cfg.h" and "fs_storage_cfg.h" and place them in the external_copied_files folder in your sensor directory. In my case the location was at:
Open "fs_storage_cfg.h" and modify the following
Initialize Micrium OS File System and Simple Demo.
The micrium_os_example folder provides examples for initializing the File System and executing a simple Read/Write demo; therefore, let's make additional modifications to the project,which will allow us to run FS and simple demo.
In the Project Explorer, locate the micrium_os_example folder and open ex_description.h. Add the following define:
Open ex_fs.c located at micrium_os_example/fs and modify the following defines.
We are modifying EX_FS_MEM_SEG_LEN due to memory reasons; however, the original value should be enough to run most of the examples.
Open ex_fs_file_rd_wr.c located at micrium_os_example/fs and modify the following function call in Ex_FS_FileRdWr()
At this point, we are ready to modify the flex-callbacks.c file and add the FS initialization and demo. Please open the file and modify the emberAfPluginMicriumRtosAppTask1MainLoopCallback() function as shown below as well as the includes.
Figure 17 - flex-callbacks.c file
We need to add one minor modification to bsp_fs_nor_spi.c, so please open the file (Figure16).
Figure 16 BSP for FS-NOR_SPI
Modify bsp_fs_nor_spi.c dependencies section as shown below, but keep in mind that as soon as you try to edit the it, you will be presented a Warning indicating you are editing an SDK file. Click on "Make a Copy"
Figure 18 - bsp_fs_nor_spi.c file
The bsp_fs_nor_spi.c file is very important, since it will be here that you will need to modify SPI pin configurations for the specific NOR device on your board. For the BRD4255A board you do not need to do anything else since all the pin configurations have been implemented; however, if you are using a different board then make sure your schematics match the PIN configurations on this file.
At this point you should be able to compile and flash the board. The example is very simple, the FS performs a low/high level format on the NOR storage device, then it opens a file and does a write/read operation. As soon as it is done, you should see LED0 blinking on the board. Keep in mind the low/high level format takes a few seconds to complete.
May 2018 SDK Release - Silicon Labs Release Update Notification
Hi all,
I'm pleased to announce the latest SDK that includes improvements and bug fixes for our Bluetooth, Thread, Zigbee, and MCU product families. This release provides the following:
Need help? Please contact Silicon Labs Technical Support.
~Tabi