STM32 – Failed to connect to debug stub

Sysprogs forums Forums VisualGDB STM32 – Failed to connect to debug stub

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #12383
    Itamare
    Participant

    Hello,

     

     

    Solved the last issue by downgrading the Visual Studio to 2015 –

    Now another issue –

     

    Failed to connect to the debug stub. Please click “view gdb stub log” to see the detailed gdb stub output.

     

    C:\Users\itamar\AppData\Local\VisualGDB\EmbeddedDebugPackages\com.sysprogs.arm.openocd\bin\openocd.exe -f interface/stlink-v2-1.cfg -f target/stm32f4x.cfg -c “gdb_port 53327” -c “telnet_port 53326” -c init -c “reset init” -c “echo VisualGDB_OpenOCD_Ready”
    Open On-Chip Debugger 0.10.0 (2017-06-09) [https://github.com/sysprogs/openocd]
    Licensed under GNU GPL v2
    For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
    Info : auto-selecting first available session transport “hla_swd”. To override use ‘transport select <transport>’.
    Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
    adapter speed: 2000 kHz
    adapter_nsrst_delay: 100
    none separate
    Info : Unable to match requested speed 2000 kHz, using 1800 kHz
    Info : Unable to match requested speed 2000 kHz, using 1800 kHz
    Info : clock speed 1800 kHz
    Info : STLINK v2 JTAG v28 API v2 SWIM v17 VID 0x0483 PID 0x374B
    Info : using stlink api v2
    Info : Target voltage: 3.257255
    Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
    Info : Unable to match requested speed 2000 kHz, using 1800 kHz
    Info : Unable to match requested speed 2000 kHz, using 1800 kHz
    adapter speed: 1800 kHz
    target halted due to debug-request, current mode: Thread
    xPSR: 0x01000000 pc: 0x0800da7c msp: 0x2000a000
    in procedure ‘reset’
    in procedure ‘ocd_bouncer’
    in procedure ‘ocd_process_reset’
    in procedure ‘ocd_process_reset_inner’ called at file “embedded:startup.tcl”, line 248
    in procedure ‘stm32f4x.cpu’ called at file “embedded:startup.tcl”, line 370
    in procedure ‘ocd_bouncer’

    Error: jtag status contains invalid mode value – communication failure
    Polling target stm32f4x.cpu failed, trying to reexamine
    Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
    Info : Previous state query failed, trying to reconnect
    VisualGDB_OpenOCD_Ready
    Info : accepting ‘gdb’ connection on tcp/53327
    Info : device id = 0x10036446
    Warn : Cannot identify target as a STM32 family.
    Error: auto_probe failed
    Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use ‘gdb_memory_map disable’.
    Error: attempted ‘gdb’ connection rejected

     

     

    device is connected, Eclipse systemworkbench works properly.

    What can cause this issue?

     

     

    Thanks.

    #12391
    support
    Keymaster

    Hi,

    Looks like the OpenOCD build you are using does not support your device yet. Normally support for new devices is added to OpenOCD several months after the device is announced; then the updated version get picked up by our build system and released as a VisualGDB package.

    If you don’t want to wait, we could easily walk you through building OpenOCD from sources and modifying it to support the device manually (it only requires specifying the FLASH size for your device ID so that OpenOCD can detect it).

    #12414
    Itamare
    Participant

    Hi.

    Thanks for the reply, just too many issues with comping the script under VisualGDB, few more issues:

    I am trying to compile and debug a custom board with F446RE on it, using the debugger(ST-LINK) from the Nucleo 446RE, this method absolutely works using SystemWorkbench – code runs perfectly.

    I regenerate the code using CubeMX under GPDSC toolchain/IDE, import to visualGDB – get an error, openocd does not recognize my custom board with 446RE. Is there anything to do with it?

     

    code compiles under Nucleo – STM32F446RET6U but not on custom board – STM32F446RET6

    Thanks.

    • This reply was modified 7 years, 1 month ago by Itamare.
    #12421
    support
    Keymaster

    Hi,

    The STM32 SystemWorkbench uses a customized build of OpenOCD that supports more devices than the regular build. You can try manually copying the OpenOCD.exe and the related DLLs from STM32 System Workbench to %LOCALAPPDATA%\VisualGDB\EmbeddedDebugPackages\<…>openocd\bin. This should get OpenOCD to support the same devices as  the ST SystemWorkbench does.

    Regarding compilation, if this is a separate issue, please let us know the errors you get and we will try to help you resolve them.

    #12426
    Itamare
    Participant

    Great. It works!

     

    Thank you.

    Sorry for too many questions, now when trying to analyze the code using VisualGDB, i got

    ‘multiple definition of TIM2_IRQHandler’, as i am using the timer for other purpose on my board.

    Is it possible to tell the analyzer to use other timers which are not TIM1, TIM2, TIM6 and TIM11?

     

    Appreciate your help.

    #12427
    Itamare
    Participant

    Got it.

    Changed @SAMPLING_PROFILER_TIMER_INSTANCE

     

    Thanks.

    #12429
    Itamare
    Participant

    Tried the profiler, another error:

    Cannot find hook function (SysprogsInstrumentingProfilerHook) inside the ELF file.

     

    followed this tutorial: https://visualgdb.com/tutorials/profiler/embedded/sampling/

     

     

    #12439
    support
    Keymaster

    Hi,

    Looks like you are trying to use instrumentation-based profiler without calling the InitializeInstrumentingProfiler() function. Please ensure you call this function if you are using the instrumenting profiler (if not, please double-check your profiling settings, the error would only appear if the instrumenting profiler was selected).

    #12440
    Itamare
    Participant

    Yes. i am trying to operate the instrumentation-based profiler base on this tutorial –

    https://visualgdb.com/tutorials/profiler/embedded/instrumentation/

    I have the (#include <SysprogsProfiler.h>) and (InitializeSamplingProfiler()).

     

    Problem still exists.

    #12441
    Itamare
    Participant

    Problem also exists when i open new project with just led blink.

    Is it possible that this is related to the changes i made in the OpenOCD files?

    #12461
    support
    Keymaster

    Hi,

    Please double-check the initialization function you are calling. For instrumentation profiler please call InitializeInstrumentingProfiler() as shown in the instrumentation tutorial, for sampling profiler please call InitializeSamplingProfiler().

    Calling InitializeSamplingProfiler() for instrumentation-based profiling won’t work, sorry.

    #12463
    Itamare
    Participant

    Thank you. Code now compiled and runs but the ‘Live Profiling’ is empty –

    Tried to mark both instrument: all function/only the function selected below with only few functions checked.

     

     

    Attachments:
    You must be logged in to view attached files.
    #12467
    support
    Keymaster

    Hi,

    This could happen if the sampling is happening too often and the CPU is busy processing the sampling data most of the time. Please try modifying the sampling frequency to something like 100 hz and check if this fixes the problem. If yes, please try experimenting with the sampling frequencies to see the frequency that works.

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