tree: b41d811598b301cc201124671072db114f972983 [path history] [tgz]
  1. include/
  2. third_party/
  3. .gn
  4. args.gni
  5. BUILD.gn
  6. main.cpp
  7. README.md
  8. with_pw_rpc.gni
examples/persistent-storage/efr32/README.md

#CHIP EFR32 Persistent Storage Example

An example testing and demonstrating the key value storage API.

Introduction

This example serves to both test the key value storage implementation and API as it is brought-up on different platforms, as well as provide an example for how to use the API.

In the future this example can be moved into a unit test when available on all platforms.

EFR32

The EFR32 platform KVS is fully implemented

Building

  • Download the Simplicity Commander command line tool, and ensure that commander is your shell search path. (For Mac OS X, commander is located inside Commander.app/Contents/MacOS/.)

  • Download and install a suitable ARM gcc tool chain: GNU Arm Embedded Toolchain 9-2019-q4-major

  • Install some additional tools(likely already present for CHIP developers):

#Linux $ sudo apt-get install git libwebkitgtk-1.0-0 ninja-build

#Mac OS X $ brew install ninja

  • Supported hardware:

    MG12 boards:

    • BRD4161A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm
    • BRD4162A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm
    • BRD4163A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm, 868MHz@19dBm
    • BRD4164A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm
    • BRD4166A / SLTB004A / Thunderboard Sense 2 / 2.4GHz@10dBm
    • BRD4170A / SLWSTK6000B / Multiband Wireless Starter Kit / 2.4GHz@19dBm, 915MHz@19dBm
    • BRD4304A / SLWSTK6000B / MGM12P Module / 2.4GHz@19dBm

    MG21 boards: Currently not supported due to RAM limitation.

    • BRD4180A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm

    MG24 boards :

    • BRD4162A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm
    • BRD4163A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@10dBm, 868MHz@19dBm
    • BRD4186A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm
    • BRD4186C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@10dBm
    • BRD4187A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm
    • BRD4187C / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm
  • Build the example application:

      cd ~/connectedhomeip
      ./scripts/examples/gn_efr32_example.sh ./examples/persistent-storage/efr32/ ./out/persistent-storage BRD4161A
    
  • To delete generated executable, libraries and object files use:

      $ cd ~/connectedhomeip
      $ rm -rf ./out/persistent-storage
    

OR use GN/Ninja directly

      $ cd ~/connectedhomeip/examples/persistent-storage/efr32
      $ git submodule update --init
      $ source third_party/connectedhomeip/scripts/activate.sh
      $ export EFR32_BOARD=BRD4161A
      $ gn gen out/debug --args="efr32_sdk_root=\"${EFR32_SDK_ROOT}\" silabs_board=\"${EFR32_BOARD}\""
      $ ninja -C out/debug
  • To delete generated executable, libraries and object files use:

      $ cd ~/connectedhomeip/examples/persistent-storage/efr32
      $ rm -rf out/
    

Flashing the Application

  • On the command line:

      $ cd ~/connectedhomeip/examples/persistent-storage/efr32
      $ python3 out/debug/chip-efr32-persistent_storage-example.flash.py
    
  • Or with the Ozone debugger, just load the .out file.

Viewing Logging Output

The example application is built to use the SEGGER Real Time Transfer (RTT) facility for log output. RTT is a feature built-in to the J-Link Interface MCU on the WSTK development board. It allows bi-directional communication with an embedded application without the need for a dedicated UART.

Using the RTT facility requires downloading and installing the SEGGER J-Link Software and Documentation Pack (web site). Alternatively the SEGGER Ozone - J-Link Debugger can be used to view RTT logs.

  • Install the J-Link software

      $ cd ~/Downloads
      $ sudo dpkg -i JLink_Linux_V*_x86_64.deb
    
  • In Linux, grant the logged in user the ability to talk to the development hardware via the linux tty device (/dev/ttyACMx) by adding them to the dialout group.

      $ sudo usermod -a -G dialout ${USER}
    

Once the above is complete, log output can be viewed using the JLinkExe tool in combination with JLinkRTTClient as follows:

  • Run the JLinkExe tool with arguments to autoconnect to the WSTK board:

    For MG12 use:

      $ JLinkExe -device EFR32MG12PXXXF1024 -if JTAG -speed 4000 -autoconnect 1
    

    For MG21 use:

      $ JLinkExe -device EFR32MG21AXXXF1024 -if SWD -speed 4000 -autoconnect 1
    
  • In a second terminal, run the JLinkRTTClient to view logs:

      $ JLinkRTTClient
    

Memory settings

While most of the RAM usage in CHIP is static, allowing easier debugging and optimization with symbols analysis, we still need some HEAP for the crypto and OpenThread. Size of the HEAP can be modified by changing the value of the SL_STACK_SIZE define inside of the BUILD.gn file of this example. Please take note that a HEAP size smaller than 5k can and will cause a Mbedtls failure during the BLE rendez-vous.