Silicon Labs
|
Silicon Labs Community Silicon Labs Community
  • Products
    1. 8-bit MCU
    2. 32-bit MCU
    3. Bluetooth
    4. Proprietary
    5. Wi-Fi
    6. Zigbee & Thread
    7. Z-Wave
    8. Interface
    9. Isolation
    10. Power
    11. Sensors
    12. Timing
  • Development Tools
    1. Simplicity Studio
    2. Third Party Tools
  • Expert's Corner
    1. Announcements
    2. Blog
    3. General Interest
    4. Projects
How to Buy
English
  • English
  • 简体中文
  • 日本語
//
Community // Blog

Official Blog of Silicon Labs

  • Show More
    Publish
    • Immediately
    • Draft
    • At scheduled date and time
     
      • Adding Micrium OS File System on a Flex Gecko

        Fernando Flores | 04/101/2019 | 07:29 PM

        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).

        Figure01

        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:

        Figure02

        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".

        Figure003

        Figure 3 - Sensor Project Configuration

        Click the 'OK' button on the Generation validation pop-up window.

        Figure04

        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)".

        Figure05

        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.

        Figure06

        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.

        Figure07

        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:

        C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v2.5\platform\micrium_os

        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.

        Figure08

        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.

        Figure09

        Figure 9 - BSP file for the NOR-SPI device.

         

        Figure10

        Figure 10 Micrium OS common files

         

        Figure11

        Figure 11 Micrium OS drivers for NOR-SPI

         

        Figure12

        Figure 12 Micrium OS File System

        Adding Micrium OS FS Examples to the Workspace

        Locate the Micrium OS examples directory, it should be in:

        C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v2.5\app\micrium_os_example

        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:

        C:\Users\UserName\SimplicityStudio\v4_workspace\sensor
        Once you place the folder in the sensor directory, make sure to delete the following folders and file:
        canopen
        common
        cpu
        io
        kernel
        net
        uC-Probe
        usb
        ex_main.c

        In addition, we need to add the following include path to the project

        "${workspace_loc:/${ProjName}/micrium_os_example}"

         

        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.

        Figure13

        Figure 13 Project Explorer Sensor Includes section

         

        Figure14

        Figure 14 Micrium OS configurations.

         

        Let's start by modifying "rtos_description.h" by adding the following File System defines:

        /*
         *********************************************************************************************************
         *********************************************************************************************************
         *                                       RTOS MODULES DESCRIPTION
         *********************************************************************************************************
         *********************************************************************************************************
         */
        
        #define  RTOS_MODULE_KERNEL_AVAIL
        
                                                                        /* ------------------- FILE SYSTEM -------------------- */
        #define  RTOS_MODULE_FS_AVAIL
        #define  RTOS_MODULE_FS_STORAGE_NOR_AVAIL

        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".

        Figure15

        Figure 15 Warning

         

        Modify the following defines in "os_cfg.h" file

        #define  OS_CFG_MON_EN         DEF_ENABLED
        #define  OS_CFG_TASK_Q_EN      DEF_ENABLED

         

        Modify the following defines in "common_cfg.h" file

        #define  LIB_MEM_CFG_STD_C_LIB_EN              DEF_DISABLED
        #define  LIB_MEM_CFG_HEAP_SIZE                 32768uL

        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:

        C:\SiliconLabs\SimplicityStudio\v4\developer\sdks\gecko_sdk_suite\v2.5\platform\micrium_os\cfg

        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:

        C:\Users\UserName\SimplicityStudio\v4_workspace\sensor\external_copied_files

        Open "fs_storage_cfg.h" and modify the following

        #define  FS_STORAGE_CFG_MEDIA_POLL_TASK_EN                  DEF_DISABLED

         

        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:

        /********************************************************************************************************
         ********************************************************************************************************
         *                                         EXAMPLES DESCRIPTION
         ********************************************************************************************************
         *******************************************************************************************************/
        
        #define  EX_FS_INIT_AVAIL

         

        Open ex_fs.c located at micrium_os_example/fs and modify the following defines.

        #define  EX_CFG_FS_MEDIA_LOW_LEVEL_FMT_EN       DEF_ENABLED
        #define  EX_CFG_FS_MEDIA_HIGH_LEVEL_FMT_EN      DEF_ENABLED
        
        #define  EX_FS_MEM_SEG_LEN                      (1u * 1024u) 

        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()

          Ex_FS_FileRdWr_Exec(vol_handle,
                              "file-rdwr.txt",
                              512u,                                    // File size.
                              &err);

         

        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.

        Figure17
        

        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).

        Figure016

        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"

        Figure18

        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

        Tabitha | 08/219/2018 | 11:38 PM

        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: 

        • EmberZNet 6.3.0 (Full release here)
          • Zigbee Pro 2017 (R22) compliant stack w/ GPPB and SE1.4/GBCS support
          • Dynamic block request delay support for OTA upgrades
          • Sub-GHz only mode support for SE1.4/GBCS
          • NVM3 G.A integration
          • Gecko Bootloader LZMA decompression support
          • IAR EWARM 7.80.4 and GCC 7.2.1 support
        • Silicon Labs - Thread 2.7.0 (Full release here)
          • Thread with Micrium OS Beta support 
          • DotDot DTLS security support
          • DotDot resource directory and discovery support
          • DotDot conformance testing support
          • IAR EWARM 7.8.4 and GCC 7.2.1 support
          • GRL Test Harness support bug fixes
        • Flex SDK (Full release here)
          • Version 2.2.1.0 GA – enhanced support for QFN68 variants of EFR32xG12
          • Version 2.2.2.0 GA – RAIL and Connect feature enhancements and bug fixes
          • Version 2.2.2.1 GA – minor metadata changes, no application or stack changes
        • Bluetooth SDK (Full release here)
          • +20dBm support and AFH
          • Long advertisement packets & additional RF channels 
          • Bluetooth + RAIL DMP enhancements 
        • MCU (Full release here)
          • Gecko LE-USB support on GG11, to complement existing Micrium USB 
          • Micrium OpenCAN support for GG11/TG11

        Need help? Please contact Silicon Labs Technical Support.

        ~Tabi

      Tags

      • Wireless
      • High Performance Jitter Attenuators
      • EFR32FG22 Series 2 SoCs
      • EFR32MG21 Series 2 SoCs
      • Security
      • Bluegiga Legacy Modules
      • Zigbee SDK
      • ZigBee and Thread
      • EFR32BG13 Series 1 Modules
      • Internet Infrastructure
      • Sensors
      • Wireless Xpress BGX13
      • Blue Gecko Bluetooth Low Energy SoCs
      • Z-Wave
      • Micrium OS
      • Blog Posts
      • Low Jitter Clock Generators
      • Bluetooth Classic
      • Makers
      • Flex SDK
      • Tips and Tricks
      • timing
      • Smart Cities
      • Smart Homes
      • IoT Heroes
      • Reviews
      • RAIL
      • Simplicity Studio
      • Tiny Gecko
      • EFR32MG22 Series 2 SoCs
      • Mighty Gecko SoCs
      • Timing
      • Temperature Sensors
      • Blue Gecko Bluetooth Low Energy Modules
      • Ultra Low Jitter Clock Generators
      • General Purpose Clock Generators
      • EFR32BG22 Series 2 SoCs
      • Industry 4.0
      • Giant Gecko
      • 32-bit MCUs
      • Bluetooth Low Energy
      • 32-bit MCU SDK
      • Gecko
      • Microcontrollers
      • Jitter Attenuators
      • EFR32BG21 Series 2 SoCs
      • News and Events
      • Wi-Fi
      • Bluetooth SDK
      • Community Spotlight
      • Clock Generators
      • Biometric Sensors
      • General Purpose Jitter Attenuators
      • Giant Gecko S1
      • WF200
      • Flex Gecko
      • Internet of Things
      • 8-bit MCUs
      • Wireless Jitter Attenuators
      • Isolation
      • Powered Devices
      • Power

      Top Authors

      • Avatar image Siliconlabs
      • Avatar image Jackie Padgett
      • Avatar image Nari Shin
      • Avatar image lynchtron
      • Avatar image deirdrewalsh
      • Avatar image Lance Looper
      • Avatar image lethawicker

      Archives

      • 2016 March
      • 2016 April
      • 2016 May
      • 2016 June
      • 2016 July
      • 2016 August
      • 2016 September
      • 2016 October
      • 2016 November
      • 2016 December
      • 2017 January
      • 2017 February
      • 2017 March
      • 2017 April
      • 2017 May
      • 2017 June
      • 2017 July
      • 2017 August
      • 2017 September
      • 2017 October
      • 2017 November
      • 2017 December
      • 2018 January
      • 2018 February
      • 2018 March
      • 2018 April
      • 2018 May
      • 2018 June
      • 2018 July
      • 2018 August
      • 2018 September
      • 2018 October
      • 2018 November
      • 2018 December
      • 2019 January
      • 2019 February
      • 2019 March
      • 2019 April
      • 2019 May
      • 2019 June
      • 2019 July
      • 2019 August
      • 2019 September
      • 2019 October
      • 2019 November
      • 2019 December
      • 2020 January
      • 2020 February
      • 2020 March
      • 2020 April
      • 2020 May
      • 2020 June
      • 2020 July
      • 2020 August
      • 2020 September
      • 2020 October
      • 2020 November
      • 2020 December
      • 2021 January
      • 2021 February
      Silicon Labs
      Stay Connected With Us
      Plug into the latest on Silicon Labs products, including product releases and resources, documentation updates, PCN notifications, upcoming events, and more.
      • About Us
      • Careers
      • Community
      • Contact Us
      • Corporate Responsibility
      • Privacy and Terms
      • Press Room
      • Investor Relations
      • Site Feedback
      • Cookies
      Copyright © Silicon Laboratories. All rights reserved.
      粤ICP备15107361号
      Also of Interest:
      • Bring Your IoT Designs to Life with Smart,...
      • A Guide to IoT Protocols at Works With...
      • IoT Hero Rainus Enhances the In-Store Shopping...