ESP32 – Programming Failed – You can't do that when your target is exec

Sysprogs forums Forums VisualGDB ESP32 – Programming Failed – You can't do that when your target is exec

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #21830
    nevyn
    Participant

    Ive been following two of the tutorials – firstly, basic connection of the ESP32 to Visual Studio using the Olimex ARM-USB-OCD-H to get the electrical connections to the board.

    The second tutorial uses ESP-IDF using the 5.4 Preview.

    I’ve double checked the wiring against the first tutorial, so confident that is good.

    I’ve just tried to program the ESP32 and I get the following debug output:

    VisualGDB is licensed to Mark Stevens
    -gdb-version
    =thread-group-added,id=”i1″
    ~”GNU gdb (GDB) 7.10\n”
    ~”Copyright (C) 2015 Free Software Foundation, Inc.\n”
    ~”License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt;\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \”show copying\”\nand \”show warranty\” for details.\n”
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt;
    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 \”–host=i686-pc-mingw32 –target=xtensa-esp32-elf\”.\nType \”show configuration\” for configuration details.”
    This GDB was configured as “–host=i686-pc-mingw32 –target=xtensa-esp32-elf”.
    Type “show configuration” for configuration details.
    ~”\nFor bug reporting instructions, please see:\n”
    ~”<http://www.gnu.org/software/gdb/bugs/&gt;.\n”
    ~”Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/&gt;.\n”
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/&gt;.
    ~”For help, type \”help\”.\n”
    ~”Type \”apropos word\” to search for commands related to \”word\”…\n”
    ~”Reading symbols from c:/NetduinoDev/ESP32Test/ESP32Test/Debug/hello-world.elf…”
    ~”done.\n”
    ~”GNU gdb (GDB) 7.10\n”
    ~”Copyright (C) 2015 Free Software Foundation, Inc.\n”
    ~”License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt;\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law. Type \”show copying\”\nand \”show warranty\” for details.\n”
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html&gt;
    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 \”–host=i686-pc-mingw32 –target=xtensa-esp32-elf\”.\nType \”show configuration\” for configuration details.”
    This GDB was configured as “–host=i686-pc-mingw32 –target=xtensa-esp32-elf”.
    Type “show configuration” for configuration details.
    ~”\nFor bug reporting instructions, please see:\n”
    ~”<http://www.gnu.org/software/gdb/bugs/&gt;.\n”
    ~”Find the GDB manual and other documentation resources online at:\n<http://www.gnu.org/software/gdb/documentation/&gt;.\n”
    Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/&gt;.
    ~”For help, type \”help\”.\n”
    ~”Type \”apropos word\” to search for commands related to \”word\”.\n”
    ^done
    -list-features
    ^done,features=[“frozen-varobjs”,”pending-breakpoints”,”thread-info”,”data-read-memory-bytes”,”breakpoint-notifications”,”ada-task-info”,”language-option”,”info-gdb-mi-command”,”undefined-command-error-code”,”exec-run-start-option”]
    -gdb-set disassembly-flavor intel
    ^error,msg=”No symbol \”disassembly\” in current context.”
    -gdb-set print demangle off
    ^done
    -break-insert -f main
    &”Function \”main\” not defined.\n”
    ^done,bkpt={number=”1″,type=”breakpoint”,disp=”keep”,enabled=”y”,addr=”<PENDING>”,pending=”main”,times=”0″,original-location=”main”}
    Warning: could not set a breakpoint on main. ‘Step into new instance’ will not work.
    -break-delete 1
    ^done
    set remotetimeout 60
    &”set remotetimeout 60\n”
    =cmd-param-changed,param=”remotetimeout”,value=”60″
    ^done
    target remote :50044
    &”target remote :50044\n”
    ~”Remote debugging using :50044\n”
    &”Remote communication error. Target disconnected.: No error.\n”
    ^error,msg=”Remote communication error. Target disconnected.: No error.”
    mon gdb_breakpoint_override hard
    &”mon gdb_breakpoint_override hard\n”
    &”\”monitor\” command not supported by this target.\n”
    ^error,msg=”\”monitor\” command not supported by this target.”
    mon reset halt
    &”mon reset halt\n”
    &”\”monitor\” command not supported by this target.\n”
    ^error,msg=”\”monitor\” command not supported by this target.”
    mon program_esp32 “c:/tmp/ESP32Test/ESP32Test/Debug/bootloader/bootloader.bin” 0x1000
    &”mon program_esp32 \”c:/tmp/ESP32Test/ESP32Test/Debug/bootloader/bootloader.bin\” 0x1000\n”
    &”\”monitor\” command not supported by this target.\n”
    ^error,msg=”\”monitor\” command not supported by this target.”
    -target-disconnect
    ^error,msg=”You can’t do that when your target is `exec'”
    -gdb-exit
    ^exit

    To me it looks like the ESP32 has not been reset, am I right, any thoughts ?</p>

    Thanks in advance,
    Mark

    • This topic was modified 5 years, 7 months ago by nevyn.
    #21832
    support
    Keymaster

    Hi,

    It looks like gdb fails to connect to OpenOCD. Please check the OpenOCD log for details or try using the ‘test’ button in VisualGDB Project Properties -> Debug.

    #21833
    nevyn
    Participant

    Using the Test button I get the message Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host

    I powered off the board and disconnected the JTAG debugger.  Powered on the board and then reconnected the debugger.

    Output becomes:

    c:\SysGCC\esp32\esp32-bsp\OpenOCD\bin\openocd.exe -c "gdb_port 50099" -c "telnet_port 50100" -f interface/ftdi/olimex-arm-usb-ocd-h.cfg -c "adapter_khz 3000" -f target/esp32.cfg -c "echo VisualGDB_OpenOCD_Ready"
    Open On-Chip Debugger 0.9.0 (2018-07-30)
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
    adapter speed: 3000 kHz
    Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
    esp32 interrupt mask on
    VisualGDB_OpenOCD_Ready
    Info : clock speed 3000 kHz
    Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
    Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    cpu0: Current bits set: BreakIn BreakOut RunStallIn
    cpu1: Current bits set: none
    Info : esp32: Debug controller was reset (pwrstat=0xE5, after clear 0x5F).
    Info : accepting 'gdb' connection on tcp/50099
    Info : Target halted. PRO_CPU: PC=0x40007BA1 (active) APP_CPU: PC=0x00000000
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0xE5, after clear 0x5F).
    Info : esp32: Debug controller was reset (pwrstat=0xE5, after clear 0x5F).
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Core was reset (pwrstat=0x5F, after clear 0x0F).
    Info : esp32: Debug controller was reset (pwrstat=0xE5, after clear 0x5F).
    Info : Target halted. PRO_CPU: PC=0x00000000 (active) APP_CPU: PC=0x00000000
    Info : Flash mapping 0: 0x3ffc0590 -> 0x3ffc0590, 1048321 KB
    Info : Flash mapping 1: 0x3ffc0590 -> 0x3ffc0590, 1048321 KB
    Info : Flash mapping 2: 0x0 -> 0x5f4924a4, 10559 KB
    Info : Flash mapping 3: 0x4b68ca0 -> 0x4b616d8, 77295 KB
    Info : Flash mapping 4: 0xa4fccc -> 0x4921f9, 77219 KB
    Info : Flash mapping 5: 0x17 -> 0x3512930, 4543 KB
    Info : Flash mapping 6: 0x4b6cf58 -> 0x5f4924f4, 10559 KB
    Info : Flash mapping 7: 0xa4fcc8 -> 0x254, 6457 KB
    Info : Flash mapping 8: 0x1 -> 0x24, 77189 KB
    Info : Flash mapping 9: 0x4b7bfa0 -> 0x0, 4516 KB
    Info : Flash mapping 10: 0x0 -> 0xa4fccc, 77189 KB
    Info : Flash mapping 11: 0x756cc870 -> 0x5bed4406, 4194303 KB
    Info : Flash mapping 12: 0x756b7084 -> 0x60161f, 77188 KB
    Info : Flash mapping 13: 0x6c666d -> 0x6c68fe, 77188 KB
    Info : Flash mapping 14: 0x1f -> 0x2c5b560, 0 KB
    Info : Flash mapping 15: 0x4b68ca0 -> 0xa4fca4, 0 KB
    Info : Flash mapping 16: 0xa4ffcc -> 0x4b616d8, 0 KB
    Info : Flash mapping 17: 0x4b7db68 -> 0xa4fd4c, 4502 KB
    Info : Flash mapping 18: 0x4b616d8 -> 0x64d850, 0 KB
    Info : Flash mapping 19: 0x64dbf0 -> 0x64da18, 77371 KB
    Info : Flash mapping 20: 0x4b8eba0 -> 0x604f7f, 77138 KB
    Info : Flash mapping 21: 0xa4fd01 -> 0x0, 22752 KB
    Info : Flash mapping 22: 0x0 -> 0x10, 0 KB
    Info : Flash mapping 23: 0x186a0 -> 0x1, 4194303 KB
    Info : Flash mapping 24: 0x0 -> 0x74d9ec, 0 KB
    Info : Flash mapping 25: 0xfffffffc -> 0x0, 0 KB
    Info : Flash mapping 26: 0x220 -> 0x1a0, 0 KB
    Info : Flash mapping 27: 0x2c5b7c8 -> 0x1a0, 45418 KB
    Info : Flash mapping 28: 0x7031bcdd -> 0xa4fdac, 1838214 KB
    Info : Flash mapping 29: 0x2c5b878 -> 0x2c60b30, 1838214 KB
    Info : Flash mapping 30: 0x70321b37 -> 0x2c5abb8, 0 KB
    Info : Flash mapping 31: 0xa4fdd0 -> 0x0, 0 KB
    Info : Flash mapping 32: 0x100 -> 0x1, 0 KB
    Info : Flash mapping 33: 0xac28e3be -> 0xa4fdd8, 10559 KB
    Info : Flash mapping 34: 0x74b05aeb -> 0x1a0, 0 KB
    Info : Flash mapping 35: 0xa4fdd0 -> 0xa4fe0c, 1911830 KB
    Info : Flash mapping 36: 0xa4ffcc -> 0x74b0a560, 0 KB
    Info : Flash mapping 37: 0x5f492544 -> 0x4b68fcc, 4500 KB
    Info : Flash mapping 38: 0x1a0 -> 0x1, 4 KB
    Info : Flash mapping 39: 0xa4fe0c -> 0x4, 1955955 KB
    Info : Flash mapping 40: 0x0 -> 0x0, 0 KB
    Info : Flash mapping 41: 0x1 -> 0xc3b4, 128 KB
    Info : Flash mapping 42: 0x3510000 -> 0x0, 0 KB
    Info : Flash mapping 43: 0x4b4af90 -> 0x4b4af91, 6455 KB
    Info : Flash mapping 44: 0xa4feb8 -> 0x467ad7, 6455 KB
    Info : Flash mapping 45: 0x4b4af90 -> 0xffffffff, 4505 KB
    Info : Flash mapping 46: 0x466bb0 -> 0x466010, 77285 KB
    Info : Flash mapping 47: 0xffffffff -> 0x3512930, 0 KB
    Info : Flash mapping 48: 0x3511824 -> 0x3512930, 0 KB
    Info : Flash mapping 49: 0x3511824 -> 0xa4feb8, 4103 KB
    Info : Flash mapping 50: 0x3512930 -> 0x6381ed, 54341 KB
    Info : Flash mapping 51: 0x6381f4 -> 0x6381ac, 1955955 KB
    Info : Flash mapping 52: 0xa4ffcc -> 0x756cc870, 54341 KB
    Info : Flash mapping 53: 0x1d -> 0x3511824, 6337 KB
    Info : Flash mapping 54: 0xd -> 0x3511720, 0 KB
    Info : Flash mapping 55: 0x0 -> 0x1d, 54342 KB
    Info : Flash mapping 56: 0xa4ff80 -> 0x4013eb, 0 KB
    Info : Flash mapping 57: 0x3511720 -> 0x3511b30, 0 KB
    Info : Flash mapping 58: 0x1e3f8eac -> 0xa4ff08, 1956248 KB
    Info : Flash mapping 59: 0xffffffff -> 0xcccccccc, 3355443 KB
    Info : Flash mapping 60: 0xcccccccc -> 0xcccccccc, 3355443 KB
    Info : Flash mapping 61: 0xcccccccc -> 0xcccccccc, 3355443 KB
    Info : Flash mapping 62: 0x14c -> 0x8664, 10559 KB
    Info : Flash mapping 63: 0x34 -> 0x3511720, 54342 KB
    Info : Flash mapping 64: 0xf410a447 -> 0x0, 1561287 KB
    Info : Flash mapping 65: 0x0 -> 0x0, 0 KB
    Info : Flash mapping 66: 0x0 -> 0x0, 0 KB
    Info : Flash mapping 67: 0x0 -> 0x0, 0 KB
    Info : Flash mapping 68: 0x0 -> 0x0, 0 KB
    Info : Flash mapping 69: 0x0 -> 0x0, 0 KB
    Info : Flash mapping 70: 0x0 -> 0x0, 4101 KB
    Info : Flash mapping 71: 0x401500 -> 0xa4ff94, 2884 KB
    Info : Flash mapping 72: 0x401500 -> 0x401500, 10559 KB
    Info : Flash mapping 73: 0x741c8674 -> 0x2d1000, 1902369 KB
    Info : Flash mapping 74: 0xdc57e7f0 -> 0xa4ffdc, 1956119 KB
    Info : Flash mapping 75: 0x2d1000 -> 0x1e3f8fa4, 0 KB
    Info : Flash mapping 76: 0x0 -> 0x2d1000, 0 KB
    Info : Flash mapping 77: 0x0 -> 0x0, 0 KB
    Info : Flash mapping 78: 0x1e3f8fa4 -> 0xa4ffa0, 0 KB
    Info : Flash mapping 79: 0xa4ffe4 -> 0x77657840, 1736097 KB
    Info : Flash mapping 80: 0x0 -> 0xa4ffec, 1956119 KB
    Info : Flash mapping 81: 0xffffffff -> 0x7766acf3, 0 KB
    Info : Flash mapping 82: 0x0 -> 0x401500, 2884 KB

    Regards,

    Mark

    #21834
    support
    Keymaster

    Hi,

    The test output looks OK. Please try restarting your computer and see if the problem still persists. If it does, please check the OpenOCD output from the debug session (VisualGDB should show it as a tab in the ‘debugging failed’ window). If gdb reports a failed connection to OpenOCD, the OpenOCD output should contain some kind of an error.

    #21835
    nevyn
    Participant

    Restarted the computer and recompiled the program, tried to debug.

    Failed to connect to the debug stub.  Please click View gdb stub log to see the detailed gdb stub output.

    If I do this then you see the text above.  Clicking the Ignore button to get to the openocd shows similar text to the second log above.  The gdb log shows text similar to the first message above.

    Regards,

    Mark

    #21838
    support
    Keymaster

    Hi,

    If the log messages are exactly the same (OpenOCD doesn’t report any errors and gdb reports Remote communication error), most likely something in your system (e.g. a firewall) is preventing gdb from connecting to OpenOCD. Please try disabling the firewall to see if it solves the problem.

    If not, please double-check that the port shown in the OpenOCD log matches the port shown in the gdb log. If this is the case, try connecting to the OpenOCD port manually using the telnet command.

    #21869
    nevyn
    Participant

    Been investigating this over the last couple of days.  Moved to a different board and I’m getting good results with that.

    Back to the original board as I have to get code working on it.  Given that the code works on the second board I wondering if it could be a connection / wiring problem.

    Regards,
    Mark

    #21870
    support
    Keymaster

    Hi,

    If it works on the other board, the problem might be caused by some a different configuration/revision + a bug in OpenOCD. If OpenOCD doesn’t show any definitive error messages, you could try building it from the sources (our OpenOCD fork contains convenient CMake build scripts and you can get a compatible MinGW toolchain as described here) and stepping through initialization code to see what triggers the error. Generally, though, please be advised that the ESP32 tools are less reliable than the ARM tools and simply switching to the board that works might be an easier solution.

    #21890
    angel
    Participant

    thanks after reconfiguring problem resolved

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.