├── .gitignore
├── .vscode
├── c_cpp_properties.json
└── settings.json
├── CMakeLists.txt
├── ESP32_NAT_UI.JPG
├── FlasherUI.jpg
├── Makefile
├── README.md
├── build
├── bootloader
│ └── bootloader.bin
├── esp32_nat_router.bin
└── partitions_example.bin
├── components
├── cmd_nvs
│ ├── CMakeLists.txt
│ ├── cmd_nvs.c
│ ├── cmd_nvs.h
│ └── component.mk
├── cmd_router
│ ├── CMakeLists.txt
│ ├── cmd_router.c
│ ├── cmd_router.h
│ ├── component.mk
│ └── router_globals.h
└── cmd_system
│ ├── CMakeLists.txt
│ ├── cmd_system.c
│ ├── cmd_system.h
│ └── component.mk
├── main
├── CMakeLists.txt
├── Kconfig.projbuild
├── cmd_decl.h
├── component.mk
├── esp32_nat_router.c
├── esp32_nat_router.h
├── http_server.c
└── pages.h
├── partitions_example.csv
├── sdkconfig
├── sdkconfig.ci.history
├── sdkconfig.ci.nohistory
└── sdkconfig.defaults
/.gitignore:
--------------------------------------------------------------------------------
1 | build/**
2 | !build/bootloader
3 | !build/esp32_nat_router.bin
4 | !build/partitions_example.bin
5 |
--------------------------------------------------------------------------------
/.vscode/c_cpp_properties.json:
--------------------------------------------------------------------------------
1 | {
2 | "configurations": [
3 | {
4 | "name": "Linux",
5 | "includePath": [
6 | "${workspaceFolder}/**",
7 | "${IDF_PATH}/**"
8 | ],
9 | "defines": [],
10 | "compilerPath": "/home/mfg/esp32/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc",
11 | "cStandard": "c11",
12 | "cppStandard": "c++17",
13 | "intelliSenseMode": "clang-x64"
14 | }
15 | ],
16 | "version": 4
17 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "files.associations": {
3 | "bleprph.h": "c",
4 | "*.ipp": "c",
5 | "*.contiki": "c"
6 | }
7 | }
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | # The following lines of boilerplate have to be in your project's CMakeLists
2 | # in this exact order for cmake to work correctly
3 | cmake_minimum_required(VERSION 3.5)
4 |
5 | include($ENV{IDF_PATH}/tools/cmake/project.cmake)
6 | project(esp32_nat_router)
7 |
--------------------------------------------------------------------------------
/ESP32_NAT_UI.JPG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dabare/esp32_nat_router/c9de48f599545fb1b20cf4d8cfa36966820609ee/ESP32_NAT_UI.JPG
--------------------------------------------------------------------------------
/FlasherUI.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dabare/esp32_nat_router/c9de48f599545fb1b20cf4d8cfa36966820609ee/FlasherUI.jpg
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # This is a project Makefile. It is assumed the directory this Makefile resides in is a
3 | # project subdirectory.
4 | #
5 |
6 | PROJECT_NAME := esp32_nat_router
7 |
8 | include $(IDF_PATH)/make/project.mk
9 |
10 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # ESP32 NAT Router
2 |
3 | This is a firmware to use the ESP32 as WiFi NAT router. It can be used as
4 | - Simple range extender for an existing WiFi network
5 | - Setting up an additional WiFi network with different SSID/password for guests or IOT devices
6 |
7 | It can achieve a bandwidth of more than 15mbps.
8 |
9 | The code is based on the [Console Component](https://docs.espressif.com/projects/esp-idf/en/latest/api-guides/console.html#console) and the [esp-idf-nat-example](https://github.com/jonask1337/esp-idf-nat-example).
10 |
11 | ## Performance
12 |
13 | All tests used `IPv4` and the `TCP` protocol.
14 |
15 | | Board | Tools | Optimization | CPU Frequency | Throughput | Power |
16 | | ----- | ----- | ------------ | ------------- | ---------- | ----- |
17 | | `ESP32D0WDQ6` | `iperf3` | `0g` | `240MHz` | `16.0 MBits/s` | `1.6 W` |
18 | | `ESP32D0WDQ6` | `iperf3` | `0s` | `240MHz` | `10.0 MBits/s` | `1.8 W` |
19 | | `ESP32D0WDQ6` | `iperf3` | `0g` | `160MHz` | `15.2 MBits/s` | `1.4 W` |
20 | | `ESP32D0WDQ6` | `iperf3` | `0s` | `160MHz` | `14.1 MBits/s` | `1.5 W` |
21 |
22 | ## First Boot
23 | After first boot the ESP32 NAT Router will offer a WiFi network with an open AP and the ssid "ESP32_NAT_Router". Configuration can either be done via a simple web interface or via the serial console.
24 |
25 | ## Web Config Interface
26 | The web interface allows for the configuration of all parameters. Connect you PC or smartphone to the WiFi SSID "ESP32_NAT_Router" and point your browser to "http://192.168.4.1". This page should appear:
27 |
28 |
29 |
30 | First enter the appropriate values for the uplink WiFi network, the "STA Settings". Leave password blank for open networks. Click "Connect". The ESP32 reboots and will connect to your WiFi router.
31 |
32 | Now you can reconnect and reload the page and change the "Soft AP Settings". Click "Set" and again the ESP32 reboots. Now it is ready for forwarding traffic over the newly configured Soft AP. Be aware that these changes also affect the config interface, i.e. to do further configuration, connect to the ESP32 through one of the newly configured WiFi networks.
33 |
34 | If you want to enter a '+' in the web interface you have to use HTTP-style hex encoding like "Mine%2bYours". This will result in a string "Mine+Yours". With this hex encoding you can enter any byte value you like, except for 0 (for C-internal reasons).
35 |
36 | It you want to disable the web interface (e.g. for security reasons), go to the CLI and enter:
37 | ```
38 | nvs_namespace esp32_nat
39 | nvs_set lock str -v 1
40 | ```
41 | After restart, no webserver is started any more. You can only re-enable it with:
42 | ```
43 | nvs_namespace esp32_nat
44 | nvs_set lock str -v 0
45 | ```
46 | If you made a mistake and have lost all contact with the ESP you can still use the serial console to reconfigure it. All parameter settings are stored in NVS (non volatile storage), which is *not* erased by simple re-flashing the binaries. If you want to wipe it out, use "esptool.py -p /dev/ttyUSB0 erase_flash".
47 |
48 | # Command Line Interface
49 |
50 | For configuration you have to use a serial console (Putty or GtkTerm with 115200 bps).
51 | Use the "set_sta" and the "set_ap" command to configure the WiFi settings. Changes are stored persistently in NVS and are applied after next restart. Use "show" to display the current config.
52 |
53 | Enter the `help` command get a full list of all available commands.
54 |
55 | If you want to enter non-ASCII or special characters (incl. ' ') you can use HTTP-style hex encoding (e.g. "My%20AccessPoint" results in a string "My AccessPoint").
56 |
57 | ## Flashing the prebuild Binaries
58 | Install [esptool](https://github.com/espressif/esptool), go to the project directory, and enter:
59 | ```
60 | esptool.py --chip esp32 --port /dev/ttyUSB0 \
61 | --baud 115200 --before default_reset --after hard_reset write_flash \
62 | -z --flash_mode dio --flash_freq 40m --flash_size detect \
63 | 0x1000 build/bootloader/bootloader.bin \
64 | 0x10000 build/esp32_nat_router.bin \
65 | 0x8000 build/partitions_example.bin
66 | ```
67 |
68 | As an alternative you might use [Espressif's Flash Download Tools](https://www.espressif.com/en/products/hardware/esp32/resources) with the parameters given in the figure below (thanks to mahesh2000):
69 |
70 | 
71 |
72 | ## Building the Binaries
73 | The following are the steps required to compile this project:
74 |
75 | ### Step 1 - Setup ESP-IDF
76 | Download and setup the ESP-IDF.
77 |
78 | ### Step 2 - Get the lwIP library with NAT
79 | Download the repository of the NAT lwIP library using the follwing command:
80 |
81 | `git clone https://github.com/martin-ger/esp-lwip.git`
82 |
83 | Note: It is important to clone the repository. If it is only downloaded it will be replaced by the orginal lwIP library during the build.
84 |
85 | ### Step 3 - Replace original ESP-IDF lwIP library with NAT lwIP library
86 | 1. Go to the folder where the ESP-IDF is installed.
87 | 2. Rename or delete the *esp-idf/component/lwip/lwip* directory.
88 | 3. Move the lwIP library with NAT repository folder from Step 2 to *esp-idf/component/lwip/*
89 | 4. Rename the lwIP library with NAT repository folder from *esp-lwip* to *lwip*.
90 |
91 | ### Step 4 - Build and flash the esp-idf-nat-example project
92 | 1. Configure and set the option "Enable copy between Layer2 and Layer3 packets" in the ESP-IDF project configuration.
93 | 1. In the project directory run `make menuconfig` (or `idf.py menuconfig` for cmake).
94 | 2. Go to *Component config -> LWIP* and set "Enable copy between Layer2 and Layer3 packets" option.
95 | 2. Build the project and flash it to the ESP32.
96 |
97 | A detailed instruction on how to build, configure and flash a ESP-IDF project can also be found the official ESP-IDF guide.
98 |
99 | ### DNS
100 | By Default the DNS-Server which is offerd to clients connecting to the ESP32 AP is set to 8.8.8.8.
101 | Replace the value of the *MY_DNS_IP_ADDR* with your desired DNS-Server IP address (in hex) if you want to use a different one.
102 |
103 | ## Troubleshooting
104 |
105 | ### Line Endings
106 |
107 | The line endings in the Console Example are configured to match particular serial monitors. Therefore, if the following log output appears, consider using a different serial monitor (e.g. Putty for Windows or GtkTerm on Linux) or modify the example's UART configuration.
108 |
109 | ```
110 | This is an example of ESP-IDF console component.
111 | Type 'help' to get the list of commands.
112 | Use UP/DOWN arrows to navigate through command history.
113 | Press TAB when typing command name to auto-complete.
114 | Your terminal application does not support escape sequences.
115 | Line editing and history features are disabled.
116 | On Windows, try using Putty instead.
117 | esp32>
118 | ```
119 |
--------------------------------------------------------------------------------
/build/bootloader/bootloader.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dabare/esp32_nat_router/c9de48f599545fb1b20cf4d8cfa36966820609ee/build/bootloader/bootloader.bin
--------------------------------------------------------------------------------
/build/esp32_nat_router.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dabare/esp32_nat_router/c9de48f599545fb1b20cf4d8cfa36966820609ee/build/esp32_nat_router.bin
--------------------------------------------------------------------------------
/build/partitions_example.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dabare/esp32_nat_router/c9de48f599545fb1b20cf4d8cfa36966820609ee/build/partitions_example.bin
--------------------------------------------------------------------------------
/components/cmd_nvs/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | idf_component_register(SRCS "cmd_nvs.c"
2 | INCLUDE_DIRS .
3 | REQUIRES console nvs_flash)
--------------------------------------------------------------------------------
/components/cmd_nvs/cmd_nvs.c:
--------------------------------------------------------------------------------
1 | /* Console example — NVS commands
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include "esp_log.h"
16 | #include "esp_console.h"
17 | #include "argtable3/argtable3.h"
18 | #include "freertos/FreeRTOS.h"
19 | #include "freertos/event_groups.h"
20 | #include "esp_err.h"
21 | #include "cmd_nvs.h"
22 | #include "nvs.h"
23 |
24 | typedef struct {
25 | nvs_type_t type;
26 | const char *str;
27 | } type_str_pair_t;
28 |
29 | static const type_str_pair_t type_str_pair[] = {
30 | { NVS_TYPE_I8, "i8" },
31 | { NVS_TYPE_U8, "u8" },
32 | { NVS_TYPE_U16, "u16" },
33 | { NVS_TYPE_I16, "i16" },
34 | { NVS_TYPE_U32, "u32" },
35 | { NVS_TYPE_I32, "i32" },
36 | { NVS_TYPE_U64, "u64" },
37 | { NVS_TYPE_I64, "i64" },
38 | { NVS_TYPE_STR, "str" },
39 | { NVS_TYPE_BLOB, "blob" },
40 | { NVS_TYPE_ANY, "any" },
41 | };
42 |
43 | static const size_t TYPE_STR_PAIR_SIZE = sizeof(type_str_pair) / sizeof(type_str_pair[0]);
44 | static const char *ARG_TYPE_STR = "type can be: i8, u8, i16, u16 i32, u32 i64, u64, str, blob";
45 | static char current_namespace[16] = "storage";
46 | static const char *TAG = "cmd_nvs";
47 |
48 | static struct {
49 | struct arg_str *key;
50 | struct arg_str *type;
51 | struct arg_str *value;
52 | struct arg_end *end;
53 | } set_args;
54 |
55 | static struct {
56 | struct arg_str *key;
57 | struct arg_str *type;
58 | struct arg_end *end;
59 | } get_args;
60 |
61 | static struct {
62 | struct arg_str *key;
63 | struct arg_end *end;
64 | } erase_args;
65 |
66 | static struct {
67 | struct arg_str *namespace;
68 | struct arg_end *end;
69 | } erase_all_args;
70 |
71 | static struct {
72 | struct arg_str *namespace;
73 | struct arg_end *end;
74 | } namespace_args;
75 |
76 | static struct {
77 | struct arg_str *partition;
78 | struct arg_str *namespace;
79 | struct arg_str *type;
80 | struct arg_end *end;
81 | } list_args;
82 |
83 |
84 | static nvs_type_t str_to_type(const char *type)
85 | {
86 | for (int i = 0; i < TYPE_STR_PAIR_SIZE; i++) {
87 | const type_str_pair_t *p = &type_str_pair[i];
88 | if (strcmp(type, p->str) == 0) {
89 | return p->type;
90 | }
91 | }
92 |
93 | return NVS_TYPE_ANY;
94 | }
95 |
96 | static const char *type_to_str(nvs_type_t type)
97 | {
98 | for (int i = 0; i < TYPE_STR_PAIR_SIZE; i++) {
99 | const type_str_pair_t *p = &type_str_pair[i];
100 | if (p->type == type) {
101 | return p->str;
102 | }
103 | }
104 |
105 | return "Unknown";
106 | }
107 |
108 | static esp_err_t store_blob(nvs_handle_t nvs, const char *key, const char *str_values)
109 | {
110 | uint8_t value;
111 | size_t str_len = strlen(str_values);
112 | size_t blob_len = str_len / 2;
113 |
114 | if (str_len % 2) {
115 | ESP_LOGE(TAG, "Blob data must contain even number of characters");
116 | return ESP_ERR_NVS_TYPE_MISMATCH;
117 | }
118 |
119 | char *blob = (char *)malloc(blob_len);
120 | if (blob == NULL) {
121 | return ESP_ERR_NO_MEM;
122 | }
123 |
124 | for (int i = 0, j = 0; i < str_len; i++) {
125 | char ch = str_values[i];
126 | if (ch >= '0' && ch <= '9') {
127 | value = ch - '0';
128 | } else if (ch >= 'A' && ch <= 'F') {
129 | value = ch - 'A' + 10;
130 | } else if (ch >= 'a' && ch <= 'f') {
131 | value = ch - 'a' + 10;
132 | } else {
133 | ESP_LOGE(TAG, "Blob data contain invalid character");
134 | free(blob);
135 | return ESP_ERR_NVS_TYPE_MISMATCH;
136 | }
137 |
138 | if (i & 1) {
139 | blob[j++] += value;
140 | } else {
141 | blob[j] = value << 4;
142 | }
143 | }
144 |
145 | esp_err_t err = nvs_set_blob(nvs, key, blob, blob_len);
146 | free(blob);
147 |
148 | if (err == ESP_OK) {
149 | err = nvs_commit(nvs);
150 | }
151 |
152 | return err;
153 | }
154 |
155 | static void print_blob(const char *blob, size_t len)
156 | {
157 | for (int i = 0; i < len; i++) {
158 | printf("%02x", blob[i]);
159 | }
160 | printf("\n");
161 | }
162 |
163 |
164 | static esp_err_t set_value_in_nvs(const char *key, const char *str_type, const char *str_value)
165 | {
166 | esp_err_t err;
167 | nvs_handle_t nvs;
168 | bool range_error = false;
169 |
170 | nvs_type_t type = str_to_type(str_type);
171 |
172 | if (type == NVS_TYPE_ANY) {
173 | ESP_LOGE(TAG, "Type '%s' is undefined", str_type);
174 | return ESP_ERR_NVS_TYPE_MISMATCH;
175 | }
176 |
177 | err = nvs_open(current_namespace, NVS_READWRITE, &nvs);
178 | if (err != ESP_OK) {
179 | return err;
180 | }
181 |
182 | if (type == NVS_TYPE_I8) {
183 | int32_t value = strtol(str_value, NULL, 0);
184 | if (value < INT8_MIN || value > INT8_MAX || errno == ERANGE) {
185 | range_error = true;
186 | } else {
187 | err = nvs_set_i8(nvs, key, (int8_t)value);
188 | }
189 | } else if (type == NVS_TYPE_U8) {
190 | uint32_t value = strtoul(str_value, NULL, 0);
191 | if (value > UINT8_MAX || errno == ERANGE) {
192 | range_error = true;
193 | } else {
194 | err = nvs_set_u8(nvs, key, (uint8_t)value);
195 | }
196 | } else if (type == NVS_TYPE_I16) {
197 | int32_t value = strtol(str_value, NULL, 0);
198 | if (value < INT16_MIN || value > INT16_MAX || errno == ERANGE) {
199 | range_error = true;
200 | } else {
201 | err = nvs_set_i16(nvs, key, (int16_t)value);
202 | }
203 | } else if (type == NVS_TYPE_U16) {
204 | uint32_t value = strtoul(str_value, NULL, 0);
205 | if (value > UINT16_MAX || errno == ERANGE) {
206 | range_error = true;
207 | } else {
208 | err = nvs_set_u16(nvs, key, (uint16_t)value);
209 | }
210 | } else if (type == NVS_TYPE_I32) {
211 | int32_t value = strtol(str_value, NULL, 0);
212 | if (errno != ERANGE) {
213 | err = nvs_set_i32(nvs, key, value);
214 | }
215 | } else if (type == NVS_TYPE_U32) {
216 | uint32_t value = strtoul(str_value, NULL, 0);
217 | if (errno != ERANGE) {
218 | err = nvs_set_u32(nvs, key, value);
219 | }
220 | } else if (type == NVS_TYPE_I64) {
221 | int64_t value = strtoll(str_value, NULL, 0);
222 | if (errno != ERANGE) {
223 | err = nvs_set_i64(nvs, key, value);
224 | }
225 | } else if (type == NVS_TYPE_U64) {
226 | uint64_t value = strtoull(str_value, NULL, 0);
227 | if (errno != ERANGE) {
228 | err = nvs_set_u64(nvs, key, value);
229 | }
230 | } else if (type == NVS_TYPE_STR) {
231 | err = nvs_set_str(nvs, key, str_value);
232 | } else if (type == NVS_TYPE_BLOB) {
233 | err = store_blob(nvs, key, str_value);
234 | }
235 |
236 | if (range_error || errno == ERANGE) {
237 | nvs_close(nvs);
238 | return ESP_ERR_NVS_VALUE_TOO_LONG;
239 | }
240 |
241 | if (err == ESP_OK) {
242 | err = nvs_commit(nvs);
243 | if (err == ESP_OK) {
244 | ESP_LOGI(TAG, "Value stored under key '%s'", key);
245 | }
246 | }
247 |
248 | nvs_close(nvs);
249 | return err;
250 | }
251 |
252 | static esp_err_t get_value_from_nvs(const char *key, const char *str_type)
253 | {
254 | nvs_handle_t nvs;
255 | esp_err_t err;
256 |
257 | nvs_type_t type = str_to_type(str_type);
258 |
259 | if (type == NVS_TYPE_ANY) {
260 | ESP_LOGE(TAG, "Type '%s' is undefined", str_type);
261 | return ESP_ERR_NVS_TYPE_MISMATCH;
262 | }
263 |
264 | err = nvs_open(current_namespace, NVS_READONLY, &nvs);
265 | if (err != ESP_OK) {
266 | return err;
267 | }
268 |
269 | if (type == NVS_TYPE_I8) {
270 | int8_t value;
271 | err = nvs_get_i8(nvs, key, &value);
272 | if (err == ESP_OK) {
273 | printf("%d\n", value);
274 | }
275 | } else if (type == NVS_TYPE_U8) {
276 | uint8_t value;
277 | err = nvs_get_u8(nvs, key, &value);
278 | if (err == ESP_OK) {
279 | printf("%u\n", value);
280 | }
281 | } else if (type == NVS_TYPE_I16) {
282 | int16_t value;
283 | err = nvs_get_i16(nvs, key, &value);
284 | if (err == ESP_OK) {
285 | printf("%u\n", value);
286 | }
287 | } else if (type == NVS_TYPE_U16) {
288 | uint16_t value;
289 | if ((err = nvs_get_u16(nvs, key, &value)) == ESP_OK) {
290 | printf("%u\n", value);
291 | }
292 | } else if (type == NVS_TYPE_I32) {
293 | int32_t value;
294 | if ((err = nvs_get_i32(nvs, key, &value)) == ESP_OK) {
295 | printf("%d\n", value);
296 | }
297 | } else if (type == NVS_TYPE_U32) {
298 | uint32_t value;
299 | if ((err = nvs_get_u32(nvs, key, &value)) == ESP_OK) {
300 | printf("%u\n", value);
301 | }
302 | } else if (type == NVS_TYPE_I64) {
303 | int64_t value;
304 | if ((err = nvs_get_i64(nvs, key, &value)) == ESP_OK) {
305 | printf("%lld\n", value);
306 | }
307 | } else if (type == NVS_TYPE_U64) {
308 | uint64_t value;
309 | if ( (err = nvs_get_u64(nvs, key, &value)) == ESP_OK) {
310 | printf("%llu\n", value);
311 | }
312 | } else if (type == NVS_TYPE_STR) {
313 | size_t len;
314 | if ( (err = nvs_get_str(nvs, key, NULL, &len)) == ESP_OK) {
315 | char *str = (char *)malloc(len);
316 | if ( (err = nvs_get_str(nvs, key, str, &len)) == ESP_OK) {
317 | printf("%s\n", str);
318 | }
319 | free(str);
320 | }
321 | } else if (type == NVS_TYPE_BLOB) {
322 | size_t len;
323 | if ( (err = nvs_get_blob(nvs, key, NULL, &len)) == ESP_OK) {
324 | char *blob = (char *)malloc(len);
325 | if ( (err = nvs_get_blob(nvs, key, blob, &len)) == ESP_OK) {
326 | print_blob(blob, len);
327 | }
328 | free(blob);
329 | }
330 | }
331 |
332 | nvs_close(nvs);
333 | return err;
334 | }
335 |
336 | static esp_err_t erase(const char *key)
337 | {
338 | nvs_handle_t nvs;
339 |
340 | esp_err_t err = nvs_open(current_namespace, NVS_READWRITE, &nvs);
341 | if (err == ESP_OK) {
342 | err = nvs_erase_key(nvs, key);
343 | if (err == ESP_OK) {
344 | err = nvs_commit(nvs);
345 | if (err == ESP_OK) {
346 | ESP_LOGI(TAG, "Value with key '%s' erased", key);
347 | }
348 | }
349 | nvs_close(nvs);
350 | }
351 |
352 | return err;
353 | }
354 |
355 | static esp_err_t erase_all(const char *name)
356 | {
357 | nvs_handle_t nvs;
358 |
359 | esp_err_t err = nvs_open(name, NVS_READWRITE, &nvs);
360 | if (err == ESP_OK) {
361 | err = nvs_erase_all(nvs);
362 | if (err == ESP_OK) {
363 | err = nvs_commit(nvs);
364 | }
365 | }
366 |
367 | ESP_LOGI(TAG, "Namespace '%s' was %s erased", name, (err == ESP_OK) ? "" : "not");
368 |
369 | nvs_close(nvs);
370 | return ESP_OK;
371 | }
372 |
373 | static int list(const char *part, const char *name, const char *str_type)
374 | {
375 | nvs_type_t type = str_to_type(str_type);
376 |
377 | nvs_iterator_t it = nvs_entry_find(part, NULL, type);
378 | if (it == NULL) {
379 | ESP_LOGE(TAG, "No such enty was found");
380 | return 1;
381 | }
382 |
383 | do {
384 | nvs_entry_info_t info;
385 | nvs_entry_info(it, &info);
386 | it = nvs_entry_next(it);
387 |
388 | printf("namespace '%s', key '%s', type '%s' \n",
389 | info.namespace_name, info.key, type_to_str(info.type));
390 | } while (it != NULL);
391 |
392 | return 0;
393 | }
394 |
395 | static int set_value(int argc, char **argv)
396 | {
397 | int nerrors = arg_parse(argc, argv, (void **) &set_args);
398 | if (nerrors != 0) {
399 | arg_print_errors(stderr, set_args.end, argv[0]);
400 | return 1;
401 | }
402 |
403 | const char *key = set_args.key->sval[0];
404 | const char *type = set_args.type->sval[0];
405 | const char *values = set_args.value->sval[0];
406 |
407 | esp_err_t err = set_value_in_nvs(key, type, values);
408 |
409 | if (err != ESP_OK) {
410 | ESP_LOGE(TAG, "%s", esp_err_to_name(err));
411 | return 1;
412 | }
413 |
414 | return 0;
415 | }
416 |
417 | static int get_value(int argc, char **argv)
418 | {
419 | int nerrors = arg_parse(argc, argv, (void **) &get_args);
420 | if (nerrors != 0) {
421 | arg_print_errors(stderr, get_args.end, argv[0]);
422 | return 1;
423 | }
424 |
425 | const char *key = get_args.key->sval[0];
426 | const char *type = get_args.type->sval[0];
427 |
428 | esp_err_t err = get_value_from_nvs(key, type);
429 |
430 | if (err != ESP_OK) {
431 | ESP_LOGE(TAG, "%s", esp_err_to_name(err));
432 | return 1;
433 | }
434 |
435 | return 0;
436 | }
437 |
438 | static int erase_value(int argc, char **argv)
439 | {
440 | int nerrors = arg_parse(argc, argv, (void **) &erase_args);
441 | if (nerrors != 0) {
442 | arg_print_errors(stderr, erase_args.end, argv[0]);
443 | return 1;
444 | }
445 |
446 | const char *key = erase_args.key->sval[0];
447 |
448 | esp_err_t err = erase(key);
449 |
450 | if (err != ESP_OK) {
451 | ESP_LOGE(TAG, "%s", esp_err_to_name(err));
452 | return 1;
453 | }
454 |
455 | return 0;
456 | }
457 |
458 | static int erase_namespace(int argc, char **argv)
459 | {
460 | int nerrors = arg_parse(argc, argv, (void **) &erase_all_args);
461 | if (nerrors != 0) {
462 | arg_print_errors(stderr, erase_all_args.end, argv[0]);
463 | return 1;
464 | }
465 |
466 | const char *name = erase_all_args.namespace->sval[0];
467 |
468 | esp_err_t err = erase_all(name);
469 | if (err != ESP_OK) {
470 | ESP_LOGE(TAG, "%s", esp_err_to_name(err));
471 | return 1;
472 | }
473 |
474 | return 0;
475 | }
476 |
477 | static int set_namespace(int argc, char **argv)
478 | {
479 | int nerrors = arg_parse(argc, argv, (void **) &namespace_args);
480 | if (nerrors != 0) {
481 | arg_print_errors(stderr, namespace_args.end, argv[0]);
482 | return 1;
483 | }
484 |
485 | const char *namespace = namespace_args.namespace->sval[0];
486 | strlcpy(current_namespace, namespace, sizeof(current_namespace));
487 | ESP_LOGI(TAG, "Namespace set to '%s'", current_namespace);
488 | return 0;
489 | }
490 |
491 | static int list_entries(int argc, char **argv)
492 | {
493 | list_args.partition->sval[0] = "";
494 | list_args.namespace->sval[0] = "";
495 | list_args.type->sval[0] = "";
496 |
497 | int nerrors = arg_parse(argc, argv, (void **) &list_args);
498 | if (nerrors != 0) {
499 | arg_print_errors(stderr, list_args.end, argv[0]);
500 | return 1;
501 | }
502 |
503 | const char *part = list_args.partition->sval[0];
504 | const char *name = list_args.namespace->sval[0];
505 | const char *type = list_args.type->sval[0];
506 |
507 | return list(part, name, type);
508 | }
509 |
510 | void register_nvs(void)
511 | {
512 | set_args.key = arg_str1(NULL, NULL, "", "key of the value to be set");
513 | set_args.type = arg_str1(NULL, NULL, "", ARG_TYPE_STR);
514 |
515 | set_args.value = arg_str1("v", "value", "", "value to be stored");
516 | set_args.end = arg_end(2);
517 |
518 | get_args.key = arg_str1(NULL, NULL, "", "key of the value to be read");
519 | get_args.type = arg_str1(NULL, NULL, "", ARG_TYPE_STR);
520 | get_args.end = arg_end(2);
521 |
522 | erase_args.key = arg_str1(NULL, NULL, "", "key of the value to be erased");
523 | erase_args.end = arg_end(2);
524 |
525 | erase_all_args.namespace = arg_str1(NULL, NULL, "", "namespace to be erased");
526 | erase_all_args.end = arg_end(2);
527 |
528 | namespace_args.namespace = arg_str1(NULL, NULL, "", "namespace of the partition to be selected");
529 | namespace_args.end = arg_end(2);
530 |
531 | list_args.partition = arg_str1(NULL, NULL, "", "partition name");
532 | list_args.namespace = arg_str0("n", "namespace", "", "namespace name");
533 | list_args.type = arg_str0("t", "type", "", ARG_TYPE_STR);
534 | list_args.end = arg_end(2);
535 |
536 | const esp_console_cmd_t set_cmd = {
537 | .command = "nvs_set",
538 | .help = "Set key-value pair in selected namespace.\n"
539 | "Examples:\n"
540 | " nvs_set VarName i32 -v 123 \n"
541 | " nvs_set VarName str -v YourString \n"
542 | " nvs_set VarName blob -v 0123456789abcdef \n",
543 | .hint = NULL,
544 | .func = &set_value,
545 | .argtable = &set_args
546 | };
547 |
548 | const esp_console_cmd_t get_cmd = {
549 | .command = "nvs_get",
550 | .help = "Get key-value pair from selected namespace. \n"
551 | "Example: nvs_get VarName i32",
552 | .hint = NULL,
553 | .func = &get_value,
554 | .argtable = &get_args
555 | };
556 |
557 | const esp_console_cmd_t erase_cmd = {
558 | .command = "nvs_erase",
559 | .help = "Erase key-value pair from current namespace",
560 | .hint = NULL,
561 | .func = &erase_value,
562 | .argtable = &erase_args
563 | };
564 |
565 | const esp_console_cmd_t erase_namespace_cmd = {
566 | .command = "nvs_erase_namespace",
567 | .help = "Erases specified namespace",
568 | .hint = NULL,
569 | .func = &erase_namespace,
570 | .argtable = &erase_all_args
571 | };
572 |
573 | const esp_console_cmd_t namespace_cmd = {
574 | .command = "nvs_namespace",
575 | .help = "Set current namespace",
576 | .hint = NULL,
577 | .func = &set_namespace,
578 | .argtable = &namespace_args
579 | };
580 |
581 | const esp_console_cmd_t list_entries_cmd = {
582 | .command = "nvs_list",
583 | .help = "List stored key-value pairs stored in NVS."
584 | "Namespace and type can be specified to print only those key-value pairs.\n"
585 | "Following command list variables stored inside 'nvs' partition, under namespace 'storage' with type uint32_t"
586 | "Example: nvs_list nvs -n storage -t u32 \n",
587 | .hint = NULL,
588 | .func = &list_entries,
589 | .argtable = &list_args
590 | };
591 |
592 | ESP_ERROR_CHECK(esp_console_cmd_register(&set_cmd));
593 | ESP_ERROR_CHECK(esp_console_cmd_register(&get_cmd));
594 | ESP_ERROR_CHECK(esp_console_cmd_register(&erase_cmd));
595 | ESP_ERROR_CHECK(esp_console_cmd_register(&namespace_cmd));
596 | ESP_ERROR_CHECK(esp_console_cmd_register(&list_entries_cmd));
597 | ESP_ERROR_CHECK(esp_console_cmd_register(&erase_namespace_cmd));
598 | }
599 |
--------------------------------------------------------------------------------
/components/cmd_nvs/cmd_nvs.h:
--------------------------------------------------------------------------------
1 | /* Console example — declarations of command registration functions.
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 | #pragma once
10 |
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 | // Register NVS functions
16 | void register_nvs(void);
17 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 |
22 |
--------------------------------------------------------------------------------
/components/cmd_nvs/component.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Component Makefile
3 | #
4 | # This Makefile should, at the very least, just include $(SDK_PATH)/Makefile. By default,
5 | # this will take the sources in the src/ directory, compile them and link them into
6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
7 | # please read the SDK documents if you need to do this.
8 | #
9 |
10 | COMPONENT_ADD_INCLUDEDIRS := .
11 |
--------------------------------------------------------------------------------
/components/cmd_router/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | idf_component_register(SRCS "cmd_router.c"
2 | INCLUDE_DIRS .
3 | REQUIRES console nvs_flash)
4 |
--------------------------------------------------------------------------------
/components/cmd_router/cmd_router.c:
--------------------------------------------------------------------------------
1 | /* The CLI commands of the router
2 |
3 | Unless required by applicable law or agreed to in writing, this
4 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
5 | CONDITIONS OF ANY KIND, either express or implied.
6 | */
7 |
8 | #include
9 | #include
10 | #include
11 | #include "esp_log.h"
12 | #include "esp_console.h"
13 | #include "esp_system.h"
14 | #include "esp_sleep.h"
15 | #include "esp_spi_flash.h"
16 | #include "driver/rtc_io.h"
17 | #include "driver/uart.h"
18 | #include "argtable3/argtable3.h"
19 | #include "freertos/FreeRTOS.h"
20 | #include "freertos/task.h"
21 | #include "sdkconfig.h"
22 | #include "nvs.h"
23 |
24 | #include "router_globals.h"
25 | #include "cmd_router.h"
26 |
27 | #ifdef CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
28 | #define WITH_TASKS_INFO 1
29 | #endif
30 |
31 | static const char *TAG = "cmd_router";
32 |
33 | static void register_set_sta(void);
34 | static void register_set_ap(void);
35 | static void register_show(void);
36 |
37 | void preprocess_string(char* str)
38 | {
39 | char *p, *q;
40 |
41 | for (p = q = str; *p != 0; p++)
42 | {
43 | if (*(p) == '%' && *(p + 1) != 0 && *(p + 2) != 0)
44 | {
45 | // quoted hex
46 | uint8_t a;
47 | p++;
48 | if (*p <= '9')
49 | a = *p - '0';
50 | else
51 | a = toupper(*p) - 'A' + 10;
52 | a <<= 4;
53 | p++;
54 | if (*p <= '9')
55 | a += *p - '0';
56 | else
57 | a += toupper(*p) - 'A' + 10;
58 | *q++ = a;
59 | }
60 | else if (*(p) == '+') {
61 | *q++ = ' ';
62 | } else {
63 | *q++ = *p;
64 | }
65 | }
66 | *q = '\0';
67 | }
68 |
69 | esp_err_t get_config_param_str(char* name, char** param)
70 | {
71 | nvs_handle_t nvs;
72 |
73 | esp_err_t err = nvs_open(PARAM_NAMESPACE, NVS_READONLY, &nvs);
74 | if (err == ESP_OK) {
75 | size_t len;
76 | if ( (err = nvs_get_str(nvs, name, NULL, &len)) == ESP_OK) {
77 | *param = (char *)malloc(len);
78 | err = nvs_get_str(nvs, name, *param, &len);
79 | ESP_LOGI(TAG, "%s %s", name, *param);
80 | } else {
81 | return err;
82 | }
83 | nvs_close(nvs);
84 | } else {
85 | return err;
86 | }
87 | return ESP_OK;
88 | }
89 |
90 | esp_err_t get_config_param_int(char* name, int* param)
91 | {
92 | nvs_handle_t nvs;
93 |
94 | esp_err_t err = nvs_open(PARAM_NAMESPACE, NVS_READONLY, &nvs);
95 | if (err == ESP_OK) {
96 | if ( (err = nvs_get_i32(nvs, name, param)) == ESP_OK) {
97 | ESP_LOGI(TAG, "%s %d", name, *param);
98 | } else {
99 | return err;
100 | }
101 | nvs_close(nvs);
102 | } else {
103 | return err;
104 | }
105 | return ESP_OK;
106 | }
107 |
108 | void register_router(void)
109 | {
110 | register_set_sta();
111 | register_set_ap();
112 | register_show();
113 | }
114 |
115 | /** Arguments used by 'set_ap' function */
116 | static struct {
117 | struct arg_str *ssid;
118 | struct arg_str *password;
119 | struct arg_end *end;
120 | } set_sta_arg;
121 |
122 | /* 'set_sta' command */
123 | int set_sta(int argc, char **argv)
124 | {
125 | esp_err_t err;
126 | nvs_handle_t nvs;
127 |
128 | int nerrors = arg_parse(argc, argv, (void **) &set_sta_arg);
129 | if (nerrors != 0) {
130 | arg_print_errors(stderr, set_sta_arg.end, argv[0]);
131 | return 1;
132 | }
133 |
134 | preprocess_string((char*)set_sta_arg.ssid->sval[0]);
135 | preprocess_string((char*)set_sta_arg.password->sval[0]);
136 |
137 | err = nvs_open(PARAM_NAMESPACE, NVS_READWRITE, &nvs);
138 | if (err != ESP_OK) {
139 | return err;
140 | }
141 |
142 | err = nvs_set_str(nvs, "ssid", set_sta_arg.ssid->sval[0]);
143 | if (err == ESP_OK) {
144 | err = nvs_set_str(nvs, "passwd", set_sta_arg.password->sval[0]);
145 | if (err == ESP_OK) {
146 | err = nvs_commit(nvs);
147 | if (err == ESP_OK) {
148 | ESP_LOGI(TAG, "STA settings %s/%s stored.", set_sta_arg.ssid->sval[0], set_sta_arg.password->sval[0]);
149 | }
150 | }
151 | }
152 | nvs_close(nvs);
153 | return err;
154 | }
155 |
156 | static void register_set_sta(void)
157 | {
158 | set_sta_arg.ssid = arg_str1(NULL, NULL, "", "SSID");
159 | set_sta_arg.password = arg_str1(NULL, NULL, "", "Password");
160 | set_sta_arg.end = arg_end(2);
161 |
162 | const esp_console_cmd_t cmd = {
163 | .command = "set_sta",
164 | .help = "Set SSID and password of the STA interface",
165 | .hint = NULL,
166 | .func = &set_sta,
167 | .argtable = &set_sta_arg
168 | };
169 | ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
170 | }
171 |
172 | /** Arguments used by 'set_ap' function */
173 | static struct {
174 | struct arg_str *ssid;
175 | struct arg_str *password;
176 | struct arg_end *end;
177 | } set_ap_args;
178 |
179 | /* 'set_ap' command */
180 | int set_ap(int argc, char **argv)
181 | {
182 | esp_err_t err;
183 | nvs_handle_t nvs;
184 |
185 | int nerrors = arg_parse(argc, argv, (void **) &set_ap_args);
186 | if (nerrors != 0) {
187 | arg_print_errors(stderr, set_ap_args.end, argv[0]);
188 | return 1;
189 | }
190 |
191 | preprocess_string((char*)set_ap_args.ssid->sval[0]);
192 | preprocess_string((char*)set_ap_args.password->sval[0]);
193 |
194 | if (strlen(set_ap_args.password->sval[0]) < 8) {
195 | printf("AP will be open (no passwd needed).\n");
196 | }
197 |
198 | err = nvs_open(PARAM_NAMESPACE, NVS_READWRITE, &nvs);
199 | if (err != ESP_OK) {
200 | return err;
201 | }
202 |
203 | err = nvs_set_str(nvs, "ap_ssid", set_ap_args.ssid->sval[0]);
204 | if (err == ESP_OK) {
205 | err = nvs_set_str(nvs, "ap_passwd", set_ap_args.password->sval[0]);
206 | if (err == ESP_OK) {
207 | err = nvs_commit(nvs);
208 | if (err == ESP_OK) {
209 | ESP_LOGI(TAG, "AP settings %s/%s stored.", set_ap_args.ssid->sval[0], set_ap_args.password->sval[0]);
210 | }
211 | }
212 | }
213 | nvs_close(nvs);
214 | return err;
215 | }
216 |
217 | static void register_set_ap(void)
218 | {
219 | set_ap_args.ssid = arg_str1(NULL, NULL, "", "SSID of AP");
220 | set_ap_args.password = arg_str1(NULL, NULL, "", "Password of AP");
221 | set_ap_args.end = arg_end(2);
222 |
223 | const esp_console_cmd_t cmd = {
224 | .command = "set_ap",
225 | .help = "Set SSID and password of the SoftAP",
226 | .hint = NULL,
227 | .func = &set_ap,
228 | .argtable = &set_ap_args
229 | };
230 | ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
231 | }
232 |
233 | /* 'show' command */
234 | static int show(int argc, char **argv)
235 | {
236 | char* ssid = NULL;
237 | char* passwd = NULL;
238 | char* ap_ssid = NULL;
239 | char* ap_passwd = NULL;
240 |
241 | get_config_param_str("ssid", &ssid);
242 | get_config_param_str("passwd", &passwd);
243 | get_config_param_str("ap_ssid", &ap_ssid);
244 | get_config_param_str("ap_passwd", &ap_passwd);
245 |
246 | printf("STA SSID: %s Password: %s\n", ssid != NULL?ssid:"",
247 | passwd != NULL?passwd:"");
248 | printf("AP SSID: %s Password: %s\n", ap_ssid != NULL?ap_ssid:"",
249 | ap_passwd != NULL?ap_passwd:"");
250 |
251 | if (ssid != NULL) free (ssid);
252 | if (passwd != NULL) free (passwd);
253 | if (ap_ssid != NULL) free (ap_ssid);
254 | if (ap_passwd != NULL) free (ap_passwd);
255 |
256 | printf("Uplink AP %sconnected\n", ap_connect?"":"not ");
257 | printf("%d Stations connected\n", connect_count);
258 |
259 | return 0;
260 | }
261 |
262 | static void register_show(void)
263 | {
264 | const esp_console_cmd_t cmd = {
265 | .command = "show",
266 | .help = "Get status and config of the router",
267 | .hint = NULL,
268 | .func = &show,
269 | };
270 | ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
271 | }
--------------------------------------------------------------------------------
/components/cmd_router/cmd_router.h:
--------------------------------------------------------------------------------
1 | /* Console example — various router commands
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 | #pragma once
10 |
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 | // Register router functions
16 | void register_router(void);
17 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 |
--------------------------------------------------------------------------------
/components/cmd_router/component.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Component Makefile
3 | #
4 | # This Makefile should, at the very least, just include $(SDK_PATH)/Makefile. By default,
5 | # this will take the sources in the src/ directory, compile them and link them into
6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
7 | # please read the SDK documents if you need to do this.
8 | #
9 |
10 | COMPONENT_ADD_INCLUDEDIRS := .
11 |
--------------------------------------------------------------------------------
/components/cmd_router/router_globals.h:
--------------------------------------------------------------------------------
1 | /* Various global declarations for the esp32_nat_router
2 |
3 | Unless required by applicable law or agreed to in writing, this
4 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
5 | CONDITIONS OF ANY KIND, either express or implied.
6 | */
7 | #pragma once
8 |
9 | #ifdef __cplusplus
10 | extern "C" {
11 | #endif
12 |
13 | #define PARAM_NAMESPACE "esp32_nat"
14 |
15 | extern uint16_t connect_count;
16 | extern bool ap_connect;
17 |
18 | esp_err_t get_config_param_int(char* name, int* param);
19 | esp_err_t get_config_param_str(char* name, char** param);
20 |
21 | #ifdef __cplusplus
22 | }
23 | #endif
24 |
--------------------------------------------------------------------------------
/components/cmd_system/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | idf_component_register(SRCS "cmd_system.c"
2 | INCLUDE_DIRS .
3 | REQUIRES console spi_flash)
--------------------------------------------------------------------------------
/components/cmd_system/cmd_system.c:
--------------------------------------------------------------------------------
1 | /* Console example — various system commands
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 |
10 | #include
11 | #include
12 | #include
13 | #include "esp_log.h"
14 | #include "esp_console.h"
15 | #include "esp_system.h"
16 | #include "esp_sleep.h"
17 | #include "esp_spi_flash.h"
18 | #include "driver/rtc_io.h"
19 | #include "driver/uart.h"
20 | #include "argtable3/argtable3.h"
21 | #include "freertos/FreeRTOS.h"
22 | #include "freertos/task.h"
23 | #include "cmd_system.h"
24 | #include "sdkconfig.h"
25 |
26 | #ifdef CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS
27 | #define WITH_TASKS_INFO 1
28 | #endif
29 |
30 | static const char *TAG = "cmd_system";
31 |
32 | static void register_free(void);
33 | static void register_heap(void);
34 | static void register_version(void);
35 | static void register_restart(void);
36 | static void register_deep_sleep(void);
37 | static void register_light_sleep(void);
38 | #if WITH_TASKS_INFO
39 | static void register_tasks(void);
40 | #endif
41 |
42 | void register_system(void)
43 | {
44 | register_free();
45 | register_heap();
46 | register_version();
47 | register_restart();
48 | register_deep_sleep();
49 | register_light_sleep();
50 | #if WITH_TASKS_INFO
51 | register_tasks();
52 | #endif
53 | }
54 |
55 | /* 'version' command */
56 | static int get_version(int argc, char **argv)
57 | {
58 | esp_chip_info_t info;
59 | esp_chip_info(&info);
60 | printf("IDF Version:%s\r\n", esp_get_idf_version());
61 | printf("Chip info:\r\n");
62 | printf("\tmodel:%s\r\n", info.model == CHIP_ESP32 ? "ESP32" : "Unknow");
63 | printf("\tcores:%d\r\n", info.cores);
64 | printf("\tfeature:%s%s%s%s%d%s\r\n",
65 | info.features & CHIP_FEATURE_WIFI_BGN ? "/802.11bgn" : "",
66 | info.features & CHIP_FEATURE_BLE ? "/BLE" : "",
67 | info.features & CHIP_FEATURE_BT ? "/BT" : "",
68 | info.features & CHIP_FEATURE_EMB_FLASH ? "/Embedded-Flash:" : "/External-Flash:",
69 | spi_flash_get_chip_size() / (1024 * 1024), " MB");
70 | printf("\trevision number:%d\r\n", info.revision);
71 | return 0;
72 | }
73 |
74 | static void register_version(void)
75 | {
76 | const esp_console_cmd_t cmd = {
77 | .command = "version",
78 | .help = "Get version of chip and SDK",
79 | .hint = NULL,
80 | .func = &get_version,
81 | };
82 | ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
83 | }
84 |
85 | /** 'restart' command restarts the program */
86 |
87 | static int restart(int argc, char **argv)
88 | {
89 | ESP_LOGI(TAG, "Restarting");
90 | esp_restart();
91 | }
92 |
93 | static void register_restart(void)
94 | {
95 | const esp_console_cmd_t cmd = {
96 | .command = "restart",
97 | .help = "Software reset of the chip",
98 | .hint = NULL,
99 | .func = &restart,
100 | };
101 | ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
102 | }
103 |
104 | /** 'free' command prints available heap memory */
105 |
106 | static int free_mem(int argc, char **argv)
107 | {
108 | printf("%d\n", esp_get_free_heap_size());
109 | return 0;
110 | }
111 |
112 | static void register_free(void)
113 | {
114 | const esp_console_cmd_t cmd = {
115 | .command = "free",
116 | .help = "Get the current size of free heap memory",
117 | .hint = NULL,
118 | .func = &free_mem,
119 | };
120 | ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
121 | }
122 |
123 | /* 'heap' command prints minumum heap size */
124 | static int heap_size(int argc, char **argv)
125 | {
126 | uint32_t heap_size = heap_caps_get_minimum_free_size(MALLOC_CAP_DEFAULT);
127 | ESP_LOGI(TAG, "min heap size: %u", heap_size);
128 | return 0;
129 | }
130 |
131 | static void register_heap(void)
132 | {
133 | const esp_console_cmd_t heap_cmd = {
134 | .command = "heap",
135 | .help = "Get minimum size of free heap memory that was available during program execution",
136 | .hint = NULL,
137 | .func = &heap_size,
138 | };
139 | ESP_ERROR_CHECK( esp_console_cmd_register(&heap_cmd) );
140 |
141 | }
142 |
143 | /** 'tasks' command prints the list of tasks and related information */
144 | #if WITH_TASKS_INFO
145 |
146 | static int tasks_info(int argc, char **argv)
147 | {
148 | const size_t bytes_per_task = 40; /* see vTaskList description */
149 | char *task_list_buffer = malloc(uxTaskGetNumberOfTasks() * bytes_per_task);
150 | if (task_list_buffer == NULL) {
151 | ESP_LOGE(TAG, "failed to allocate buffer for vTaskList output");
152 | return 1;
153 | }
154 | fputs("Task Name\tStatus\tPrio\tHWM\tTask#", stdout);
155 | #ifdef CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID
156 | fputs("\tAffinity", stdout);
157 | #endif
158 | fputs("\n", stdout);
159 | vTaskList(task_list_buffer);
160 | fputs(task_list_buffer, stdout);
161 | free(task_list_buffer);
162 | return 0;
163 | }
164 |
165 | static void register_tasks(void)
166 | {
167 | const esp_console_cmd_t cmd = {
168 | .command = "tasks",
169 | .help = "Get information about running tasks",
170 | .hint = NULL,
171 | .func = &tasks_info,
172 | };
173 | ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
174 | }
175 |
176 | #endif // WITH_TASKS_INFO
177 |
178 | /** 'deep_sleep' command puts the chip into deep sleep mode */
179 |
180 | static struct {
181 | struct arg_int *wakeup_time;
182 | struct arg_int *wakeup_gpio_num;
183 | struct arg_int *wakeup_gpio_level;
184 | struct arg_end *end;
185 | } deep_sleep_args;
186 |
187 |
188 | static int deep_sleep(int argc, char **argv)
189 | {
190 | int nerrors = arg_parse(argc, argv, (void **) &deep_sleep_args);
191 | if (nerrors != 0) {
192 | arg_print_errors(stderr, deep_sleep_args.end, argv[0]);
193 | return 1;
194 | }
195 | if (deep_sleep_args.wakeup_time->count) {
196 | uint64_t timeout = 1000ULL * deep_sleep_args.wakeup_time->ival[0];
197 | ESP_LOGI(TAG, "Enabling timer wakeup, timeout=%lluus", timeout);
198 | ESP_ERROR_CHECK( esp_sleep_enable_timer_wakeup(timeout) );
199 | }
200 | if (deep_sleep_args.wakeup_gpio_num->count) {
201 | int io_num = deep_sleep_args.wakeup_gpio_num->ival[0];
202 | if (!rtc_gpio_is_valid_gpio(io_num)) {
203 | ESP_LOGE(TAG, "GPIO %d is not an RTC IO", io_num);
204 | return 1;
205 | }
206 | int level = 0;
207 | if (deep_sleep_args.wakeup_gpio_level->count) {
208 | level = deep_sleep_args.wakeup_gpio_level->ival[0];
209 | if (level != 0 && level != 1) {
210 | ESP_LOGE(TAG, "Invalid wakeup level: %d", level);
211 | return 1;
212 | }
213 | }
214 | ESP_LOGI(TAG, "Enabling wakeup on GPIO%d, wakeup on %s level",
215 | io_num, level ? "HIGH" : "LOW");
216 |
217 | ESP_ERROR_CHECK( esp_sleep_enable_ext1_wakeup(1ULL << io_num, level) );
218 | }
219 | rtc_gpio_isolate(GPIO_NUM_12);
220 | esp_deep_sleep_start();
221 | }
222 |
223 | static void register_deep_sleep(void)
224 | {
225 | deep_sleep_args.wakeup_time =
226 | arg_int0("t", "time", "", "Wake up time, ms");
227 | deep_sleep_args.wakeup_gpio_num =
228 | arg_int0(NULL, "io", "",
229 | "If specified, wakeup using GPIO with given number");
230 | deep_sleep_args.wakeup_gpio_level =
231 | arg_int0(NULL, "io_level", "<0|1>", "GPIO level to trigger wakeup");
232 | deep_sleep_args.end = arg_end(3);
233 |
234 | const esp_console_cmd_t cmd = {
235 | .command = "deep_sleep",
236 | .help = "Enter deep sleep mode. "
237 | "Two wakeup modes are supported: timer and GPIO. "
238 | "If no wakeup option is specified, will sleep indefinitely.",
239 | .hint = NULL,
240 | .func = &deep_sleep,
241 | .argtable = &deep_sleep_args
242 | };
243 | ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
244 | }
245 |
246 | /** 'light_sleep' command puts the chip into light sleep mode */
247 |
248 | static struct {
249 | struct arg_int *wakeup_time;
250 | struct arg_int *wakeup_gpio_num;
251 | struct arg_int *wakeup_gpio_level;
252 | struct arg_end *end;
253 | } light_sleep_args;
254 |
255 | static int light_sleep(int argc, char **argv)
256 | {
257 | int nerrors = arg_parse(argc, argv, (void **) &light_sleep_args);
258 | if (nerrors != 0) {
259 | arg_print_errors(stderr, light_sleep_args.end, argv[0]);
260 | return 1;
261 | }
262 | esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_ALL);
263 | if (light_sleep_args.wakeup_time->count) {
264 | uint64_t timeout = 1000ULL * light_sleep_args.wakeup_time->ival[0];
265 | ESP_LOGI(TAG, "Enabling timer wakeup, timeout=%lluus", timeout);
266 | ESP_ERROR_CHECK( esp_sleep_enable_timer_wakeup(timeout) );
267 | }
268 | int io_count = light_sleep_args.wakeup_gpio_num->count;
269 | if (io_count != light_sleep_args.wakeup_gpio_level->count) {
270 | ESP_LOGE(TAG, "Should have same number of 'io' and 'io_level' arguments");
271 | return 1;
272 | }
273 | for (int i = 0; i < io_count; ++i) {
274 | int io_num = light_sleep_args.wakeup_gpio_num->ival[i];
275 | int level = light_sleep_args.wakeup_gpio_level->ival[i];
276 | if (level != 0 && level != 1) {
277 | ESP_LOGE(TAG, "Invalid wakeup level: %d", level);
278 | return 1;
279 | }
280 | ESP_LOGI(TAG, "Enabling wakeup on GPIO%d, wakeup on %s level",
281 | io_num, level ? "HIGH" : "LOW");
282 |
283 | ESP_ERROR_CHECK( gpio_wakeup_enable(io_num, level ? GPIO_INTR_HIGH_LEVEL : GPIO_INTR_LOW_LEVEL) );
284 | }
285 | if (io_count > 0) {
286 | ESP_ERROR_CHECK( esp_sleep_enable_gpio_wakeup() );
287 | }
288 | if (CONFIG_ESP_CONSOLE_UART_NUM <= UART_NUM_1) {
289 | ESP_LOGI(TAG, "Enabling UART wakeup (press ENTER to exit light sleep)");
290 | ESP_ERROR_CHECK( uart_set_wakeup_threshold(CONFIG_ESP_CONSOLE_UART_NUM, 3) );
291 | ESP_ERROR_CHECK( esp_sleep_enable_uart_wakeup(CONFIG_ESP_CONSOLE_UART_NUM) );
292 | }
293 | fflush(stdout);
294 | uart_wait_tx_idle_polling(CONFIG_ESP_CONSOLE_UART_NUM);
295 | esp_light_sleep_start();
296 | esp_sleep_wakeup_cause_t cause = esp_sleep_get_wakeup_cause();
297 | const char *cause_str;
298 | switch (cause) {
299 | case ESP_SLEEP_WAKEUP_GPIO:
300 | cause_str = "GPIO";
301 | break;
302 | case ESP_SLEEP_WAKEUP_UART:
303 | cause_str = "UART";
304 | break;
305 | case ESP_SLEEP_WAKEUP_TIMER:
306 | cause_str = "timer";
307 | break;
308 | default:
309 | cause_str = "unknown";
310 | printf("%d\n", cause);
311 | }
312 | ESP_LOGI(TAG, "Woke up from: %s", cause_str);
313 | return 0;
314 | }
315 |
316 | static void register_light_sleep(void)
317 | {
318 | light_sleep_args.wakeup_time =
319 | arg_int0("t", "time", "", "Wake up time, ms");
320 | light_sleep_args.wakeup_gpio_num =
321 | arg_intn(NULL, "io", "", 0, 8,
322 | "If specified, wakeup using GPIO with given number");
323 | light_sleep_args.wakeup_gpio_level =
324 | arg_intn(NULL, "io_level", "<0|1>", 0, 8, "GPIO level to trigger wakeup");
325 | light_sleep_args.end = arg_end(3);
326 |
327 | const esp_console_cmd_t cmd = {
328 | .command = "light_sleep",
329 | .help = "Enter light sleep mode. "
330 | "Two wakeup modes are supported: timer and GPIO. "
331 | "Multiple GPIO pins can be specified using pairs of "
332 | "'io' and 'io_level' arguments. "
333 | "Will also wake up on UART input.",
334 | .hint = NULL,
335 | .func = &light_sleep,
336 | .argtable = &light_sleep_args
337 | };
338 | ESP_ERROR_CHECK( esp_console_cmd_register(&cmd) );
339 | }
340 |
341 |
--------------------------------------------------------------------------------
/components/cmd_system/cmd_system.h:
--------------------------------------------------------------------------------
1 | /* Console example — various system commands
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 | #pragma once
10 |
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 | // Register system functions
16 | void register_system(void);
17 |
18 | #ifdef __cplusplus
19 | }
20 | #endif
21 |
--------------------------------------------------------------------------------
/components/cmd_system/component.mk:
--------------------------------------------------------------------------------
1 | #
2 | # Component Makefile
3 | #
4 | # This Makefile should, at the very least, just include $(SDK_PATH)/Makefile. By default,
5 | # this will take the sources in the src/ directory, compile them and link them into
6 | # lib(subdirectory_name).a in the build directory. This behaviour is entirely configurable,
7 | # please read the SDK documents if you need to do this.
8 | #
9 |
10 | COMPONENT_ADD_INCLUDEDIRS := .
11 |
--------------------------------------------------------------------------------
/main/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | idf_component_register(SRCS "esp32_nat_router.c"
2 | "http_server.c"
3 | INCLUDE_DIRS ".")
4 |
--------------------------------------------------------------------------------
/main/Kconfig.projbuild:
--------------------------------------------------------------------------------
1 | menu "Example Configuration"
2 |
3 | config STORE_HISTORY
4 | bool "Store command history in flash"
5 | default y
6 | help
7 | Linenoise line editing library provides functions to save and load
8 | command history. If this option is enabled, initalizes a FAT filesystem
9 | and uses it to store command history.
10 |
11 | endmenu
--------------------------------------------------------------------------------
/main/cmd_decl.h:
--------------------------------------------------------------------------------
1 | /* Declarations of command registration functions.
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 | #pragma once
10 |
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 | #include "cmd_system.h"
16 | #include "cmd_nvs.h"
17 | #include "cmd_router.h"
18 |
19 | #ifdef __cplusplus
20 | }
21 | #endif
22 |
--------------------------------------------------------------------------------
/main/component.mk:
--------------------------------------------------------------------------------
1 | #
2 | # "main" pseudo-component makefile.
3 | #
4 | # (Uses default behaviour of compiling all source files in directory, adding 'include' to include path.)
5 |
6 |
--------------------------------------------------------------------------------
/main/esp32_nat_router.c:
--------------------------------------------------------------------------------
1 | /* Console example
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 |
10 | #include
11 | #include
12 | #include "esp_system.h"
13 | #include "esp_log.h"
14 | #include "esp_console.h"
15 | #include "esp_vfs_dev.h"
16 | #include "driver/uart.h"
17 | #include "linenoise/linenoise.h"
18 | #include "argtable3/argtable3.h"
19 | #include "esp_vfs_fat.h"
20 | #include "nvs.h"
21 | #include "nvs_flash.h"
22 |
23 | #include "freertos/event_groups.h"
24 | #include "esp_wifi.h"
25 |
26 | #include "lwip/opt.h"
27 | #include "lwip/err.h"
28 | #include "lwip/sys.h"
29 |
30 | #include "cmd_decl.h"
31 | #include "router_globals.h"
32 | #include
33 |
34 | #if IP_NAPT
35 | #include "lwip/lwip_napt.h"
36 | #endif
37 |
38 | #include "esp32_nat_router.h"
39 |
40 | /* FreeRTOS event group to signal when we are connected*/
41 | static EventGroupHandle_t wifi_event_group;
42 |
43 | /* The event group allows multiple bits for each event, but we only care about one event
44 | * - are we connected to the AP with an IP? */
45 | const int WIFI_CONNECTED_BIT = BIT0;
46 |
47 | #define MY_DNS_IP_ADDR 0x08080808 // 8.8.8.8
48 |
49 | uint16_t connect_count = 0;
50 | bool ap_connect = false;
51 |
52 | static const char *TAG = "ESP32 NAT router";
53 |
54 | /* Console command history can be stored to and loaded from a file.
55 | * The easiest way to do this is to use FATFS filesystem on top of
56 | * wear_levelling library.
57 | */
58 | #if CONFIG_STORE_HISTORY
59 |
60 | #define MOUNT_PATH "/data"
61 | #define HISTORY_PATH MOUNT_PATH "/history.txt"
62 |
63 | static void initialize_filesystem(void)
64 | {
65 | static wl_handle_t wl_handle;
66 | const esp_vfs_fat_mount_config_t mount_config = {
67 | .max_files = 4,
68 | .format_if_mount_failed = true
69 | };
70 | esp_err_t err = esp_vfs_fat_spiflash_mount(MOUNT_PATH, "storage", &mount_config, &wl_handle);
71 | if (err != ESP_OK) {
72 | ESP_LOGE(TAG, "Failed to mount FATFS (%s)", esp_err_to_name(err));
73 | return;
74 | }
75 | }
76 | #endif // CONFIG_STORE_HISTORY
77 |
78 | static void initialize_nvs(void)
79 | {
80 | esp_err_t err = nvs_flash_init();
81 | if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND) {
82 | ESP_ERROR_CHECK( nvs_flash_erase() );
83 | err = nvs_flash_init();
84 | }
85 | ESP_ERROR_CHECK(err);
86 | }
87 |
88 | static void initialize_console(void)
89 | {
90 | /* Drain stdout before reconfiguring it */
91 | fflush(stdout);
92 | fsync(fileno(stdout));
93 |
94 | /* Disable buffering on stdin */
95 | setvbuf(stdin, NULL, _IONBF, 0);
96 |
97 | /* Minicom, screen, idf_monitor send CR when ENTER key is pressed */
98 | esp_vfs_dev_uart_set_rx_line_endings(ESP_LINE_ENDINGS_CR);
99 | /* Move the caret to the beginning of the next line on '\n' */
100 | esp_vfs_dev_uart_set_tx_line_endings(ESP_LINE_ENDINGS_CRLF);
101 |
102 | /* Configure UART. Note that REF_TICK is used so that the baud rate remains
103 | * correct while APB frequency is changing in light sleep mode.
104 | */
105 | const uart_config_t uart_config = {
106 | .baud_rate = CONFIG_ESP_CONSOLE_UART_BAUDRATE,
107 | .data_bits = UART_DATA_8_BITS,
108 | .parity = UART_PARITY_DISABLE,
109 | .stop_bits = UART_STOP_BITS_1,
110 | .source_clk = UART_SCLK_REF_TICK,
111 | };
112 | /* Install UART driver for interrupt-driven reads and writes */
113 | ESP_ERROR_CHECK( uart_driver_install(CONFIG_ESP_CONSOLE_UART_NUM,
114 | 256, 0, 0, NULL, 0) );
115 | ESP_ERROR_CHECK( uart_param_config(CONFIG_ESP_CONSOLE_UART_NUM, &uart_config) );
116 |
117 | /* Tell VFS to use UART driver */
118 | esp_vfs_dev_uart_use_driver(CONFIG_ESP_CONSOLE_UART_NUM);
119 |
120 | /* Initialize the console */
121 | esp_console_config_t console_config = {
122 | .max_cmdline_args = 8,
123 | .max_cmdline_length = 256,
124 | #if CONFIG_LOG_COLORS
125 | .hint_color = atoi(LOG_COLOR_CYAN)
126 | #endif
127 | };
128 | ESP_ERROR_CHECK( esp_console_init(&console_config) );
129 |
130 | /* Configure linenoise line completion library */
131 | /* Enable multiline editing. If not set, long commands will scroll within
132 | * single line.
133 | */
134 | linenoiseSetMultiLine(1);
135 |
136 | /* Tell linenoise where to get command completions and hints */
137 | linenoiseSetCompletionCallback(&esp_console_get_completion);
138 | linenoiseSetHintsCallback((linenoiseHintsCallback*) &esp_console_get_hint);
139 |
140 | /* Set command history size */
141 | linenoiseHistorySetMaxLen(100);
142 |
143 | #if CONFIG_STORE_HISTORY
144 | /* Load command history from filesystem */
145 | linenoiseHistoryLoad(HISTORY_PATH);
146 | #endif
147 | }
148 |
149 | static esp_err_t wifi_event_handler(void *ctx, system_event_t *event)
150 | {
151 | switch(event->event_id) {
152 | case SYSTEM_EVENT_STA_START:
153 | esp_wifi_connect();
154 | break;
155 | case SYSTEM_EVENT_STA_GOT_IP:
156 | ap_connect = true;
157 | ESP_LOGI(TAG, "got ip:" IPSTR, IP2STR(&event->event_info.got_ip.ip_info.ip));
158 | xEventGroupSetBits(wifi_event_group, WIFI_CONNECTED_BIT);
159 | break;
160 | case SYSTEM_EVENT_STA_DISCONNECTED:
161 | ESP_LOGI(TAG,"disconnected - retry to connect to the AP");
162 | ap_connect = false;
163 | esp_wifi_connect();
164 | xEventGroupClearBits(wifi_event_group, WIFI_CONNECTED_BIT);
165 | break;
166 | case SYSTEM_EVENT_AP_STACONNECTED:
167 | connect_count++;
168 | ESP_LOGI(TAG,"%d. station connected", connect_count);
169 | break;
170 | case SYSTEM_EVENT_AP_STADISCONNECTED:
171 | connect_count--;
172 | ESP_LOGI(TAG,"station disconnected - %d remain", connect_count);
173 | break;
174 | default:
175 | break;
176 | }
177 | return ESP_OK;
178 | }
179 |
180 | const int CONNECTED_BIT = BIT0;
181 | #define JOIN_TIMEOUT_MS (2000)
182 |
183 | void wifi_init(const char* ssid, const char* passwd, const char* ap_ssid, const char* ap_passwd)
184 | {
185 | ip_addr_t dnsserver;
186 | //tcpip_adapter_dns_info_t dnsinfo;
187 |
188 | wifi_event_group = xEventGroupCreate();
189 |
190 | tcpip_adapter_init();
191 | ESP_ERROR_CHECK(esp_event_loop_init(wifi_event_handler, NULL) );
192 |
193 | wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
194 | ESP_ERROR_CHECK(esp_wifi_init(&cfg));
195 |
196 | /* ESP WIFI CONFIG */
197 | wifi_config_t wifi_config = { 0 };
198 | wifi_config_t ap_config = {
199 | .ap = {
200 | .channel = 0,
201 | .authmode = WIFI_AUTH_WPA2_PSK,
202 | .ssid_hidden = 0,
203 | .max_connection = 8,
204 | .beacon_interval = 100,
205 | }
206 | };
207 |
208 | strlcpy((char*)ap_config.sta.ssid, ap_ssid, sizeof(ap_config.sta.ssid));
209 | if (strlen(ap_passwd) < 8) {
210 | ap_config.ap.authmode = WIFI_AUTH_OPEN;
211 | } else {
212 | strlcpy((char*)ap_config.sta.password, ap_passwd, sizeof(ap_config.sta.password));
213 | }
214 |
215 | if (strlen(ssid) > 0) {
216 | strlcpy((char*)wifi_config.sta.ssid, ssid, sizeof(wifi_config.sta.ssid));
217 | strlcpy((char*)wifi_config.sta.password, passwd, sizeof(wifi_config.sta.password));
218 | ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_APSTA) );
219 | ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) );
220 | ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &ap_config) );
221 | } else {
222 | ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_AP) );
223 | ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_AP, &ap_config) );
224 | }
225 |
226 | // Enable DNS (offer) for dhcp server
227 | dhcps_offer_t dhcps_dns_value = OFFER_DNS;
228 | dhcps_set_option_info(6, &dhcps_dns_value, sizeof(dhcps_dns_value));
229 |
230 | // Set custom dns server address for dhcp server
231 | dnsserver.u_addr.ip4.addr = htonl(MY_DNS_IP_ADDR);
232 | dnsserver.type = IPADDR_TYPE_V4;
233 | dhcps_dns_setserver(&dnsserver);
234 |
235 | // tcpip_adapter_get_dns_info(TCPIP_ADAPTER_IF_AP, TCPIP_ADAPTER_DNS_MAIN, &dnsinfo);
236 | // ESP_LOGI(TAG, "DNS IP:" IPSTR, IP2STR(&dnsinfo.ip.u_addr.ip4));
237 |
238 | xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,
239 | pdFALSE, pdTRUE, JOIN_TIMEOUT_MS / portTICK_PERIOD_MS);
240 | ESP_ERROR_CHECK(esp_wifi_start());
241 |
242 | if (strlen(ssid) > 0) {
243 | ESP_LOGI(TAG, "wifi_init_apsta finished.");
244 | ESP_LOGI(TAG, "connect to ap SSID: %s ", ssid);
245 | } else {
246 | ESP_LOGI(TAG, "wifi_init_ap with default finished.");
247 | }
248 | }
249 |
250 | char* ssid = NULL;
251 | char* passwd = NULL;
252 | char* ap_ssid = NULL;
253 | char* ap_passwd = NULL;
254 |
255 | char* param_set_default(const char* def_val) {
256 | char * retval = malloc(strlen(def_val)+1);
257 | strcpy(retval, def_val);
258 | return retval;
259 | }
260 |
261 | void app_main(void)
262 | {
263 | initialize_nvs();
264 |
265 | #if CONFIG_STORE_HISTORY
266 | initialize_filesystem();
267 | ESP_LOGI(TAG, "Command history enabled");
268 | #else
269 | ESP_LOGI(TAG, "Command history disabled");
270 | #endif
271 |
272 | get_config_param_str("ssid", &ssid);
273 | if (ssid == NULL) {
274 | ssid = param_set_default("");
275 | }
276 | get_config_param_str("passwd", &passwd);
277 | if (passwd == NULL) {
278 | passwd = param_set_default("");
279 | }
280 | get_config_param_str("ap_ssid", &ap_ssid);
281 | if (ap_ssid == NULL) {
282 | ap_ssid = param_set_default("ESP32_NAT_Router");
283 | }
284 | get_config_param_str("ap_passwd", &ap_passwd);
285 | if (ap_passwd == NULL) {
286 | ap_passwd = param_set_default("");
287 | }
288 | // Setup WIFI
289 | wifi_init(ssid, passwd, ap_ssid, ap_passwd);
290 |
291 | #if IP_NAPT
292 | u32_t napt_netif_ip = 0xC0A80401; // Set to ip address of softAP netif (Default is 192.168.4.1)
293 | ip_napt_enable(htonl(napt_netif_ip), 1);
294 | ESP_LOGI(TAG, "NAT is enabled");
295 | #endif
296 |
297 | char* lock = NULL;
298 | get_config_param_str("lock", &lock);
299 | if (lock == NULL) {
300 | lock = param_set_default("0");
301 | }
302 | if (strcmp(lock, "0") ==0) {
303 | ESP_LOGI(TAG,"Starting config web server");
304 | start_webserver();
305 | }
306 | free(lock);
307 |
308 | initialize_console();
309 |
310 | /* Register commands */
311 | esp_console_register_help_command();
312 | register_system();
313 | register_nvs();
314 | register_router();
315 |
316 | /* Prompt to be printed before each line.
317 | * This can be customized, made dynamic, etc.
318 | */
319 | const char* prompt = LOG_COLOR_I "esp32> " LOG_RESET_COLOR;
320 |
321 | printf("\n"
322 | "ESP32 NAT ROUTER\n"
323 | "Type 'help' to get the list of commands.\n"
324 | "Use UP/DOWN arrows to navigate through command history.\n"
325 | "Press TAB when typing command name to auto-complete.\n");
326 |
327 | if (strlen(ssid) == 0) {
328 | printf("\n"
329 | "Unconfigured WiFi\n"
330 | "Configure using 'set_sta' and 'set_ap' and restart.\n");
331 | }
332 |
333 | /* Figure out if the terminal supports escape sequences */
334 | int probe_status = linenoiseProbe();
335 | if (probe_status) { /* zero indicates success */
336 | printf("\n"
337 | "Your terminal application does not support escape sequences.\n"
338 | "Line editing and history features are disabled.\n"
339 | "On Windows, try using Putty instead.\n");
340 | linenoiseSetDumbMode(1);
341 | #if CONFIG_LOG_COLORS
342 | /* Since the terminal doesn't support escape sequences,
343 | * don't use color codes in the prompt.
344 | */
345 | prompt = "esp32> ";
346 | #endif //CONFIG_LOG_COLORS
347 | }
348 |
349 | /* Main loop */
350 | while(true) {
351 | /* Get a line using linenoise.
352 | * The line is returned when ENTER is pressed.
353 | */
354 | char* line = linenoise(prompt);
355 | if (line == NULL) { /* Ignore empty lines */
356 | continue;
357 | }
358 | /* Add the command to the history */
359 | linenoiseHistoryAdd(line);
360 | #if CONFIG_STORE_HISTORY
361 | /* Save command history to filesystem */
362 | linenoiseHistorySave(HISTORY_PATH);
363 | #endif
364 |
365 | /* Try to run the command */
366 | int ret;
367 | esp_err_t err = esp_console_run(line, &ret);
368 | if (err == ESP_ERR_NOT_FOUND) {
369 | printf("Unrecognized command\n");
370 | } else if (err == ESP_ERR_INVALID_ARG) {
371 | // command was empty
372 | } else if (err == ESP_OK && ret != ESP_OK) {
373 | printf("Command returned non-zero error code: 0x%x (%s)\n", ret, esp_err_to_name(ret));
374 | } else if (err != ESP_OK) {
375 | printf("Internal error: %s\n", esp_err_to_name(err));
376 | }
377 | /* linenoise allocates line buffer on the heap, so need to free it */
378 | linenoiseFree(line);
379 | }
380 | }
381 |
--------------------------------------------------------------------------------
/main/esp32_nat_router.h:
--------------------------------------------------------------------------------
1 | /* Declarations of command registration functions.
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 | #pragma once
10 |
11 | #ifdef __cplusplus
12 | extern "C" {
13 | #endif
14 |
15 | extern char* ssid;
16 | extern char* passwd;
17 | extern char* ap_ssid;
18 | extern char* ap_passwd;
19 |
20 | void preprocess_string(char* str);
21 | int set_sta(int argc, char **argv);
22 | int set_ap(int argc, char **argv);
23 |
24 | httpd_handle_t start_webserver(void);
25 |
26 | #ifdef __cplusplus
27 | }
28 | #endif
29 |
--------------------------------------------------------------------------------
/main/http_server.c:
--------------------------------------------------------------------------------
1 | /* Simple HTTP Server Example
2 |
3 | This example code is in the Public Domain (or CC0 licensed, at your option.)
4 |
5 | Unless required by applicable law or agreed to in writing, this
6 | software is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
7 | CONDITIONS OF ANY KIND, either express or implied.
8 | */
9 |
10 | #include
11 | #include
12 | #include
13 | #include
14 | #include
15 | #include
16 | //#include "nvs_flash.h"
17 | #include "esp_netif.h"
18 | //#include "esp_eth.h"
19 | //#include "protocol_examples_common.h"
20 |
21 | #include
22 |
23 | #include "pages.h"
24 | #include "esp32_nat_router.h"
25 |
26 | static const char *TAG = "HTTPServer";
27 |
28 | esp_timer_handle_t restart_timer;
29 |
30 | static void restart_timer_callback(void* arg)
31 | {
32 | ESP_LOGI(TAG, "Restartting now...");
33 | esp_restart();
34 | }
35 |
36 | esp_timer_create_args_t restart_timer_args = {
37 | .callback = &restart_timer_callback,
38 | /* argument specified here will be passed to timer callback function */
39 | .arg = (void*) 0,
40 | .name = "restart_timer"
41 | };
42 |
43 | /* An HTTP GET handler */
44 | static esp_err_t index_get_handler(httpd_req_t *req)
45 | {
46 | char* buf;
47 | size_t buf_len;
48 |
49 | /* Get header value string length and allocate memory for length + 1,
50 | * extra byte for null termination */
51 | buf_len = httpd_req_get_hdr_value_len(req, "Host") + 1;
52 | if (buf_len > 1) {
53 | buf = malloc(buf_len);
54 | /* Copy null terminated value string into buffer */
55 | if (httpd_req_get_hdr_value_str(req, "Host", buf, buf_len) == ESP_OK) {
56 | ESP_LOGI(TAG, "Found header => Host: %s", buf);
57 | }
58 | free(buf);
59 | }
60 |
61 | /* Read URL query string length and allocate memory for length + 1,
62 | * extra byte for null termination */
63 | buf_len = httpd_req_get_url_query_len(req) + 1;
64 | if (buf_len > 1) {
65 | buf = malloc(buf_len);
66 | if (httpd_req_get_url_query_str(req, buf, buf_len) == ESP_OK) {
67 | ESP_LOGI(TAG, "Found URL query => %s", buf);
68 | if (strcmp(buf, "reset=Restart") == 0) {
69 | esp_timer_start_once(restart_timer, 500000);
70 | }
71 | char param1[64];
72 | char param2[64];
73 | /* Get value of expected key from query string */
74 | if (httpd_query_key_value(buf, "ssid", param1, sizeof(param1)) == ESP_OK) {
75 | ESP_LOGI(TAG, "Found URL query parameter => ssid=%s", param1);
76 | preprocess_string(param1);
77 | if (httpd_query_key_value(buf, "password", param2, sizeof(param2)) == ESP_OK) {
78 | ESP_LOGI(TAG, "Found URL query parameter => password=%s", param2);
79 | preprocess_string(param2);
80 | int argc = 3;
81 | char *argv[3];
82 | argv[0] = "set_sta";
83 | argv[1] = param1;
84 | argv[2] = param2;
85 | set_sta(argc, argv);
86 | esp_timer_start_once(restart_timer, 500000);
87 | }
88 | }
89 | if (httpd_query_key_value(buf, "ap_ssid", param1, sizeof(param1)) == ESP_OK) {
90 | ESP_LOGI(TAG, "Found URL query parameter => ap_ssid=%s", param1);
91 | preprocess_string(param1);
92 | if (httpd_query_key_value(buf, "ap_password", param2, sizeof(param2)) == ESP_OK) {
93 | ESP_LOGI(TAG, "Found URL query parameter => ap_password=%s", param2);
94 | preprocess_string(param2);
95 | int argc = 3;
96 | char *argv[3];
97 | argv[0] = "set_ap";
98 | argv[1] = param1;
99 | argv[2] = param2;
100 | set_ap(argc, argv);
101 | esp_timer_start_once(restart_timer, 500000);
102 | }
103 | }
104 | }
105 | free(buf);
106 | }
107 |
108 | /* Send response with custom headers and body set as the
109 | * string passed in user context*/
110 | const char* resp_str = (const char*) req->user_ctx;
111 | httpd_resp_send(req, resp_str, strlen(resp_str));
112 |
113 | return ESP_OK;
114 | }
115 |
116 | static httpd_uri_t indexp = {
117 | .uri = "/",
118 | .method = HTTP_GET,
119 | .handler = index_get_handler,
120 | };
121 |
122 | esp_err_t http_404_error_handler(httpd_req_t *req, httpd_err_code_t err)
123 | {
124 | httpd_resp_send_err(req, HTTPD_404_NOT_FOUND, "Page not found");
125 | return ESP_FAIL;
126 | }
127 |
128 | httpd_handle_t start_webserver(void)
129 | {
130 | httpd_handle_t server = NULL;
131 | httpd_config_t config = HTTPD_DEFAULT_CONFIG();
132 |
133 | const char *config_page_template = CONFIG_PAGE;
134 | char *config_page = malloc(strlen(config_page_template)+512);
135 | sprintf(config_page, config_page_template, ssid, passwd, ap_ssid, ap_passwd);
136 | indexp.user_ctx = config_page;
137 |
138 | esp_timer_create(&restart_timer_args, &restart_timer);
139 |
140 | // Start the httpd server
141 | ESP_LOGI(TAG, "Starting server on port: '%d'", config.server_port);
142 | if (httpd_start(&server, &config) == ESP_OK) {
143 | // Set URI handlers
144 | ESP_LOGI(TAG, "Registering URI handlers");
145 | httpd_register_uri_handler(server, &indexp);
146 | return server;
147 | }
148 |
149 | ESP_LOGI(TAG, "Error starting server!");
150 | return NULL;
151 | }
152 |
153 | static void stop_webserver(httpd_handle_t server)
154 | {
155 | // Stop the httpd server
156 | httpd_stop(server);
157 | }
158 |
--------------------------------------------------------------------------------
/main/pages.h:
--------------------------------------------------------------------------------
1 | #define CONFIG_PAGE "\
2 | \
3 | \
4 | \
5 | \
6 | ESP32 NAT Router Config
\
7 | \
8 | \
16 |
STA Settings
\
17 |
\
34 | \
35 |
AP Settings
\
36 |
\
55 | \
56 |
Device Management
\
57 |
\
65 |
\
66 | \
67 | \
68 | "
69 |
70 | #define LOCK_PAGE "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n\
71 | \
72 | \
73 | \
74 | \
75 | ESP32 NAT Router Config
\
76 | \
77 | \
85 |
Config Locked
\
86 |
\
102 |
\
103 | \
104 | \
105 | "
106 |
--------------------------------------------------------------------------------
/partitions_example.csv:
--------------------------------------------------------------------------------
1 | # Name, Type, SubType, Offset, Size, Flags
2 | # Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
3 | nvs, data, nvs, 0x9000, 0x6000,
4 | phy_init, data, phy, 0xf000, 0x1000,
5 | factory, app, factory, 0x10000, 1M,
6 | storage, data, fat, , 1M,
7 |
--------------------------------------------------------------------------------
/sdkconfig:
--------------------------------------------------------------------------------
1 | #
2 | # Automatically generated file. DO NOT EDIT.
3 | # Espressif IoT Development Framework (ESP-IDF) Project Configuration
4 | #
5 | CONFIG_IDF_CMAKE=y
6 | CONFIG_IDF_TARGET="esp32"
7 | CONFIG_IDF_TARGET_ESP32=y
8 | CONFIG_IDF_FIRMWARE_CHIP_ID=0x0000
9 |
10 | #
11 | # SDK tool configuration
12 | #
13 | CONFIG_SDK_TOOLPREFIX="xtensa-esp32-elf-"
14 | # CONFIG_SDK_TOOLCHAIN_SUPPORTS_TIME_WIDE_64_BITS is not set
15 | # end of SDK tool configuration
16 |
17 | #
18 | # Build type
19 | #
20 | CONFIG_APP_BUILD_TYPE_APP_2NDBOOT=y
21 | # CONFIG_APP_BUILD_TYPE_ELF_RAM is not set
22 | CONFIG_APP_BUILD_GENERATE_BINARIES=y
23 | CONFIG_APP_BUILD_BOOTLOADER=y
24 | CONFIG_APP_BUILD_USE_FLASH_SECTIONS=y
25 | # end of Build type
26 |
27 | #
28 | # Application manager
29 | #
30 | CONFIG_APP_COMPILE_TIME_DATE=y
31 | # CONFIG_APP_EXCLUDE_PROJECT_VER_VAR is not set
32 | # CONFIG_APP_EXCLUDE_PROJECT_NAME_VAR is not set
33 | # CONFIG_APP_PROJECT_VER_FROM_CONFIG is not set
34 | # end of Application manager
35 |
36 | #
37 | # Bootloader config
38 | #
39 | # CONFIG_BOOTLOADER_LOG_LEVEL_NONE is not set
40 | # CONFIG_BOOTLOADER_LOG_LEVEL_ERROR is not set
41 | CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y
42 | # CONFIG_BOOTLOADER_LOG_LEVEL_INFO is not set
43 | # CONFIG_BOOTLOADER_LOG_LEVEL_DEBUG is not set
44 | # CONFIG_BOOTLOADER_LOG_LEVEL_VERBOSE is not set
45 | CONFIG_BOOTLOADER_LOG_LEVEL=2
46 | # CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_8V is not set
47 | CONFIG_BOOTLOADER_VDDSDIO_BOOST_1_9V=y
48 | # CONFIG_BOOTLOADER_FACTORY_RESET is not set
49 | # CONFIG_BOOTLOADER_APP_TEST is not set
50 | CONFIG_BOOTLOADER_WDT_ENABLE=y
51 | # CONFIG_BOOTLOADER_WDT_DISABLE_IN_USER_CODE is not set
52 | CONFIG_BOOTLOADER_WDT_TIME_MS=9000
53 | # CONFIG_BOOTLOADER_APP_ROLLBACK_ENABLE is not set
54 | # CONFIG_BOOTLOADER_SKIP_VALIDATE_IN_DEEP_SLEEP is not set
55 | CONFIG_BOOTLOADER_RESERVE_RTC_SIZE=0
56 | # CONFIG_BOOTLOADER_CUSTOM_RESERVE_RTC is not set
57 | # end of Bootloader config
58 |
59 | #
60 | # Security features
61 | #
62 | # CONFIG_SECURE_SIGNED_APPS_NO_SECURE_BOOT is not set
63 | # CONFIG_SECURE_BOOT_ENABLED is not set
64 | # CONFIG_SECURE_FLASH_ENC_ENABLED is not set
65 | # end of Security features
66 |
67 | #
68 | # Serial flasher config
69 | #
70 | CONFIG_ESPTOOLPY_BAUD_OTHER_VAL=115200
71 | # CONFIG_ESPTOOLPY_FLASHMODE_QIO is not set
72 | # CONFIG_ESPTOOLPY_FLASHMODE_QOUT is not set
73 | CONFIG_ESPTOOLPY_FLASHMODE_DIO=y
74 | # CONFIG_ESPTOOLPY_FLASHMODE_DOUT is not set
75 | CONFIG_ESPTOOLPY_FLASHMODE="dio"
76 | # CONFIG_ESPTOOLPY_FLASHFREQ_80M is not set
77 | CONFIG_ESPTOOLPY_FLASHFREQ_40M=y
78 | # CONFIG_ESPTOOLPY_FLASHFREQ_26M is not set
79 | # CONFIG_ESPTOOLPY_FLASHFREQ_20M is not set
80 | CONFIG_ESPTOOLPY_FLASHFREQ="40m"
81 | # CONFIG_ESPTOOLPY_FLASHSIZE_1MB is not set
82 | # CONFIG_ESPTOOLPY_FLASHSIZE_2MB is not set
83 | CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
84 | # CONFIG_ESPTOOLPY_FLASHSIZE_8MB is not set
85 | # CONFIG_ESPTOOLPY_FLASHSIZE_16MB is not set
86 | CONFIG_ESPTOOLPY_FLASHSIZE="4MB"
87 | CONFIG_ESPTOOLPY_FLASHSIZE_DETECT=y
88 | CONFIG_ESPTOOLPY_BEFORE_RESET=y
89 | # CONFIG_ESPTOOLPY_BEFORE_NORESET is not set
90 | CONFIG_ESPTOOLPY_BEFORE="default_reset"
91 | CONFIG_ESPTOOLPY_AFTER_RESET=y
92 | # CONFIG_ESPTOOLPY_AFTER_NORESET is not set
93 | CONFIG_ESPTOOLPY_AFTER="hard_reset"
94 | # CONFIG_ESPTOOLPY_MONITOR_BAUD_9600B is not set
95 | # CONFIG_ESPTOOLPY_MONITOR_BAUD_57600B is not set
96 | CONFIG_ESPTOOLPY_MONITOR_BAUD_115200B=y
97 | # CONFIG_ESPTOOLPY_MONITOR_BAUD_230400B is not set
98 | # CONFIG_ESPTOOLPY_MONITOR_BAUD_921600B is not set
99 | # CONFIG_ESPTOOLPY_MONITOR_BAUD_2MB is not set
100 | # CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER is not set
101 | CONFIG_ESPTOOLPY_MONITOR_BAUD_OTHER_VAL=115200
102 | CONFIG_ESPTOOLPY_MONITOR_BAUD=115200
103 | # end of Serial flasher config
104 |
105 | #
106 | # Partition Table
107 | #
108 | # CONFIG_PARTITION_TABLE_SINGLE_APP is not set
109 | # CONFIG_PARTITION_TABLE_TWO_OTA is not set
110 | CONFIG_PARTITION_TABLE_CUSTOM=y
111 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_example.csv"
112 | CONFIG_PARTITION_TABLE_FILENAME="partitions_example.csv"
113 | CONFIG_PARTITION_TABLE_OFFSET=0x8000
114 | CONFIG_PARTITION_TABLE_MD5=y
115 | # end of Partition Table
116 |
117 | #
118 | # Example Configuration
119 | #
120 | CONFIG_STORE_HISTORY=y
121 | # end of Example Configuration
122 |
123 | #
124 | # Compiler options
125 | #
126 | CONFIG_COMPILER_OPTIMIZATION_DEFAULT=y
127 | # CONFIG_COMPILER_OPTIMIZATION_SIZE is not set
128 | # CONFIG_COMPILER_OPTIMIZATION_PERF is not set
129 | # CONFIG_COMPILER_OPTIMIZATION_NONE is not set
130 | CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_ENABLE=y
131 | # CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_SILENT is not set
132 | # CONFIG_COMPILER_OPTIMIZATION_ASSERTIONS_DISABLE is not set
133 | # CONFIG_COMPILER_CXX_EXCEPTIONS is not set
134 | # CONFIG_COMPILER_CXX_RTTI is not set
135 | CONFIG_COMPILER_STACK_CHECK_MODE_NONE=y
136 | # CONFIG_COMPILER_STACK_CHECK_MODE_NORM is not set
137 | # CONFIG_COMPILER_STACK_CHECK_MODE_STRONG is not set
138 | # CONFIG_COMPILER_STACK_CHECK_MODE_ALL is not set
139 | # CONFIG_COMPILER_WARN_WRITE_STRINGS is not set
140 | # CONFIG_COMPILER_DISABLE_GCC8_WARNINGS is not set
141 | # end of Compiler options
142 |
143 | #
144 | # Component config
145 | #
146 |
147 | #
148 | # Application Level Tracing
149 | #
150 | # CONFIG_APPTRACE_DEST_TRAX is not set
151 | CONFIG_APPTRACE_DEST_NONE=y
152 | CONFIG_APPTRACE_LOCK_ENABLE=y
153 | # end of Application Level Tracing
154 |
155 | #
156 | # Bluetooth
157 | #
158 | # CONFIG_BT_ENABLED is not set
159 | CONFIG_BTDM_CTRL_BR_EDR_SCO_DATA_PATH_EFF=0
160 | CONFIG_BTDM_CTRL_BLE_MAX_CONN_EFF=0
161 | CONFIG_BTDM_CTRL_BR_EDR_MAX_ACL_CONN_EFF=0
162 | CONFIG_BTDM_CTRL_BR_EDR_MAX_SYNC_CONN_EFF=0
163 | CONFIG_BTDM_CTRL_PINNED_TO_CORE=0
164 | CONFIG_BTDM_BLE_SLEEP_CLOCK_ACCURACY_INDEX_EFF=1
165 | CONFIG_BT_RESERVE_DRAM=0
166 | # end of Bluetooth
167 |
168 | #
169 | # CoAP Configuration
170 | #
171 | CONFIG_COAP_MBEDTLS_PSK=y
172 | # CONFIG_COAP_MBEDTLS_PKI is not set
173 | # CONFIG_COAP_MBEDTLS_DEBUG is not set
174 | CONFIG_COAP_LOG_DEFAULT_LEVEL=0
175 | # end of CoAP Configuration
176 |
177 | #
178 | # Driver configurations
179 | #
180 |
181 | #
182 | # ADC configuration
183 | #
184 | # CONFIG_ADC_FORCE_XPD_FSM is not set
185 | CONFIG_ADC_DISABLE_DAC=y
186 | # end of ADC configuration
187 |
188 | #
189 | # SPI configuration
190 | #
191 | # CONFIG_SPI_MASTER_IN_IRAM is not set
192 | CONFIG_SPI_MASTER_ISR_IN_IRAM=y
193 | # CONFIG_SPI_SLAVE_IN_IRAM is not set
194 | CONFIG_SPI_SLAVE_ISR_IN_IRAM=y
195 | # end of SPI configuration
196 |
197 | #
198 | # UART configuration
199 | #
200 | # CONFIG_UART_ISR_IN_IRAM is not set
201 | # end of UART configuration
202 |
203 | #
204 | # RTCIO configuration
205 | #
206 | # CONFIG_RTCIO_SUPPORT_RTC_GPIO_DESC is not set
207 | # end of RTCIO configuration
208 | # end of Driver configurations
209 |
210 | #
211 | # eFuse Bit Manager
212 | #
213 | # CONFIG_EFUSE_CUSTOM_TABLE is not set
214 | # CONFIG_EFUSE_VIRTUAL is not set
215 | # CONFIG_EFUSE_CODE_SCHEME_COMPAT_NONE is not set
216 | CONFIG_EFUSE_CODE_SCHEME_COMPAT_3_4=y
217 | # CONFIG_EFUSE_CODE_SCHEME_COMPAT_REPEAT is not set
218 | CONFIG_EFUSE_MAX_BLK_LEN=192
219 | # end of eFuse Bit Manager
220 |
221 | #
222 | # ESP-TLS
223 | #
224 | CONFIG_ESP_TLS_USING_MBEDTLS=y
225 | # CONFIG_ESP_TLS_SERVER is not set
226 | # CONFIG_ESP_TLS_PSK_VERIFICATION is not set
227 | # end of ESP-TLS
228 |
229 | #
230 | # ESP32-specific
231 | #
232 | CONFIG_ESP32_REV_MIN_0=y
233 | # CONFIG_ESP32_REV_MIN_1 is not set
234 | # CONFIG_ESP32_REV_MIN_2 is not set
235 | # CONFIG_ESP32_REV_MIN_3 is not set
236 | CONFIG_ESP32_REV_MIN=0
237 | CONFIG_ESP32_DPORT_WORKAROUND=y
238 | # CONFIG_ESP32_DEFAULT_CPU_FREQ_80 is not set
239 | CONFIG_ESP32_DEFAULT_CPU_FREQ_160=y
240 | # CONFIG_ESP32_DEFAULT_CPU_FREQ_240 is not set
241 | CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=160
242 | # CONFIG_ESP32_SPIRAM_SUPPORT is not set
243 | # CONFIG_ESP32_TRAX is not set
244 | CONFIG_ESP32_TRACEMEM_RESERVE_DRAM=0x0
245 | # CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_TWO is not set
246 | CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR=y
247 | CONFIG_ESP32_UNIVERSAL_MAC_ADDRESSES=4
248 | # CONFIG_ESP32_ULP_COPROC_ENABLED is not set
249 | CONFIG_ESP32_ULP_COPROC_RESERVE_MEM=0
250 | # CONFIG_ESP32_PANIC_PRINT_HALT is not set
251 | CONFIG_ESP32_PANIC_PRINT_REBOOT=y
252 | # CONFIG_ESP32_PANIC_SILENT_REBOOT is not set
253 | # CONFIG_ESP32_PANIC_GDBSTUB is not set
254 | CONFIG_ESP32_DEBUG_OCDAWARE=y
255 | CONFIG_ESP32_BROWNOUT_DET=y
256 | CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_0=y
257 | # CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_1 is not set
258 | # CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_2 is not set
259 | # CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_3 is not set
260 | # CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_4 is not set
261 | # CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_5 is not set
262 | # CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_6 is not set
263 | # CONFIG_ESP32_BROWNOUT_DET_LVL_SEL_7 is not set
264 | CONFIG_ESP32_BROWNOUT_DET_LVL=0
265 | CONFIG_ESP32_REDUCE_PHY_TX_POWER=y
266 | CONFIG_ESP32_TIME_SYSCALL_USE_RTC_FRC1=y
267 | # CONFIG_ESP32_TIME_SYSCALL_USE_RTC is not set
268 | # CONFIG_ESP32_TIME_SYSCALL_USE_FRC1 is not set
269 | # CONFIG_ESP32_TIME_SYSCALL_USE_NONE is not set
270 | CONFIG_ESP32_RTC_CLK_SRC_INT_RC=y
271 | # CONFIG_ESP32_RTC_CLK_SRC_EXT_CRYS is not set
272 | # CONFIG_ESP32_RTC_CLK_SRC_EXT_OSC is not set
273 | # CONFIG_ESP32_RTC_CLK_SRC_INT_8MD256 is not set
274 | CONFIG_ESP32_RTC_CLK_CAL_CYCLES=1024
275 | CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY=2000
276 | CONFIG_ESP32_XTAL_FREQ_40=y
277 | # CONFIG_ESP32_XTAL_FREQ_26 is not set
278 | # CONFIG_ESP32_XTAL_FREQ_AUTO is not set
279 | CONFIG_ESP32_XTAL_FREQ=40
280 | # CONFIG_ESP32_DISABLE_BASIC_ROM_CONSOLE is not set
281 | # CONFIG_ESP32_NO_BLOBS is not set
282 | # CONFIG_ESP32_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set
283 | # CONFIG_ESP32_USE_FIXED_STATIC_RAM_SIZE is not set
284 | CONFIG_ESP32_DPORT_DIS_INTERRUPT_LVL=5
285 | # end of ESP32-specific
286 |
287 | #
288 | # Power Management
289 | #
290 | # CONFIG_PM_ENABLE is not set
291 | # end of Power Management
292 |
293 | #
294 | # ADC-Calibration
295 | #
296 | CONFIG_ADC_CAL_EFUSE_TP_ENABLE=y
297 | CONFIG_ADC_CAL_EFUSE_VREF_ENABLE=y
298 | CONFIG_ADC_CAL_LUT_ENABLE=y
299 | # end of ADC-Calibration
300 |
301 | #
302 | # Common ESP-related
303 | #
304 | CONFIG_ESP_ERR_TO_NAME_LOOKUP=y
305 | CONFIG_ESP_SYSTEM_EVENT_QUEUE_SIZE=32
306 | CONFIG_ESP_SYSTEM_EVENT_TASK_STACK_SIZE=2304
307 | CONFIG_ESP_MAIN_TASK_STACK_SIZE=7168
308 | CONFIG_ESP_IPC_TASK_STACK_SIZE=1024
309 | CONFIG_ESP_IPC_USES_CALLERS_PRIORITY=y
310 | CONFIG_ESP_MINIMAL_SHARED_STACK_SIZE=2048
311 | CONFIG_ESP_CONSOLE_UART_DEFAULT=y
312 | # CONFIG_ESP_CONSOLE_UART_CUSTOM is not set
313 | # CONFIG_ESP_CONSOLE_UART_NONE is not set
314 | CONFIG_ESP_CONSOLE_UART_NUM=0
315 | CONFIG_ESP_CONSOLE_UART_BAUDRATE=115200
316 | CONFIG_ESP_INT_WDT=y
317 | CONFIG_ESP_INT_WDT_TIMEOUT_MS=300
318 | CONFIG_ESP_INT_WDT_CHECK_CPU1=y
319 | CONFIG_ESP_TASK_WDT=y
320 | # CONFIG_ESP_TASK_WDT_PANIC is not set
321 | CONFIG_ESP_TASK_WDT_TIMEOUT_S=5
322 | CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
323 | CONFIG_ESP_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
324 | # CONFIG_ESP_PANIC_HANDLER_IRAM is not set
325 | CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_STA=y
326 | CONFIG_ESP_MAC_ADDR_UNIVERSE_WIFI_AP=y
327 | CONFIG_ESP_MAC_ADDR_UNIVERSE_BT=y
328 | CONFIG_ESP_MAC_ADDR_UNIVERSE_ETH=y
329 | # end of Common ESP-related
330 |
331 | #
332 | # Ethernet
333 | #
334 | CONFIG_ETH_ENABLED=y
335 | CONFIG_ETH_USE_ESP32_EMAC=y
336 | CONFIG_ETH_PHY_INTERFACE_RMII=y
337 | # CONFIG_ETH_PHY_INTERFACE_MII is not set
338 | CONFIG_ETH_RMII_CLK_INPUT=y
339 | # CONFIG_ETH_RMII_CLK_OUTPUT is not set
340 | CONFIG_ETH_RMII_CLK_IN_GPIO=0
341 | CONFIG_ETH_DMA_BUFFER_SIZE=512
342 | CONFIG_ETH_DMA_RX_BUFFER_NUM=10
343 | CONFIG_ETH_DMA_TX_BUFFER_NUM=10
344 | CONFIG_ETH_USE_SPI_ETHERNET=y
345 | CONFIG_ETH_SPI_ETHERNET_DM9051=y
346 | # CONFIG_ETH_USE_OPENETH is not set
347 | # end of Ethernet
348 |
349 | #
350 | # Event Loop Library
351 | #
352 | # CONFIG_ESP_EVENT_LOOP_PROFILING is not set
353 | CONFIG_ESP_EVENT_POST_FROM_ISR=y
354 | CONFIG_ESP_EVENT_POST_FROM_IRAM_ISR=y
355 | # end of Event Loop Library
356 |
357 | #
358 | # GDB Stub
359 | #
360 | # end of GDB Stub
361 |
362 | #
363 | # ESP HTTP client
364 | #
365 | CONFIG_ESP_HTTP_CLIENT_ENABLE_HTTPS=y
366 | # CONFIG_ESP_HTTP_CLIENT_ENABLE_BASIC_AUTH is not set
367 | # end of ESP HTTP client
368 |
369 | #
370 | # HTTP Server
371 | #
372 | CONFIG_HTTPD_MAX_REQ_HDR_LEN=512
373 | CONFIG_HTTPD_MAX_URI_LEN=512
374 | CONFIG_HTTPD_ERR_RESP_NO_DELAY=y
375 | CONFIG_HTTPD_PURGE_BUF_LEN=32
376 | # CONFIG_HTTPD_LOG_PURGE_DATA is not set
377 | # end of HTTP Server
378 |
379 | #
380 | # ESP HTTPS OTA
381 | #
382 | # CONFIG_OTA_ALLOW_HTTP is not set
383 | # end of ESP HTTPS OTA
384 |
385 | #
386 | # ESP HTTPS server
387 | #
388 | # CONFIG_ESP_HTTPS_SERVER_ENABLE is not set
389 | # end of ESP HTTPS server
390 |
391 | #
392 | # ESP NETIF Adapter
393 | #
394 | CONFIG_ESP_NETIF_IP_LOST_TIMER_INTERVAL=120
395 | CONFIG_ESP_NETIF_TCPIP_LWIP=y
396 | # CONFIG_ESP_NETIF_LOOPBACK is not set
397 | CONFIG_ESP_NETIF_TCPIP_ADAPTER_COMPATIBLE_LAYER=y
398 | # end of ESP NETIF Adapter
399 |
400 | #
401 | # High resolution timer (esp_timer)
402 | #
403 | # CONFIG_ESP_TIMER_PROFILING is not set
404 | CONFIG_ESP_TIMER_TASK_STACK_SIZE=3584
405 | # CONFIG_ESP_TIMER_IMPL_FRC2 is not set
406 | CONFIG_ESP_TIMER_IMPL_TG0_LAC=y
407 | # end of High resolution timer (esp_timer)
408 |
409 | #
410 | # Wi-Fi
411 | #
412 | CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM=10
413 | CONFIG_ESP32_WIFI_DYNAMIC_RX_BUFFER_NUM=32
414 | # CONFIG_ESP32_WIFI_STATIC_TX_BUFFER is not set
415 | CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER=y
416 | CONFIG_ESP32_WIFI_TX_BUFFER_TYPE=1
417 | CONFIG_ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM=32
418 | # CONFIG_ESP32_WIFI_CSI_ENABLED is not set
419 | CONFIG_ESP32_WIFI_AMPDU_TX_ENABLED=y
420 | CONFIG_ESP32_WIFI_TX_BA_WIN=6
421 | CONFIG_ESP32_WIFI_AMPDU_RX_ENABLED=y
422 | CONFIG_ESP32_WIFI_RX_BA_WIN=6
423 | CONFIG_ESP32_WIFI_NVS_ENABLED=y
424 | CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y
425 | # CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1 is not set
426 | CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752
427 | CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32
428 | # CONFIG_ESP32_WIFI_DEBUG_LOG_ENABLE is not set
429 | CONFIG_ESP32_WIFI_IRAM_OPT=y
430 | CONFIG_ESP32_WIFI_RX_IRAM_OPT=y
431 | # CONFIG_ESP32_WIFI_ENABLE_WPA3_SAE is not set
432 | # end of Wi-Fi
433 |
434 | #
435 | # PHY
436 | #
437 | CONFIG_ESP32_PHY_CALIBRATION_AND_DATA_STORAGE=y
438 | # CONFIG_ESP32_PHY_INIT_DATA_IN_PARTITION is not set
439 | CONFIG_ESP32_PHY_MAX_WIFI_TX_POWER=20
440 | CONFIG_ESP32_PHY_MAX_TX_POWER=20
441 | # end of PHY
442 |
443 | #
444 | # Core dump
445 | #
446 | # CONFIG_ESP32_ENABLE_COREDUMP_TO_FLASH is not set
447 | # CONFIG_ESP32_ENABLE_COREDUMP_TO_UART is not set
448 | CONFIG_ESP32_ENABLE_COREDUMP_TO_NONE=y
449 | # end of Core dump
450 |
451 | #
452 | # FAT Filesystem support
453 | #
454 | # CONFIG_FATFS_CODEPAGE_DYNAMIC is not set
455 | CONFIG_FATFS_CODEPAGE_437=y
456 | # CONFIG_FATFS_CODEPAGE_720 is not set
457 | # CONFIG_FATFS_CODEPAGE_737 is not set
458 | # CONFIG_FATFS_CODEPAGE_771 is not set
459 | # CONFIG_FATFS_CODEPAGE_775 is not set
460 | # CONFIG_FATFS_CODEPAGE_850 is not set
461 | # CONFIG_FATFS_CODEPAGE_852 is not set
462 | # CONFIG_FATFS_CODEPAGE_855 is not set
463 | # CONFIG_FATFS_CODEPAGE_857 is not set
464 | # CONFIG_FATFS_CODEPAGE_860 is not set
465 | # CONFIG_FATFS_CODEPAGE_861 is not set
466 | # CONFIG_FATFS_CODEPAGE_862 is not set
467 | # CONFIG_FATFS_CODEPAGE_863 is not set
468 | # CONFIG_FATFS_CODEPAGE_864 is not set
469 | # CONFIG_FATFS_CODEPAGE_865 is not set
470 | # CONFIG_FATFS_CODEPAGE_866 is not set
471 | # CONFIG_FATFS_CODEPAGE_869 is not set
472 | # CONFIG_FATFS_CODEPAGE_932 is not set
473 | # CONFIG_FATFS_CODEPAGE_936 is not set
474 | # CONFIG_FATFS_CODEPAGE_949 is not set
475 | # CONFIG_FATFS_CODEPAGE_950 is not set
476 | CONFIG_FATFS_CODEPAGE=437
477 | CONFIG_FATFS_LFN_NONE=y
478 | # CONFIG_FATFS_LFN_HEAP is not set
479 | # CONFIG_FATFS_LFN_STACK is not set
480 | CONFIG_FATFS_FS_LOCK=0
481 | CONFIG_FATFS_TIMEOUT_MS=10000
482 | CONFIG_FATFS_PER_FILE_CACHE=y
483 | # end of FAT Filesystem support
484 |
485 | #
486 | # Modbus configuration
487 | #
488 | CONFIG_FMB_COMM_MODE_RTU_EN=y
489 | CONFIG_FMB_COMM_MODE_ASCII_EN=y
490 | CONFIG_FMB_MASTER_TIMEOUT_MS_RESPOND=150
491 | CONFIG_FMB_MASTER_DELAY_MS_CONVERT=200
492 | CONFIG_FMB_QUEUE_LENGTH=20
493 | CONFIG_FMB_SERIAL_TASK_STACK_SIZE=2048
494 | CONFIG_FMB_SERIAL_BUF_SIZE=256
495 | CONFIG_FMB_SERIAL_ASCII_BITS_PER_SYMB=8
496 | CONFIG_FMB_SERIAL_ASCII_TIMEOUT_RESPOND_MS=1000
497 | CONFIG_FMB_SERIAL_TASK_PRIO=10
498 | # CONFIG_FMB_CONTROLLER_SLAVE_ID_SUPPORT is not set
499 | CONFIG_FMB_CONTROLLER_NOTIFY_TIMEOUT=20
500 | CONFIG_FMB_CONTROLLER_NOTIFY_QUEUE_SIZE=20
501 | CONFIG_FMB_CONTROLLER_STACK_SIZE=4096
502 | CONFIG_FMB_EVENT_QUEUE_TIMEOUT=20
503 | CONFIG_FMB_TIMER_PORT_ENABLED=y
504 | CONFIG_FMB_TIMER_GROUP=0
505 | CONFIG_FMB_TIMER_INDEX=0
506 | # CONFIG_FMB_TIMER_ISR_IN_IRAM is not set
507 | # end of Modbus configuration
508 |
509 | #
510 | # FreeRTOS
511 | #
512 | # CONFIG_FREERTOS_UNICORE is not set
513 | CONFIG_FREERTOS_NO_AFFINITY=0x7FFFFFFF
514 | CONFIG_FREERTOS_CORETIMER_0=y
515 | # CONFIG_FREERTOS_CORETIMER_1 is not set
516 | CONFIG_FREERTOS_HZ=100
517 | CONFIG_FREERTOS_ASSERT_ON_UNTESTED_FUNCTION=y
518 | # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_NONE is not set
519 | # CONFIG_FREERTOS_CHECK_STACKOVERFLOW_PTRVAL is not set
520 | CONFIG_FREERTOS_CHECK_STACKOVERFLOW_CANARY=y
521 | # CONFIG_FREERTOS_WATCHPOINT_END_OF_STACK is not set
522 | CONFIG_FREERTOS_INTERRUPT_BACKTRACE=y
523 | CONFIG_FREERTOS_THREAD_LOCAL_STORAGE_POINTERS=1
524 | CONFIG_FREERTOS_ASSERT_FAIL_ABORT=y
525 | # CONFIG_FREERTOS_ASSERT_FAIL_PRINT_CONTINUE is not set
526 | # CONFIG_FREERTOS_ASSERT_DISABLE is not set
527 | CONFIG_FREERTOS_IDLE_TASK_STACKSIZE=1536
528 | CONFIG_FREERTOS_ISR_STACKSIZE=1536
529 | # CONFIG_FREERTOS_LEGACY_HOOKS is not set
530 | CONFIG_FREERTOS_MAX_TASK_NAME_LEN=16
531 | # CONFIG_FREERTOS_SUPPORT_STATIC_ALLOCATION is not set
532 | CONFIG_FREERTOS_TIMER_TASK_PRIORITY=1
533 | CONFIG_FREERTOS_TIMER_TASK_STACK_DEPTH=2048
534 | CONFIG_FREERTOS_TIMER_QUEUE_LENGTH=10
535 | CONFIG_FREERTOS_QUEUE_REGISTRY_SIZE=0
536 | CONFIG_FREERTOS_USE_TRACE_FACILITY=y
537 | CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y
538 | # CONFIG_FREERTOS_VTASKLIST_INCLUDE_COREID is not set
539 | # CONFIG_FREERTOS_GENERATE_RUN_TIME_STATS is not set
540 | CONFIG_FREERTOS_TASK_FUNCTION_WRAPPER=y
541 | CONFIG_FREERTOS_CHECK_MUTEX_GIVEN_BY_OWNER=y
542 | # CONFIG_FREERTOS_CHECK_PORT_CRITICAL_COMPLIANCE is not set
543 | CONFIG_FREERTOS_DEBUG_OCDAWARE=y
544 | # CONFIG_FREERTOS_FPU_IN_ISR is not set
545 | # end of FreeRTOS
546 |
547 | #
548 | # Heap memory debugging
549 | #
550 | CONFIG_HEAP_POISONING_DISABLED=y
551 | # CONFIG_HEAP_POISONING_LIGHT is not set
552 | # CONFIG_HEAP_POISONING_COMPREHENSIVE is not set
553 | CONFIG_HEAP_TRACING_OFF=y
554 | # CONFIG_HEAP_TRACING_STANDALONE is not set
555 | # CONFIG_HEAP_TRACING_TOHOST is not set
556 | # end of Heap memory debugging
557 |
558 | #
559 | # jsmn
560 | #
561 | # CONFIG_JSMN_PARENT_LINKS is not set
562 | # CONFIG_JSMN_STRICT is not set
563 | # end of jsmn
564 |
565 | #
566 | # libsodium
567 | #
568 | # end of libsodium
569 |
570 | #
571 | # Log output
572 | #
573 | # CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
574 | # CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set
575 | # CONFIG_LOG_DEFAULT_LEVEL_WARN is not set
576 | CONFIG_LOG_DEFAULT_LEVEL_INFO=y
577 | # CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set
578 | # CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set
579 | CONFIG_LOG_DEFAULT_LEVEL=3
580 | CONFIG_LOG_COLORS=y
581 | CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y
582 | # CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set
583 | # end of Log output
584 |
585 | #
586 | # LWIP
587 | #
588 | CONFIG_LWIP_LOCAL_HOSTNAME="espressif"
589 | CONFIG_LWIP_DNS_SUPPORT_MDNS_QUERIES=y
590 | CONFIG_LWIP_L2_TO_L3_COPY=y
591 | # CONFIG_LWIP_IRAM_OPTIMIZATION is not set
592 | CONFIG_LWIP_TIMERS_ONDEMAND=y
593 | CONFIG_LWIP_MAX_SOCKETS=10
594 | # CONFIG_LWIP_USE_ONLY_LWIP_SELECT is not set
595 | CONFIG_LWIP_SO_REUSE=y
596 | CONFIG_LWIP_SO_REUSE_RXTOALL=y
597 | # CONFIG_LWIP_SO_RCVBUF is not set
598 | # CONFIG_LWIP_NETBUF_RECVINFO is not set
599 | CONFIG_LWIP_IP_FRAG=y
600 | # CONFIG_LWIP_IP_REASSEMBLY is not set
601 | # CONFIG_LWIP_STATS is not set
602 | # CONFIG_LWIP_ETHARP_TRUST_IP_MAC is not set
603 | CONFIG_LWIP_ESP_GRATUITOUS_ARP=y
604 | CONFIG_LWIP_GARP_TMR_INTERVAL=60
605 | CONFIG_LWIP_TCPIP_RECVMBOX_SIZE=32
606 | CONFIG_LWIP_DHCP_DOES_ARP_CHECK=y
607 | # CONFIG_LWIP_DHCP_RESTORE_LAST_IP is not set
608 |
609 | #
610 | # DHCP server
611 | #
612 | CONFIG_LWIP_DHCPS_LEASE_UNIT=60
613 | CONFIG_LWIP_DHCPS_MAX_STATION_NUM=8
614 | # end of DHCP server
615 |
616 | # CONFIG_LWIP_AUTOIP is not set
617 | # CONFIG_LWIP_IPV6_AUTOCONFIG is not set
618 | CONFIG_LWIP_NETIF_LOOPBACK=y
619 | CONFIG_LWIP_LOOPBACK_MAX_PBUFS=8
620 |
621 | #
622 | # TCP
623 | #
624 | CONFIG_LWIP_MAX_ACTIVE_TCP=16
625 | CONFIG_LWIP_MAX_LISTENING_TCP=16
626 | CONFIG_LWIP_TCP_MAXRTX=12
627 | CONFIG_LWIP_TCP_SYNMAXRTX=6
628 | CONFIG_LWIP_TCP_MSS=1440
629 | CONFIG_LWIP_TCP_TMR_INTERVAL=250
630 | CONFIG_LWIP_TCP_MSL=60000
631 | CONFIG_LWIP_TCP_SND_BUF_DEFAULT=5744
632 | CONFIG_LWIP_TCP_WND_DEFAULT=5744
633 | CONFIG_LWIP_TCP_RECVMBOX_SIZE=6
634 | CONFIG_LWIP_TCP_QUEUE_OOSEQ=y
635 | # CONFIG_LWIP_TCP_SACK_OUT is not set
636 | # CONFIG_LWIP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set
637 | CONFIG_LWIP_TCP_OVERSIZE_MSS=y
638 | # CONFIG_LWIP_TCP_OVERSIZE_QUARTER_MSS is not set
639 | # CONFIG_LWIP_TCP_OVERSIZE_DISABLE is not set
640 | # end of TCP
641 |
642 | #
643 | # UDP
644 | #
645 | CONFIG_LWIP_MAX_UDP_PCBS=16
646 | CONFIG_LWIP_UDP_RECVMBOX_SIZE=6
647 | # end of UDP
648 |
649 | CONFIG_LWIP_TCPIP_TASK_STACK_SIZE=3072
650 | CONFIG_LWIP_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
651 | # CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU0 is not set
652 | # CONFIG_LWIP_TCPIP_TASK_AFFINITY_CPU1 is not set
653 | CONFIG_LWIP_TCPIP_TASK_AFFINITY=0x7FFFFFFF
654 | # CONFIG_LWIP_PPP_SUPPORT is not set
655 |
656 | #
657 | # ICMP
658 | #
659 | # CONFIG_LWIP_MULTICAST_PING is not set
660 | # CONFIG_LWIP_BROADCAST_PING is not set
661 | # end of ICMP
662 |
663 | #
664 | # LWIP RAW API
665 | #
666 | CONFIG_LWIP_MAX_RAW_PCBS=16
667 | # end of LWIP RAW API
668 |
669 | #
670 | # SNTP
671 | #
672 | CONFIG_LWIP_DHCP_MAX_NTP_SERVERS=1
673 | CONFIG_LWIP_SNTP_UPDATE_DELAY=3600000
674 | # end of SNTP
675 | # end of LWIP
676 |
677 | #
678 | # mbedTLS
679 | #
680 | CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC=y
681 | # CONFIG_MBEDTLS_DEFAULT_MEM_ALLOC is not set
682 | # CONFIG_MBEDTLS_CUSTOM_MEM_ALLOC is not set
683 | CONFIG_MBEDTLS_ASYMMETRIC_CONTENT_LEN=y
684 | CONFIG_MBEDTLS_SSL_IN_CONTENT_LEN=16384
685 | CONFIG_MBEDTLS_SSL_OUT_CONTENT_LEN=4096
686 | # CONFIG_MBEDTLS_DEBUG is not set
687 | # CONFIG_MBEDTLS_ECP_RESTARTABLE is not set
688 | # CONFIG_MBEDTLS_CMAC_C is not set
689 | CONFIG_MBEDTLS_HARDWARE_AES=y
690 | CONFIG_MBEDTLS_HARDWARE_MPI=y
691 | CONFIG_MBEDTLS_HARDWARE_SHA=y
692 | CONFIG_MBEDTLS_HAVE_TIME=y
693 | # CONFIG_MBEDTLS_HAVE_TIME_DATE is not set
694 | CONFIG_MBEDTLS_TLS_SERVER_AND_CLIENT=y
695 | # CONFIG_MBEDTLS_TLS_SERVER_ONLY is not set
696 | # CONFIG_MBEDTLS_TLS_CLIENT_ONLY is not set
697 | # CONFIG_MBEDTLS_TLS_DISABLED is not set
698 | CONFIG_MBEDTLS_TLS_SERVER=y
699 | CONFIG_MBEDTLS_TLS_CLIENT=y
700 | CONFIG_MBEDTLS_TLS_ENABLED=y
701 |
702 | #
703 | # TLS Key Exchange Methods
704 | #
705 | CONFIG_MBEDTLS_PSK_MODES=y
706 | CONFIG_MBEDTLS_KEY_EXCHANGE_PSK=y
707 | CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_PSK=y
708 | CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_PSK=y
709 | CONFIG_MBEDTLS_KEY_EXCHANGE_RSA_PSK=y
710 | CONFIG_MBEDTLS_KEY_EXCHANGE_RSA=y
711 | CONFIG_MBEDTLS_KEY_EXCHANGE_DHE_RSA=y
712 | CONFIG_MBEDTLS_KEY_EXCHANGE_ELLIPTIC_CURVE=y
713 | CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_RSA=y
714 | CONFIG_MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA=y
715 | CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA=y
716 | CONFIG_MBEDTLS_KEY_EXCHANGE_ECDH_RSA=y
717 | # end of TLS Key Exchange Methods
718 |
719 | CONFIG_MBEDTLS_SSL_RENEGOTIATION=y
720 | # CONFIG_MBEDTLS_SSL_PROTO_SSL3 is not set
721 | CONFIG_MBEDTLS_SSL_PROTO_TLS1=y
722 | CONFIG_MBEDTLS_SSL_PROTO_TLS1_1=y
723 | CONFIG_MBEDTLS_SSL_PROTO_TLS1_2=y
724 | CONFIG_MBEDTLS_SSL_PROTO_DTLS=y
725 | CONFIG_MBEDTLS_SSL_ALPN=y
726 | CONFIG_MBEDTLS_CLIENT_SSL_SESSION_TICKETS=y
727 | CONFIG_MBEDTLS_SERVER_SSL_SESSION_TICKETS=y
728 |
729 | #
730 | # Symmetric Ciphers
731 | #
732 | CONFIG_MBEDTLS_AES_C=y
733 | # CONFIG_MBEDTLS_CAMELLIA_C is not set
734 | # CONFIG_MBEDTLS_DES_C is not set
735 | CONFIG_MBEDTLS_RC4_DISABLED=y
736 | # CONFIG_MBEDTLS_RC4_ENABLED_NO_DEFAULT is not set
737 | # CONFIG_MBEDTLS_RC4_ENABLED is not set
738 | # CONFIG_MBEDTLS_BLOWFISH_C is not set
739 | # CONFIG_MBEDTLS_XTEA_C is not set
740 | CONFIG_MBEDTLS_CCM_C=y
741 | CONFIG_MBEDTLS_GCM_C=y
742 | # end of Symmetric Ciphers
743 |
744 | # CONFIG_MBEDTLS_RIPEMD160_C is not set
745 |
746 | #
747 | # Certificates
748 | #
749 | CONFIG_MBEDTLS_PEM_PARSE_C=y
750 | CONFIG_MBEDTLS_PEM_WRITE_C=y
751 | CONFIG_MBEDTLS_X509_CRL_PARSE_C=y
752 | CONFIG_MBEDTLS_X509_CSR_PARSE_C=y
753 | # end of Certificates
754 |
755 | CONFIG_MBEDTLS_ECP_C=y
756 | CONFIG_MBEDTLS_ECDH_C=y
757 | CONFIG_MBEDTLS_ECDSA_C=y
758 | CONFIG_MBEDTLS_ECP_DP_SECP192R1_ENABLED=y
759 | CONFIG_MBEDTLS_ECP_DP_SECP224R1_ENABLED=y
760 | CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED=y
761 | CONFIG_MBEDTLS_ECP_DP_SECP384R1_ENABLED=y
762 | CONFIG_MBEDTLS_ECP_DP_SECP521R1_ENABLED=y
763 | CONFIG_MBEDTLS_ECP_DP_SECP192K1_ENABLED=y
764 | CONFIG_MBEDTLS_ECP_DP_SECP224K1_ENABLED=y
765 | CONFIG_MBEDTLS_ECP_DP_SECP256K1_ENABLED=y
766 | CONFIG_MBEDTLS_ECP_DP_BP256R1_ENABLED=y
767 | CONFIG_MBEDTLS_ECP_DP_BP384R1_ENABLED=y
768 | CONFIG_MBEDTLS_ECP_DP_BP512R1_ENABLED=y
769 | CONFIG_MBEDTLS_ECP_DP_CURVE25519_ENABLED=y
770 | CONFIG_MBEDTLS_ECP_NIST_OPTIM=y
771 | # CONFIG_MBEDTLS_SECURITY_RISKS is not set
772 | # end of mbedTLS
773 |
774 | #
775 | # mDNS
776 | #
777 | CONFIG_MDNS_MAX_SERVICES=10
778 | CONFIG_MDNS_TASK_PRIORITY=1
779 | # CONFIG_MDNS_TASK_AFFINITY_NO_AFFINITY is not set
780 | CONFIG_MDNS_TASK_AFFINITY_CPU0=y
781 | # CONFIG_MDNS_TASK_AFFINITY_CPU1 is not set
782 | CONFIG_MDNS_TASK_AFFINITY=0x0
783 | CONFIG_MDNS_SERVICE_ADD_TIMEOUT_MS=2000
784 | CONFIG_MDNS_TIMER_PERIOD_MS=100
785 | # end of mDNS
786 |
787 | #
788 | # ESP-MQTT Configurations
789 | #
790 | CONFIG_MQTT_PROTOCOL_311=y
791 | CONFIG_MQTT_TRANSPORT_SSL=y
792 | CONFIG_MQTT_TRANSPORT_WEBSOCKET=y
793 | CONFIG_MQTT_TRANSPORT_WEBSOCKET_SECURE=y
794 | # CONFIG_MQTT_USE_CUSTOM_CONFIG is not set
795 | # CONFIG_MQTT_TASK_CORE_SELECTION_ENABLED is not set
796 | # CONFIG_MQTT_CUSTOM_OUTBOX is not set
797 | # end of ESP-MQTT Configurations
798 |
799 | #
800 | # Newlib
801 | #
802 | CONFIG_NEWLIB_STDOUT_LINE_ENDING_CRLF=y
803 | # CONFIG_NEWLIB_STDOUT_LINE_ENDING_LF is not set
804 | # CONFIG_NEWLIB_STDOUT_LINE_ENDING_CR is not set
805 | # CONFIG_NEWLIB_STDIN_LINE_ENDING_CRLF is not set
806 | # CONFIG_NEWLIB_STDIN_LINE_ENDING_LF is not set
807 | CONFIG_NEWLIB_STDIN_LINE_ENDING_CR=y
808 | # CONFIG_NEWLIB_NANO_FORMAT is not set
809 | # end of Newlib
810 |
811 | #
812 | # NVS
813 | #
814 | # end of NVS
815 |
816 | #
817 | # OpenSSL
818 | #
819 | # CONFIG_OPENSSL_DEBUG is not set
820 | # CONFIG_OPENSSL_ASSERT_DO_NOTHING is not set
821 | CONFIG_OPENSSL_ASSERT_EXIT=y
822 | # end of OpenSSL
823 |
824 | #
825 | # PThreads
826 | #
827 | CONFIG_PTHREAD_TASK_PRIO_DEFAULT=5
828 | CONFIG_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072
829 | CONFIG_PTHREAD_STACK_MIN=768
830 | CONFIG_PTHREAD_DEFAULT_CORE_NO_AFFINITY=y
831 | # CONFIG_PTHREAD_DEFAULT_CORE_0 is not set
832 | # CONFIG_PTHREAD_DEFAULT_CORE_1 is not set
833 | CONFIG_PTHREAD_TASK_CORE_DEFAULT=-1
834 | CONFIG_PTHREAD_TASK_NAME_DEFAULT="pthread"
835 | # end of PThreads
836 |
837 | #
838 | # SPI Flash driver
839 | #
840 | # CONFIG_SPI_FLASH_VERIFY_WRITE is not set
841 | # CONFIG_SPI_FLASH_ENABLE_COUNTERS is not set
842 | CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y
843 | CONFIG_SPI_FLASH_DANGEROUS_WRITE_ABORTS=y
844 | # CONFIG_SPI_FLASH_DANGEROUS_WRITE_FAILS is not set
845 | # CONFIG_SPI_FLASH_DANGEROUS_WRITE_ALLOWED is not set
846 | # CONFIG_SPI_FLASH_USE_LEGACY_IMPL is not set
847 |
848 | #
849 | # Auto-detect flash chips
850 | #
851 | CONFIG_SPI_FLASH_SUPPORT_ISSI_CHIP=y
852 | CONFIG_SPI_FLASH_SUPPORT_GD_CHIP=y
853 | # end of Auto-detect flash chips
854 | # end of SPI Flash driver
855 |
856 | #
857 | # SPIFFS Configuration
858 | #
859 | CONFIG_SPIFFS_MAX_PARTITIONS=3
860 |
861 | #
862 | # SPIFFS Cache Configuration
863 | #
864 | CONFIG_SPIFFS_CACHE=y
865 | CONFIG_SPIFFS_CACHE_WR=y
866 | # CONFIG_SPIFFS_CACHE_STATS is not set
867 | # end of SPIFFS Cache Configuration
868 |
869 | CONFIG_SPIFFS_PAGE_CHECK=y
870 | CONFIG_SPIFFS_GC_MAX_RUNS=10
871 | # CONFIG_SPIFFS_GC_STATS is not set
872 | CONFIG_SPIFFS_PAGE_SIZE=256
873 | CONFIG_SPIFFS_OBJ_NAME_LEN=32
874 | # CONFIG_SPIFFS_FOLLOW_SYMLINKS is not set
875 | CONFIG_SPIFFS_USE_MAGIC=y
876 | CONFIG_SPIFFS_USE_MAGIC_LENGTH=y
877 | CONFIG_SPIFFS_META_LENGTH=4
878 | CONFIG_SPIFFS_USE_MTIME=y
879 |
880 | #
881 | # Debug Configuration
882 | #
883 | # CONFIG_SPIFFS_DBG is not set
884 | # CONFIG_SPIFFS_API_DBG is not set
885 | # CONFIG_SPIFFS_GC_DBG is not set
886 | # CONFIG_SPIFFS_CACHE_DBG is not set
887 | # CONFIG_SPIFFS_CHECK_DBG is not set
888 | # CONFIG_SPIFFS_TEST_VISUALISATION is not set
889 | # end of Debug Configuration
890 | # end of SPIFFS Configuration
891 |
892 | #
893 | # Unity unit testing library
894 | #
895 | CONFIG_UNITY_ENABLE_FLOAT=y
896 | CONFIG_UNITY_ENABLE_DOUBLE=y
897 | # CONFIG_UNITY_ENABLE_COLOR is not set
898 | CONFIG_UNITY_ENABLE_IDF_TEST_RUNNER=y
899 | # CONFIG_UNITY_ENABLE_FIXTURE is not set
900 | # CONFIG_UNITY_ENABLE_BACKTRACE_ON_FAIL is not set
901 | # end of Unity unit testing library
902 |
903 | #
904 | # Virtual file system
905 | #
906 | CONFIG_VFS_SUPPRESS_SELECT_DEBUG_OUTPUT=y
907 | CONFIG_VFS_SUPPORT_TERMIOS=y
908 |
909 | #
910 | # Host File System I/O (Semihosting)
911 | #
912 | CONFIG_SEMIHOSTFS_MAX_MOUNT_POINTS=1
913 | CONFIG_SEMIHOSTFS_HOST_PATH_MAX_LEN=128
914 | # end of Host File System I/O (Semihosting)
915 | # end of Virtual file system
916 |
917 | #
918 | # Wear Levelling
919 | #
920 | # CONFIG_WL_SECTOR_SIZE_512 is not set
921 | CONFIG_WL_SECTOR_SIZE_4096=y
922 | CONFIG_WL_SECTOR_SIZE=4096
923 | # end of Wear Levelling
924 |
925 | #
926 | # Wi-Fi Provisioning Manager
927 | #
928 | CONFIG_WIFI_PROV_SCAN_MAX_ENTRIES=16
929 | CONFIG_WIFI_PROV_AUTOSTOP_TIMEOUT=30
930 | # end of Wi-Fi Provisioning Manager
931 |
932 | #
933 | # Supplicant
934 | #
935 | CONFIG_WPA_MBEDTLS_CRYPTO=y
936 | # CONFIG_WPA_DEBUG_PRINT is not set
937 | # end of Supplicant
938 | # end of Component config
939 |
940 | #
941 | # Compatibility options
942 | #
943 | # CONFIG_LEGACY_INCLUDE_COMMON_HEADERS is not set
944 | # end of Compatibility options
945 |
946 | # Deprecated options for backward compatibility
947 | CONFIG_TOOLPREFIX="xtensa-esp32-elf-"
948 | # CONFIG_LOG_BOOTLOADER_LEVEL_NONE is not set
949 | # CONFIG_LOG_BOOTLOADER_LEVEL_ERROR is not set
950 | CONFIG_LOG_BOOTLOADER_LEVEL_WARN=y
951 | # CONFIG_LOG_BOOTLOADER_LEVEL_INFO is not set
952 | # CONFIG_LOG_BOOTLOADER_LEVEL_DEBUG is not set
953 | # CONFIG_LOG_BOOTLOADER_LEVEL_VERBOSE is not set
954 | CONFIG_LOG_BOOTLOADER_LEVEL=2
955 | # CONFIG_APP_ROLLBACK_ENABLE is not set
956 | # CONFIG_FLASH_ENCRYPTION_ENABLED is not set
957 | # CONFIG_FLASHMODE_QIO is not set
958 | # CONFIG_FLASHMODE_QOUT is not set
959 | CONFIG_FLASHMODE_DIO=y
960 | # CONFIG_FLASHMODE_DOUT is not set
961 | # CONFIG_MONITOR_BAUD_9600B is not set
962 | # CONFIG_MONITOR_BAUD_57600B is not set
963 | CONFIG_MONITOR_BAUD_115200B=y
964 | # CONFIG_MONITOR_BAUD_230400B is not set
965 | # CONFIG_MONITOR_BAUD_921600B is not set
966 | # CONFIG_MONITOR_BAUD_2MB is not set
967 | # CONFIG_MONITOR_BAUD_OTHER is not set
968 | CONFIG_MONITOR_BAUD_OTHER_VAL=115200
969 | CONFIG_MONITOR_BAUD=115200
970 | CONFIG_COMPILER_OPTIMIZATION_LEVEL_DEBUG=y
971 | # CONFIG_COMPILER_OPTIMIZATION_LEVEL_RELEASE is not set
972 | CONFIG_OPTIMIZATION_ASSERTIONS_ENABLED=y
973 | # CONFIG_OPTIMIZATION_ASSERTIONS_SILENT is not set
974 | # CONFIG_OPTIMIZATION_ASSERTIONS_DISABLED is not set
975 | # CONFIG_CXX_EXCEPTIONS is not set
976 | CONFIG_STACK_CHECK_NONE=y
977 | # CONFIG_STACK_CHECK_NORM is not set
978 | # CONFIG_STACK_CHECK_STRONG is not set
979 | # CONFIG_STACK_CHECK_ALL is not set
980 | # CONFIG_WARN_WRITE_STRINGS is not set
981 | # CONFIG_DISABLE_GCC8_WARNINGS is not set
982 | # CONFIG_ESP32_APPTRACE_DEST_TRAX is not set
983 | CONFIG_ESP32_APPTRACE_DEST_NONE=y
984 | CONFIG_ESP32_APPTRACE_LOCK_ENABLE=y
985 | CONFIG_BTDM_CONTROLLER_BLE_MAX_CONN_EFF=0
986 | CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_ACL_CONN_EFF=0
987 | CONFIG_BTDM_CONTROLLER_BR_EDR_MAX_SYNC_CONN_EFF=0
988 | CONFIG_BTDM_CONTROLLER_PINNED_TO_CORE=0
989 | CONFIG_ADC2_DISABLE_DAC=y
990 | # CONFIG_SPIRAM_SUPPORT is not set
991 | CONFIG_TRACEMEM_RESERVE_DRAM=0x0
992 | # CONFIG_TWO_UNIVERSAL_MAC_ADDRESS is not set
993 | CONFIG_FOUR_UNIVERSAL_MAC_ADDRESS=y
994 | CONFIG_NUMBER_OF_UNIVERSAL_MAC_ADDRESS=4
995 | # CONFIG_ULP_COPROC_ENABLED is not set
996 | CONFIG_ULP_COPROC_RESERVE_MEM=0
997 | CONFIG_BROWNOUT_DET=y
998 | CONFIG_BROWNOUT_DET_LVL_SEL_0=y
999 | # CONFIG_BROWNOUT_DET_LVL_SEL_1 is not set
1000 | # CONFIG_BROWNOUT_DET_LVL_SEL_2 is not set
1001 | # CONFIG_BROWNOUT_DET_LVL_SEL_3 is not set
1002 | # CONFIG_BROWNOUT_DET_LVL_SEL_4 is not set
1003 | # CONFIG_BROWNOUT_DET_LVL_SEL_5 is not set
1004 | # CONFIG_BROWNOUT_DET_LVL_SEL_6 is not set
1005 | # CONFIG_BROWNOUT_DET_LVL_SEL_7 is not set
1006 | CONFIG_BROWNOUT_DET_LVL=0
1007 | CONFIG_REDUCE_PHY_TX_POWER=y
1008 | CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_RC=y
1009 | # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_CRYSTAL is not set
1010 | # CONFIG_ESP32_RTC_CLOCK_SOURCE_EXTERNAL_OSC is not set
1011 | # CONFIG_ESP32_RTC_CLOCK_SOURCE_INTERNAL_8MD256 is not set
1012 | # CONFIG_DISABLE_BASIC_ROM_CONSOLE is not set
1013 | # CONFIG_NO_BLOBS is not set
1014 | # CONFIG_COMPATIBLE_PRE_V2_1_BOOTLOADERS is not set
1015 | CONFIG_SYSTEM_EVENT_QUEUE_SIZE=32
1016 | CONFIG_SYSTEM_EVENT_TASK_STACK_SIZE=2304
1017 | CONFIG_MAIN_TASK_STACK_SIZE=7168
1018 | CONFIG_IPC_TASK_STACK_SIZE=1024
1019 | CONFIG_CONSOLE_UART_DEFAULT=y
1020 | # CONFIG_CONSOLE_UART_CUSTOM is not set
1021 | # CONFIG_CONSOLE_UART_NONE is not set
1022 | CONFIG_CONSOLE_UART_NUM=0
1023 | CONFIG_CONSOLE_UART_BAUDRATE=115200
1024 | CONFIG_INT_WDT=y
1025 | CONFIG_INT_WDT_TIMEOUT_MS=300
1026 | CONFIG_INT_WDT_CHECK_CPU1=y
1027 | CONFIG_TASK_WDT=y
1028 | # CONFIG_TASK_WDT_PANIC is not set
1029 | CONFIG_TASK_WDT_TIMEOUT_S=5
1030 | CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU0=y
1031 | CONFIG_TASK_WDT_CHECK_IDLE_TASK_CPU1=y
1032 | # CONFIG_EVENT_LOOP_PROFILING is not set
1033 | CONFIG_POST_EVENTS_FROM_ISR=y
1034 | CONFIG_POST_EVENTS_FROM_IRAM_ISR=y
1035 | CONFIG_TIMER_TASK_STACK_SIZE=3584
1036 | CONFIG_MB_MASTER_TIMEOUT_MS_RESPOND=150
1037 | CONFIG_MB_MASTER_DELAY_MS_CONVERT=200
1038 | CONFIG_MB_QUEUE_LENGTH=20
1039 | CONFIG_MB_SERIAL_TASK_STACK_SIZE=2048
1040 | CONFIG_MB_SERIAL_BUF_SIZE=256
1041 | CONFIG_MB_SERIAL_TASK_PRIO=10
1042 | # CONFIG_MB_CONTROLLER_SLAVE_ID_SUPPORT is not set
1043 | CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT=20
1044 | CONFIG_MB_CONTROLLER_NOTIFY_QUEUE_SIZE=20
1045 | CONFIG_MB_CONTROLLER_STACK_SIZE=4096
1046 | CONFIG_MB_EVENT_QUEUE_TIMEOUT=20
1047 | CONFIG_MB_TIMER_PORT_ENABLED=y
1048 | CONFIG_MB_TIMER_GROUP=0
1049 | CONFIG_MB_TIMER_INDEX=0
1050 | # CONFIG_SUPPORT_STATIC_ALLOCATION is not set
1051 | CONFIG_TIMER_TASK_PRIORITY=1
1052 | CONFIG_TIMER_TASK_STACK_DEPTH=2048
1053 | CONFIG_TIMER_QUEUE_LENGTH=10
1054 | CONFIG_L2_TO_L3_COPY=y
1055 | # CONFIG_USE_ONLY_LWIP_SELECT is not set
1056 | CONFIG_ESP_GRATUITOUS_ARP=y
1057 | CONFIG_GARP_TMR_INTERVAL=60
1058 | CONFIG_TCPIP_RECVMBOX_SIZE=32
1059 | CONFIG_TCP_MAXRTX=12
1060 | CONFIG_TCP_SYNMAXRTX=6
1061 | CONFIG_TCP_MSS=1440
1062 | CONFIG_TCP_MSL=60000
1063 | CONFIG_TCP_SND_BUF_DEFAULT=5744
1064 | CONFIG_TCP_WND_DEFAULT=5744
1065 | CONFIG_TCP_RECVMBOX_SIZE=6
1066 | CONFIG_TCP_QUEUE_OOSEQ=y
1067 | # CONFIG_ESP_TCP_KEEP_CONNECTION_WHEN_IP_CHANGES is not set
1068 | CONFIG_TCP_OVERSIZE_MSS=y
1069 | # CONFIG_TCP_OVERSIZE_QUARTER_MSS is not set
1070 | # CONFIG_TCP_OVERSIZE_DISABLE is not set
1071 | CONFIG_UDP_RECVMBOX_SIZE=6
1072 | CONFIG_TCPIP_TASK_STACK_SIZE=3072
1073 | CONFIG_TCPIP_TASK_AFFINITY_NO_AFFINITY=y
1074 | # CONFIG_TCPIP_TASK_AFFINITY_CPU0 is not set
1075 | # CONFIG_TCPIP_TASK_AFFINITY_CPU1 is not set
1076 | CONFIG_TCPIP_TASK_AFFINITY=0x7FFFFFFF
1077 | # CONFIG_PPP_SUPPORT is not set
1078 | CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT=5
1079 | CONFIG_ESP32_PTHREAD_TASK_STACK_SIZE_DEFAULT=3072
1080 | CONFIG_ESP32_PTHREAD_STACK_MIN=768
1081 | CONFIG_ESP32_DEFAULT_PTHREAD_CORE_NO_AFFINITY=y
1082 | # CONFIG_ESP32_DEFAULT_PTHREAD_CORE_0 is not set
1083 | # CONFIG_ESP32_DEFAULT_PTHREAD_CORE_1 is not set
1084 | CONFIG_ESP32_PTHREAD_TASK_CORE_DEFAULT=-1
1085 | CONFIG_ESP32_PTHREAD_TASK_NAME_DEFAULT="pthread"
1086 | CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y
1087 | # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS is not set
1088 | # CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED is not set
1089 | CONFIG_SUPPRESS_SELECT_DEBUG_OUTPUT=y
1090 | CONFIG_SUPPORT_TERMIOS=y
1091 | # End of deprecated options
1092 |
--------------------------------------------------------------------------------
/sdkconfig.ci.history:
--------------------------------------------------------------------------------
1 | CONFIG_STORE_HISTORY=y
2 |
--------------------------------------------------------------------------------
/sdkconfig.ci.nohistory:
--------------------------------------------------------------------------------
1 | CONFIG_STORE_HISTORY=n
2 |
--------------------------------------------------------------------------------
/sdkconfig.defaults:
--------------------------------------------------------------------------------
1 | # Reduce bootloader log verbosity
2 | CONFIG_BOOTLOADER_LOG_LEVEL_WARN=y
3 | CONFIG_BOOTLOADER_LOG_LEVEL=2
4 |
5 | # Increase main task stack size
6 | CONFIG_ESP_MAIN_TASK_STACK_SIZE=7168
7 |
8 | # Enable filesystem
9 | CONFIG_PARTITION_TABLE_CUSTOM=y
10 | CONFIG_PARTITION_TABLE_CUSTOM_FILENAME="partitions_example.csv"
11 | CONFIG_PARTITION_TABLE_FILENAME="partitions_example.csv"
12 |
13 | # Enable FreeRTOS stats formatting functions, needed for 'tasks' command
14 | CONFIG_FREERTOS_USE_TRACE_FACILITY=y
15 | CONFIG_FREERTOS_USE_STATS_FORMATTING_FUNCTIONS=y
16 |
17 | CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y
18 |
19 | # LWIP
20 | CONFIG_LWIP_L2_TO_L3_COPY=y
21 |
--------------------------------------------------------------------------------