Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / pigweed-app / efr32 / README.md
1 #CHIP EFR32 Pigweed Example Application
2
3 The EFR32 example demonstrates the usage of Pigweed module functionalities in an
4 application.
5
6 The example is based on [CHIP](https://github.com/project-chip/connectedhomeip),
7 the [Pigweed](https://pigweed.googlesource.com/pigweed/pigweed) module, which is
8 a collection of libraries that provide different functionalities for embedded
9 systems, and the EFR32 platform.
10
11 You can use this example as a training ground for making experiments, testing
12 Pigweed module features and checking what actions are necessary to fully
13 integrate Pigweed in a CHIP project.
14
15 Pigweed functionalities are being gradually integrated into CHIP. Currently, the
16 following features are available:
17
18 -   **Echo RPC** - Creates a Remote Procedure Call server and allows sending
19     commands through the serial port to the device, which makes echo and sends
20     the received commands back.
21
22 ---
23
24 -   [CHIP EFR32 Pigweed Example Application](#chip-EFR32-pigweed-example-application)
25     -   [Building the Example Application](#building-the-example-application)
26         -   [To build the application, follow these steps:](#to-build-the-application-follow-these-steps)
27     -   [Testing the Example Application](#testing-the-example-application)
28
29 ---
30
31 ## Building the Example Application
32
33 -   Download or clone the
34     [sdk_support](https://github.com/SiliconLabs/sdk_support) from GitHub
35     $ git
36     clone https://github.com/SiliconLabs/sdk_support.git and export the path
37     with : $
38     export EFR32_SDK_ROOT=<Path to cloned git repo>
39
40 -   Download the
41     [Simplicity Commander](https://www.silabs.com/mcu/programming-options)
42     command line tool, and ensure that `commander` is your shell search path.
43     (For Mac OS X, `commander` is located inside
44     `Commander.app/Contents/MacOS/`.)
45
46             export PATH=/Applications/Commander.app/Contents/MacOS:$PATH
47
48 -   Download and install a suitable ARM gcc tool chain:
49     [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)
50
51 -   Install some additional tools(likely already present for CHIP developers):
52
53 #Linux sudo apt-get install git libwebkitgtk-1.0-0 ninja-build
54
55 #Mac OS X brew install ninja
56
57 -   Supported hardware:
58
59     MG12 boards:
60
61     -   BRD4161A / SLWSTK6000B / Wireless Starter Kit / 2.4GHz@19dBm
62     -   BRD4163A / SLWSTK6000B / Dual band Wireless Starter Kit / 2.4GHz@19dBm,
63         868MHz@19dBm
64     -   BRD4164A / SLWSTK6000B / Dual band Wireless Starter Kit / 2.4GHz@19dBm,
65         915MHz@19dBm
66     -   BRD4166A / SLTB004A / Thunderboard Sense 2 / 2.4GHz@10dBm
67     -   BRD4170A / SLWSTK6000B / Multiband Wireless Starter Kit / 2.4GHz@19dBm,
68         915MHz@19dBm
69     -   BRD4304A / SLWSTK6000B / MGM12P Module / 2.4GHz@19dBm
70
71     MG21 boards:
72
73     -   BRD4180A / SLWSTK6006A / Wireless Starter Kit / 2.4GHz@20dBm
74
75 *   Build the example application:
76
77         cd ~/connectedhomeip/examples/pigweed-app/efr32
78         git submodule update --init
79         source third_party/connectedhomeip/scripts/activate.sh
80         export EFR32_BOARD=BRD4161A
81         gn gen out/debug
82         ninja -C out/debug
83
84 -   To delete generated executable, libraries and object files use:
85
86           cd ~/connectedhomeip/examples/pigweed-app/efr32
87           rm -rf out/
88
89 ### Flashing the Application
90
91 -   On the command line:
92
93         cd ~/connectedhomeip/examples/pigweed-app/efr32
94         python3 out/debug/chip-efr32-pigweed-example.flash.py
95
96 -   With the Commander app, just load the .s37 file.
97 -   Or with the Ozone debugger, just load the .out file.
98
99 ## Testing the Example Application
100
101 -   Determine the serial port name for the EFR device by checking /dev: ls
102     /dev/tty\*
103
104         It should look like this :
105         - On Linux
106             /dev/ttyACM0
107         - On MAC
108             /dev/tty.usbmodem0004401548451
109
110 -   Run the following command to start an interactive Python shell, where the
111     Echo RPC commands can be invoked:
112
113         python -m pw_hdlc.rpc_console --device /dev/tty.usbmodem0004401548451 -b 115200 <CHIP_ROOT>/third_party/pigweed/repo/pw_rpc/pw_rpc_protos/echo.proto -o /tmp/pw_rpc.out
114
115 -   To send an Echo RPC message, type the following command, where the actual
116     message is the text in quotation marks after the `msg=` phrase:
117
118         rpcs.pw.rpc.EchoService.Echo(msg="hi")
119
120     Note: Some users might have to install the
121     [VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers)
122     before the device shows up on `/dev/tty`.
123
124 ## Memory settings
125
126 While most of the RAM usage in CHIP is static, allowing easier debugging and
127 optimization with symbols analysis, we still need some HEAP for the crypto and
128 OpenThread. Size of the HEAP can be modified by changing the value of the
129 `SL_STACK_SIZE` define inside of the BUILD.gn file of this example. Please take
130 note that a HEAP size smaller than 5k can and will cause a Mbedtls failure
131 during the BLE rendez-vous.