Your "platformio.ini" file should have at least these lines:
platform = espressif32
framework = arduino
board_build.partitions = partitions.csv
(like in the repo)
Copy the "partitions.csv" file to the root of your project. (like in the repo)
Either with the "PlatformIO Build" button or the "pio run" command.
1- Go to "/home/yourName/.platformio/packages/framework-arduinoespressif32" folder.
2- In the root of the repo, you can find the "out_01.zip" file, unzip the content of the "/out" folder in the "framework-arduinoespressif32" folder.
1) Either with the "PlatformIO Clean" button or the "pio run -t clean" command. 2) Either with the "PlatformIO Build" button or the "pio run" command.
You can find in /src/main.cpp, an example application. This code should crash after 10s and print the CoreDump in the setup() function. Run it and wait for the crash. At the next boot, you will see in the serial console the bytes of the coreDump:
4c160000010000000700000064010000
5880fb3fd01efb3f5420fb3f701efb3ff01
ffb3f2d270000b00dfc3fb00dfc3f5880fb
......
3fa80dfc3f18000000147efb3f147efb3f5
880fb3f00000000010000005800fb3f6c
0000000000000000000000000000000
Copy it and paste the base64 conversion to a file called "coreDump.b64" in the root of your project.
An example of a website which can convert bytes to base64: https://base64.guru/converter/encode/hex
As described in the website, install esp-idf: https://docs.espressif.com/projects/esp-idf/en/release-v3.3/get-started/index.html#get-esp-idf
cd ~/esp
git clone -b release/v3.3 --recursive https://github.com/espressif/esp-idf.git
cd esp-idf
. ./install.sh
. ./export.sh
git submodule update --init --recursive
Download package (link to the website here:https://docs.espressif.com/projects/esp-idf/en/release-v3.3/get-started/linux-setup.html):
for 64-bit Linux: https://dl.espressif.com/dl/xtensa-esp32-elf-linux64-1.22.0-97-gc752ad5-5.2.0.tar.gz
for 32-bit Linux: https://dl.espressif.com/dl/xtensa-esp32-elf-linux32-1.22.0-97-gc752ad5-5.2.0.tar.gz
Unzip it :
for 64-bit Linux:
cd ~/esp
tar -xzf ~/Downloads/xtensa-esp32-elf-linux64-1.22.0-97-gc752ad5-5.2.0.tar.gz
for 32-bit Linux:
cd ~/esp
tar -xzf ~/Downloads/xtensa-esp32-elf-linux32-1.22.0-97-gc752ad5-5.2.0.tar.gz
nano ~/.profile
Add these lines to the bottom of the file and save it :
export PATH="\$HOME/esp/xtensa-esp32-elf/bin:\$PATH"
export IDF_PATH=~/esp/esp-idf
export PATH="\$IDF_PATH/tools:\$PATH"
export PATH="\$IDF_PATH/components/espcoredump:\$PATH"
Reload the profile with the following command :
source ~/.profile
Install python requirements:
python -m pip install --user -r $IDF_PATH/requirements.txt
On Linux, you must install libncurses5 with the following command:
sudo apt-get install libncurses5
1- Open a terminal in your project folder.
2- To be sure that the path is loaded, you can reload it manually with:
source ~/.profile
3- Decode the coreDump with this command:
espcoredump.py info_corefile -c ./coreDump.b64 -t b64 -rom-elf ./.pio/build/esp32dev/firmware.elf
9) Understanding the output
Here is an example output:
There is a lot of details that you do not necessarily need to understand why the code crashed.
I usually go to the part with:
==================== CURRENT THREAD STACK =====================
And I try to find a function name that I have in my program. In that case, the crash occured in the loop() function at line 30.
0 0x400d0dd4 in loop () at src/main.cpp:30
At line 30 of my program, we can find this line:
27: Serial.println("RESTART ::");
28: int a = 0;
29: int b = 4;
30: Serial.printf("%d\n", b / a);
31: }