The development method of ESP32 is shown in the figure below:
Download code:
mkdir -p ~/esp
cd ~/esp
git clone --recursive https://github.com/espressif/esp-idf.git
ESP-IDF will be downloaded to~/esp/esp-idf
Install the tool chain:
Install toolchain, debugger, openocd, python package, etc., installed in the $HOME/.espressif
directory by default .
cd ~/esp/esp-idf
./install.sh
Download package catalog
Toolchain directory after installation:
Configure environment variables:
. $HOME/esp/esp-idf/export.sh
alias get_idf='. $HOME/esp/esp-idf/export.sh'
source ~/.bashrc
Create a project:
Create a helloworld project
cd ~/esp
cp -r $IDF_PATH/examples/get-started/hello_world .
Configuration and compilation:
cd ~/esp/hello_world
idf.py set-target esp32
idf.py menuconfig
idf.py set-target esp32
idf.py menuconfig
Save the default configuration
Compile:
idf.py build
Generated object file
Decompile:
xtensa-esp32-elf-objdump -d build/hello-world.elf >e.dis
esp-dsp project compilation:
ESP32 can be understood as a HIFI processor with a castrated DSP unit. Although it is not a DSP in essence, it uses the same Base ISA as the HIFI series. ESP-DSP is a community-developed algorithm library that uses DSP instructions to achieve acceleration on the ESP32. Support FIR, IIR, dot multiplication, matrix multiplication and other algorithm interfaces.
Download the code and enter the demo project:
cd ~/esp
git clone https://github.com/espressif/esp-dsp.git
cd esp-dsp/examples/dotprod
Compile:
idf.py build
Get the target file:
You can use the binutils tool to analyze the target file!
Toolchain verification:
Use the official xtensa tool chain xt-objdump to decompile hello_world.elf, which can be successful, which further shows that esp and hifi are the same ISA architecture.
But I found a problem, xt-objdump did not decompile the correct assembly instructions, and the output of the function after decompilation is bare instruction code. It seems that although ESP32 and HIFI are based on the same base ISA, there are still big differences in single-extension configuration. .
CONFIG_FREERTOS_BREAK_ON_SCHEDULER_START_JTAG机制:
It is said that in order to solve a BUG, ESP32 introduced a breakpoint at the entry task scheduled for the first time. The implementation process is as follows:
A breakpoint is inserted during runtime, and the closed source library function provided by espidf is called. Therefore, when debugging with jlink, you will find that it is broken at the beginning and you need to restart the pass breakpoint.