1 #CHIP EFR32 Persistent Storage Example
3 An example testing and demonstrating the key value storage API.
7 - [CHIP EFR32 Persistent Storage Example](#chip-efr32-persistent-storage-example)
8 - [Introduction](#introduction)
10 - [Building](#building)
11 - [Flashing the Application](#flashing-the-application)
12 - [Viewing Logging Output](#viewing-logging-output)
20 This example serves to both test the key value storage implementation and API as
21 it is brought-up on different platforms, as well as provide an example for how
24 In the future this example can be moved into a unit test when available on all
31 The EFR32 platform KVS is fully implemented, the KVS is enabled and configured
36 "CHIP_KVS_SECTOR_COUNT=4",
37 "CHIP_KVS_BASE_SECTOR_INDEX=((FLASH_SIZE/FLASH_PAGE_SIZE)-(CHIP_KVS_SECTOR_COUNT))",
41 <a name="building"></a>
46 [Simplicity Commander](https://www.silabs.com/mcu/programming-options)
47 command line tool, and ensure that `commander` is your shell search path.
48 (For Mac OS X, `commander` is located inside
49 `Commander.app/Contents/MacOS/`.)
51 - Download and install a suitable ARM gcc tool chain:
52 [GNU Arm Embedded Toolchain 9-2019-q4-major](https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads)
54 - Install some additional tools(likely already present for CHIP developers):
56 #Linux \$ sudo apt-get install git libwebkitgtk-1.0-0 ninja-build
58 #Mac OS X \$ brew install ninja
64 - BRD4161A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm
65 - BRD4166A / SLTB004A / Thunderboard Sense 2 / 2.4GHz@10dBm
66 - BRD4170A / SLWSTK6000B / Multiband Wireless Starter Kit / 2.4GHz@19dBm,
68 - BRD4304A / SLWSTK6000B / MGM12P Module / 2.4GHz@19dBm
72 - BRD4180A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm
74 * Build the example application:
77 ./scripts/examples/gn_efr32_example.sh ./examples/persistent-storage/efr32/ ./out/persistent-storage BRD4161A
79 - To delete generated executable, libraries and object files use:
81 $ cd ~/connectedhomeip
82 $ rm -rf ./out/persistent-storage
84 OR use GN/Ninja directly
86 $ cd ~/connectedhomeip/examples/persistent-storage/efr32
87 $ git submodule update --init
88 $ source third_party/connectedhomeip/scripts/activate.sh
89 $ export EFR32_BOARD=BRD4161A
90 $ gn gen out/debug --args="efr32_sdk_root=\"${EFR32_SDK_ROOT}\" efr32_board=\"${EFR32_BOARD}\""
93 - To delete generated executable, libraries and object files use:
95 $ cd ~/connectedhomeip/examples/persistent-storage/efr32
98 <a name="flashing"></a>
100 ### Flashing the Application
102 - On the command line:
104 $ cd ~/connectedhomeip/examples/persistent-storage/efr32
105 $ python3 out/debug/chip-efr32-persistent_storage-example.flash.py
107 - Or with the Ozone debugger, just load the .out file.
109 <a name="view-logging"></a>
111 ### Viewing Logging Output
113 The example application is built to use the SEGGER Real Time Transfer (RTT)
114 facility for log output. RTT is a feature built-in to the J-Link Interface MCU
115 on the WSTK development board. It allows bi-directional communication with an
116 embedded application without the need for a dedicated UART.
118 Using the RTT facility requires downloading and installing the _SEGGER J-Link
119 Software and Documentation Pack_
120 ([web site](https://www.segger.com/downloads/jlink#J-LinkSoftwareAndDocumentationPack)).
121 Alternatively the _SEGGER Ozone - J-Link Debugger_ can be used to view RTT logs.
123 - Download the J-Link installer by navigating to the appropriate URL and
124 agreeing to the license agreement.
126 - [JLink_Linux_x86_64.deb](https://www.segger.com/downloads/jlink/JLink_Linux_x86_64.deb)
127 - [JLink_MacOSX.pkg](https://www.segger.com/downloads/jlink/JLink_MacOSX.pkg)
129 * Install the J-Link software
132 $ sudo dpkg -i JLink_Linux_V*_x86_64.deb
134 * In Linux, grant the logged in user the ability to talk to the development
135 hardware via the linux tty device (/dev/ttyACMx) by adding them to the
138 $ sudo usermod -a -G dialout ${USER}
140 Once the above is complete, log output can be viewed using the JLinkExe tool in
141 combination with JLinkRTTClient as follows:
143 - Run the JLinkExe tool with arguments to autoconnect to the WSTK board:
147 $ JLinkExe -device EFR32MG12PXXXF1024 -if JTAG -speed 4000 -autoconnect 1
151 $ JLinkExe -device EFR32MG21AXXXF1024 -if SWD -speed 4000 -autoconnect 1
153 - In a second terminal, run the JLinkRTTClient to view logs:
159 While most of the RAM usage in CHIP is static, allowing easier debugging and
160 optimization with symbols analysis, we still need some HEAP for the crypto and
161 OpenThread. Size of the HEAP can be modified by changing the value of the
162 `SL_STACK_SIZE` define inside of the BUILD.gn file of this example. Please take
163 note that a HEAP size smaller than 5k can and will cause a Mbedtls failure
164 during the BLE rendez-vous.