Setup for debugging Arduino and LwIP behaviour under full ESP-IDF build system.
- Init submodules
git submodule update --init --recursive
Due to a Arduino having C++-ish compilation rules a patch in components/AsyncTCP/CMakeLists.txt
is required to compile the project.
target_compile_options(${COMPONENT_TARGET} PRIVATE -fno-rtti -Wno-error=address)
- Setup the ESP-IDF environment
Install recommended ESP-IDF extension for VSCode. Run >ESP-IDF: Configure ESP-IDF Extension
and follow configuration steps.
Personally I have installed the ESP-IDF toolchain files to seperate folders to accomodate multiple versions of the ESP-IDF:
~/esp-idf
v4/
tools-v4/
v5/
tools-v5/
To do this select Advanced
installation and set the ESP-IDF Path
and ESP-IDF Tools Path
to the appropriate folders.
- Setup and build
Open terminal via >ESP-IDF: Open ESP-IDF Terminal
task and setup WiFi in Example Connection Configuration
menu:
idf.py menuconfig
Exit and save the configuration. Then build the project:
idf.py build
- Flash and monitor
idf.py flash monitor
# or use a better serial monitor
idf.py flash && tio /dev/ttyACM0 -b 115200
Built-in monitor can by closed by pressing Ctrl+]
. To close tio
press Ctrl+t
q
.
Launch Launch
configuration in VSCode Run and Debug
tab. This will start the GDB server and attach to the target. You can now set breakpoints and inspect the code.
Good luck.