安信可科技

How to configure ESP32 Menuconfig



How to configure ESP32 Menuconfig

Preparation

We can enter menuconfig mode in 2 ways

1 Start MenuConfig Target on the Eclipse interface (refer to 如何使用安信可 ESP 系列一体化开发环境 IDF chapter);

2 Open Cygwin.bat, enter the project directory, and execute the make menuconfig command.

The final results of these two methods are the same, you can choose according to your needs.

Introduction

After executing make menuconfig , the interface displays as follows:

among them:

Item Remarks
SDK tool configuration Configure the information of the SDK development tool chain, generally do not need to modify it when you have not compiled your own tool chain
Bootloader config Configure the log printing level when BootLoader starts
Serial flasher config Configure the port, baud rate, Flash mode, Flash frequency, compression upload, etc. used for serial port downloading
Partition Table Configure partition information, choose default partition configuration or custom partition configuration
Component config Component configuration including special configuration of ESP32, WiFi configuration, BLE configuration, FreeRTOS configuration, LWIP configuration, log configuration, SPI configuration, user program custom configuration, etc.

The configuration meaning of each item is explained separately below. All remarks are for personal understanding. Please try to follow the [Help] menu display in the configuration menu as the standard.

SDK tool configuration

Item Default value Remarks
Compiler toolchain path/prefix xtensa-esp32-elf- Generally, this configuration item does not need to be configured, unless you compile the cross-compilation chain yourself and use a different name from xtensa-esp32-elf-.
Python 2 interpreter python The name of the python 2 interpreter, generally the default is python.

Bootloader config

Item Remarks
Bootloader log verbosityWarning Here you can configure the log printing level of BootLoader. The higher the level, the more log information will be printed. You can choose the appropriate level according to your needs. The order of
level is: No output <Error <Warning <Info <Debug <Verbose.

Serial flasher config

Item Default value Remarks
Default serial port /dev/ttyUSB0 COM1 under windows corresponds to /dev/ttyS0 under cygwin, COM2 corresponds to ttyS1, and so on.
Default baud rate 921600You can choose 230400/921600/2M/Other baud rate. If you choose Other baud rate, you need to manually enter the download rate you think is available below. The current maximum download rate of ESP32 is 1152000.
Use compressed upload YesWhether to choose compressed upload can increase the speed of firmware download.
Flash SPI mode DIO SPI operating mode, recommended DIO mode
Flash SPI speed 40MHZ SPI speed, need to be configured according to your own Flash model, some models of Flash do not support too high speed.

Partition Table

Item Default value Optional value Remarks
Partition Table Single factory app, no OTA Single factory app, no OTA
Factory app, two OTA definitions
Custom partition table CSV
The default partition file address is: components/partition_table
Generally use Single factory app, no OTA.
Custom partition can refer to the following example

How to modify a custom partition table

Take the spiffs partition of NodeMCU as an example:

1 Check Custom partition table CSV

2 Enter the customized partition information file name in Custom partition table CSV: partitions-2MB.csv

3 Create a partitions-2MB.csv file in the root directory of the project (refer to components/platform/partitions-2MB.csv)

# Espressif ESP32 Partition Table
# Name Type SubType Offset Size
factory app factory 0x10000 1M
rfdata data rf 0x110000 256K
wifidata data wifi 0x150000 256K
# 0xC2 ⇒ NodeMCU 0x0 ⇒ Spiffs
spiffs 0xC2 0x0 448K

4 Compile and download.

For specific partition usage details, please refer to https://github.com/espressif/esp-idf/blob/master/docs/partition-tables.rst

Component config

How to configure ESP32 Menuconfig

Preparation

We can enter menuconfig mode in 2 ways

1 Start MenuConfig Target on the Eclipse interface (refer to 如何使用安信可 ESP 系列一体化开发环境 IDF chapter);

2 Open Cygwin.bat, enter the project directory, and execute the make menuconfig command.

The final results of these two methods are the same, you can choose according to your needs.

Introduction

After executing make menuconfig , the interface displays as follows:

among them:

Item Remarks
SDK tool configuration Configure the information of the SDK development tool chain, generally do not need to modify it when you have not compiled your own tool chain
Bootloader config Configure the log printing level when BootLoader starts
Serial flasher config Configure the port, baud rate, Flash mode, Flash frequency, compression upload, etc. used for serial port downloading
Partition Table Configure partition information, choose default partition configuration or custom partition configuration
Component config Component configuration including special configuration of ESP32, WiFi configuration, BLE configuration, FreeRTOS configuration, LWIP configuration, log configuration, SPI configuration, user program custom configuration, etc.

The configuration meaning of each item is explained separately below. All remarks are for personal understanding. Please try to follow the [Help] menu display in the configuration menu as the standard.

SDK tool configuration

Item Default value Remarks
Compiler toolchain path/prefix xtensa-esp32-elf- Generally, this configuration item does not need to be configured, unless you compile the cross-compilation chain yourself and use a different name from xtensa-esp32-elf-.
Python 2 interpreter python The name of the python 2 interpreter, generally the default is python.

Bootloader config

Item Remarks
Bootloader log verbosityWarning Here you can configure the log printing level of BootLoader. The higher the level, the more log information will be printed. You can choose the appropriate level according to your needs. The order of
level is: No output <Error <Warning <Info <Debug <Verbose.

Serial flasher config

Item Default value Remarks
Default serial port /dev/ttyUSB0 COM1 under windows corresponds to /dev/ttyS0 under cygwin, COM2 corresponds to ttyS1, and so on.
Default baud rate 921600You can choose 230400/921600/2M/Other baud rate. If you choose Other baud rate, you need to manually enter the download rate you think is available below. The current maximum download rate of ESP32 is 1152000.
Use compressed upload YesWhether to choose compressed upload can increase the speed of firmware download.
Flash SPI mode DIO SPI operating mode, recommended DIO mode
Flash SPI speed 40MHZ SPI speed, need to be configured according to your own Flash model, some models of Flash do not support too high speed.

Partition Table

Item Default value Optional value Remarks
Partition Table Single factory app, no OTA Single factory app, no OTA
Factory app, two OTA definitions
Custom partition table CSV
The default partition file address is: components/partition_table
Generally use Single factory app, no OTA.
Custom partition can refer to the following example

How to modify a custom partition table

Take the spiffs partition of NodeMCU as an example:

1 Check Custom partition table CSV

2 Enter the customized partition information file name in Custom partition table CSV: partitions-2MB.csv

3 Create a partitions-2MB.csv file in the root directory of the project (refer to components/platform/partitions-2MB.csv)

# Espressif ESP32 Partition Table
# Name Type SubType Offset Size
factory app factory 0x10000 1M
rfdata data rf 0x110000 256K
wifidata data wifi 0x150000 256K
# 0xC2 ⇒ NodeMCU 0x0 ⇒ Spiffs
spiffs 0xC2 0x0 448K

4 Compile and download.

For specific partition usage details, please refer to https://github.com/espressif/esp-idf/blob/master/docs/partition-tables.rst

Component config

ESP32-specific config

Item Remarks
CPU frequency (240 MHz) 80/160/240MHZ can be selected. The higher the CPU frequency, the higher the operating speed, but the more unstable it is.
Select stack to enable (WiFi or BT) You can choose to enable the WiFi or BT function. The current ESP32 WiFi and BT cannot coexist yet, only one can be reserved.
Reserve memory for two cores
Use TRAX tracing feature Whether to use the tracing feature of ESP32, it will occupy 16K of memory (per core), it is recommended to turn it off
Use external SPI SRAM chip as main memory Whether to use external SPI SRAM chip as main memory?
System event queue size System event queue size, the default is 32
Event loop task stack size The stack size of the system event task, the default is 2048
Main task stack size The stack size of the main task, the default is 4096
Standard-out output adds carriage return before newline Standard output data adds a carriage return (add CR before output LF)
Enable Ultra Low Power (ULP) Coprocessor Enable Ultra Low Power (ULP) Coprocessor

FreeRTOS

Item Remarks
Run FreeRTOS only on first core By default FreeRTOS runs on two cores. If you need to use other processes to control another core, you can enable this option. Proposal to ban
Xtensa timer to use as the FreeRTOS tick source FreeRTOS heartbeat clock source, the default is fine
Tick rate (Hz) FreeRTOS heart rate, the range is 1~1000
Halt when an SMP-untested function is called Stop running when an SMP-untested function is called (this translation is uncertain)
Check for stack overflow Check for stack overflow
Amount of thread local storage pointers The number of thread pointers that can be stored locally, the default is 1, the value range is 1~256, and it is at least 1 when using the WiFi stack
Panic handler behaviour How to deal with exceptions:
Print registers and halt
Print registers and reboot
Silent reboot
Invoke GDBStub
Make exception and panic handlers JTAG/OCD aware If the JTAG OCD debugger is detected when an exception occurs, stop the debugger directly at the location of the abnormal instruction
FreeRTOS assertions Whether to use configASSERT()
Stop program on scheduler start when JTAG/OCD is detected When the debugger is connected, stop the automatic start of the scheduler
Enable heap memory debug After opening, the Heap distribution can be displayed, and the memory crash can be found
Debug FreeRTOS internals Debug FreeRTOS internal components, printable information for debugging

Log output

Item Remarks
Default log verbosityThe default log printing level. The higher the level, the more log information will be printed. You can choose the appropriate level according to your needs. The order of
level is: No output <Error <Warning <Info <Debug <Verbose.
Use ANSI terminal colors in log outputWhether to enable color output, you need your serial port tool to support color display.

LWIP

Item Default value Remarks
Max number of open sockets 4 The maximum number of open sockets at the same time, the value is 1~16, too much memory will be consumed
Index for thread-local-storage pointer for lwip 0 Index of thread-local-storage pointer for lwip
Enable SO_REUSEADDR option NO Whether to enable the SO_REUSEADDR option, please refer to the following links for the function of this option:
http://www.cnblogs.com/mydomain/archive/2011/08/23/2150567 .html
http://blog.sina.com.cn/s/blog_53a2ecbf010095db.html
http://www.sudu.cn/info/html/edu/20050101 /296180.html

mbedTLS

Item Default value Remarks
TLS maximum message content length 16384 (bytes) TLS maximum message content length
Enable mbedTLS debugging NO Whether to enable mbedTLS debugging

SPI Flash driver

Item Default value Remarks
Enable operation counters NO Whether to enable SPI Flash usage statistics, you can call the following functions after enabling:
spi_flash_reset_counters
spi_flash_dump_counters
spi_flash_get_counters