Fix for x86_64 build fail
[platform/upstream/connectedhomeip.git] / examples / temperature-measurement-app / esp32 / README.md
1 # Temperature Sensor Example
2
3 ## Building the Example Application
4
5 Building the example application requires the use of the Espressif ESP32 IoT
6 Development Framework and the xtensa-esp32-elf toolchain.
7
8 The VSCode devcontainer has these components pre-installed, so you can skip this
9 step. To install these components manually, follow these steps:
10
11 -   Clone the Espressif ESP-IDF and checkout release/v4.2 branch
12
13           $ mkdir ${HOME}/tools
14           $ cd ${HOME}/tools
15           $ git clone https://github.com/espressif/esp-idf.git
16           $ cd esp-idf
17           $ git checkout release/v4.2
18           $ git submodule update --init
19           $ export IDF_PATH=${HOME}/tools/esp-idf
20           $ ./install.sh
21
22 -   Install ninja-build
23
24           $ sudo apt-get install ninja-build
25
26 ### To build the application, follow these steps:
27
28 Currently building in VSCode _and_ deploying from native is not supported, so
29 make sure the IDF_PATH has been exported(See the manual setup steps above).
30
31 -   Setting up the environment
32
33 To download and install packages.
34
35         $ cd ${HOME}/tools/esp-idf
36         $ ./install.sh
37         $ . ./export.sh
38         $ cd {path-to-connectedhomeip}
39         $ source ./scripts/bootstrap.sh
40         $ source ./scripts/activate.sh
41         $ cd {path-to-connectedhomeip-examples}
42
43 If packages are already installed then simply activate it.
44
45         $ cd ${HOME}/tools/esp-idf
46         $ ./install.sh
47         $ . ./export.sh
48         $ cd {path-to-connectedhomeip}
49         $ source ./scripts/activate.sh
50         $ cd {path-to-connectedhomeip-examples}
51
52 -   Configuration Options
53
54         To choose from the different configuration options, run menuconfig
55
56           $ idf.py menuconfig
57
58         Select ESP32 based `Device Type` through `Demo`->`Device Type`.
59         The device types that are currently supported include `ESP32-DevKitC` (default),
60         and `M5Stack`
61
62         If you are using `standalone chip-tool` to communicate with the ESP32, bypass the
63         Rendezvous mode so that the device can communicate over an insecure channel.
64         This can be done through `Demo`->`Rendezvous Mode`->`Bypass`
65
66         To connect the ESP32 to your network, configure the Wi-Fi SSID and Passphrase through
67         `Component config`->`CHIP Device Layer`->`WiFi Station Options`->`Default WiFi SSID` and
68         `Default WiFi Password` respectively.
69
70 -   To build the demo application.
71
72           $ idf.py build
73
74 -   After building the application, to flash it outside of VSCode, connect your
75     device via USB. Then run the following command to flash the demo application
76     onto the device and then monitor its output. If necessary, replace
77     `/dev/tty.SLAB_USBtoUART`(MacOS) with the correct USB device name for your
78     system(like `/dev/ttyUSB0` on Linux). Note that sometimes you might have to
79     press and hold the `boot` button on the device while it's trying to connect
80     before flashing. For ESP32-DevKitC devices this is labeled in the
81     [functional description diagram](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-devkitc.html#functional-description).
82
83           $ idf.py flash monitor ESPPORT=/dev/ttyUSB0
84
85     Note: Some users might have to install the
86     [VCP driver](https://www.silabs.com/products/development-tools/software/usb-to-uart-bridge-vcp-drivers)
87     before the device shows up on `/dev/tty`.
88
89 -   Quit the monitor by hitting `Ctrl+]`.
90
91     Note: You can see a menu of various monitor commands by hitting
92     `Ctrl+t Ctrl+h` while the monitor is running.
93
94 -   If desired, the monitor can be run again like so:
95
96           $ idf.py monitor ESPPORT=/dev/ttyUSB0
97
98 ## Using the Echo Server
99
100 ### Connect the ESP32 to a 2.4GHz Network of your choice
101
102 1.  If the `WiFi Station Options` mentioned above are populated through
103     menuconfig, then ESP32 connects to the AP with those credentials (STA mode).
104
105 2.  Now flash the device with the same command as before. (Use the right `/dev`
106     device)
107
108           $ idf make flash monitor ESPPORT=/dev/ttyUSB0
109
110 3.  The device should boot up and connect to your network. When that happens you
111     will see a log like this in the monitor.
112
113           I (5524) chip[DL]: SYSTEM_EVENT_STA_GOT_IP
114           I (5524) chip[DL]: IPv4 address changed on WiFi station interface: <IP_ADDRESS>...
115
116     Note: If you are using the M5Stack, the screen will display the server's IP
117     Address if it successfully connects to the configured 2.4GHz Network.
118
119 4.  Use
120     [standalone chip-tool](https://github.com/project-chip/connectedhomeip/tree/master/examples/chip-tool)
121     or
122     [iOS chip-tool app](https://github.com/project-chip/connectedhomeip/tree/master/src/darwin)
123     to communicate with the device.
124
125 Note: The ESP32 does not support 5GHz networks. Also, the Device will persist
126 your network configuration. To erase it, simply run.
127
128     $ idf make erase_flash ESPPORT=/dev/ttyUSB0
129
130 The demo application supports temperaturemeasurement and basic cluster.
131
132 ## Optimization
133
134 Optimization related to WiFi, BLuetooth, Asserts etc are the part of this
135 example by default. To enable this option set is_debug=false from command-line.
136
137 ```
138 idf make build flash monitor 'is_debug=false'
139 ```