Debug App on Linux Host

HiperDoo
Posts: 8
Joined: Fri Apr 14, 2023 7:13 pm

Debug App on Linux Host

Postby HiperDoo » Tue Aug 06, 2024 12:41 am

Good, I am getting more and more in my platform transition to ESP-IDF to take advantage of those unique characteristics that only this framework offers (from the Linux side).

Recently I stop with https://docs.espressif.com/projects/esp ... -apps.html which seemed very striking (mainly to do simple code debug without the need to have to wait 2 mins to compile and flash the code to my ESP32 board).
I successfully execute an ESP32 application on my computer with these simple commands (which also gives the link):

Code: Select all

idf.py --preview set-target linux
idf.py build
idf.py monitor
Everything is very good here. The problem is that I do not know how to take advantage of this characteristic, I speak of debugging the application. I used this https://docs.espressif.com/projects/esp ... th-idf-py to test if the GDB worked (and https://docs.espressif.com/projects/esp ... nd-line-01 section to try if GDB found something), but many of the mistakes and warnings are that the Linux target does not exist.

The only place where talk about the ability to run applications in the machine host is in the first link, I didn't find anything else in my internet search. There is also no clue to say if this is so even possible.
Otherwise it will be another application that I will have to debug with "printf()" that compiles faster and without having to use more hardware at hand.

M4L4SS1S3
Posts: 2
Joined: Tue Aug 06, 2024 3:44 am

Re: Debug App on Linux Host

Postby M4L4SS1S3 » Tue Aug 06, 2024 4:03 am

Hello Guy, I managed to make the debugging work via GDB by creating a permission file in the system rules in udev, in my case I use Debian, in /etc/udev/rules/70-openocd.rules
file contents:

ACTION!="add|change", GOTO="openocd_rules_end"
SUBSYSTEM=="gpio", MODE="0660", GROUP="plugdev", TAG+="uaccess"
SUBSYSTEM!="usb|tty|hidraw", GOTO="openocd_rules_end"
# USBprog with OpenOCD firmware
ATTRS{idVendor}=="1781", ATTRS{idProduct}=="0c63", MODE="660", GROUP="plugdev", TAG+="uaccess"
# Espressif USB JTAG/serial debug units
ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1001", MODE="660", GROUP="plugdev", TAG+="uaccess" ATTRS{idVendor}=="303a", ATTRS{idProduct}=="1002", MODE="660", GROUP="plugdev", TAG+="uaccess"

HiperDoo
Posts: 8
Joined: Fri Apr 14, 2023 7:13 pm

Re: Debug App on Linux Host

Postby HiperDoo » Tue Aug 06, 2024 3:38 pm

Hello M4L4SS1S3.
I am not talking about debugging the physical device (ESP32), in my post I mention that I have difficult debugging the application in the host machine (here there is no physical ESP32). So the permissions of udev are irrelevant in this post.

Important to read: https://docs.espressif.com/projects/esp ... -apps.html

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: Debug App on Linux Host

Postby ESP_Sprite » Wed Aug 07, 2024 3:25 am

The application that results from the compile is just your standard Linux executable. You can simply load it into the host GDB or any other debugger.

HiperDoo
Posts: 8
Joined: Fri Apr 14, 2023 7:13 pm

Re: Debug App on Linux Host

Postby HiperDoo » Wed Aug 07, 2024 3:32 pm

That is exactly my problem, it is not working, I guess it is a different procedure in this case, but I really do not know how I could make it work and I cannot find absolutely any information regarding this problem.

ESP_Sprite
Posts: 9764
Joined: Thu Nov 26, 2015 4:08 am

Re: Debug App on Linux Host

Postby ESP_Sprite » Thu Aug 08, 2024 1:17 am

Works for me.

Code: Select all

esp-idf/examples/get-started/hello_world$ idf.py --preview set-target linux
[..]
esp-idf/examples/get-started/hello_world$ idf.py build
[...]
esp-idf/examples/get-started/hello_world$ gdb build/hello_world.elf
GNU gdb (Debian 13.2-1+b2) 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from build/hello_world.elf...
(gdb)
Can you replicate that? If not, can you show what error you get?

Who is online

Users browsing this forum: brushlow18, MSN [Bot] and 201 guests