question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Restart not working: 'monitor reset hardware' returns 'Reply contains invalid hex digit 83'

See original GitHub issue

Hi,

I think this is really a request for support rather than a potential bug so don’t hesitate to close this thread if it does not belong here.

I’m trying to get the restart/reset (not sure which one I should use to be honest) button working. What I want to do is to perform a device reset and re-run my program until main without flashing it again.

I have experience using gdb on the command line but VSCode and the Cortex Debug extension are fairly new to me.

My environment is the following:

  • STM32F7508-DK with embedded STL-LINK v2.1 probe
  • ST-LINK_gdbserver.exe version: 5.9.1
  • GNU gdb (GNU Arm Embedded Toolchain 10-2020-q4-major)

The default restart command doesn’t work for me, I’m getting an “Unknown reset option” in the debug console. Which makes sense because the default reset command is “monitor reset halt” and it is not mentioned in the user manual for my server (§2.9)

So, I tried using the overrideRestartCommands parameter to set my own commands. Using GDB from the command line, I can perform the reset with the following commands (having previously set a breakpoint to main):

monitor reset hardware
j handleReset

Where handleReset is the entryPoint of my program (@0x08000000). This works just fine as long as I’m doing it manually, outside of VSCode.

So I wrote the following in my launch config:

"overrideRestartCommands": [
	"interrupt",
	"monitor reset hardware",
	"j handleReset"
]

But when I click the restart button, I get the following:

48-exec-interrupt
GDB -> App: {"token":48,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"\nProgram"}]}

Program
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":" received signal SIGINT, Interrupt.\n"}]}
 received signal SIGINT, Interrupt.
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"main () at /home/lutrampal/git/stm32-event-hal/src/example.cpp:77\n"}]}
main () at /home/lutrampal/git/stm32-event-hal/src/example.cpp:77
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"console","content":"77\t        while (true) {}\n"}]}
77	        while (true) {}
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"exec","asyncClass":"stopped","output":[["reason","signal-received"],["signal-name","SIGINT"],["signal-meaning","Interrupt"],["frame",[["addr","0x90008876"],["func","main"],["args",[]],["file","/home/lutrampal/git/stm32-event-hal/src/example.cpp"],["fullname","/home/lutrampal/git/stm32-event-hal/src/example.cpp"],["line","77"],["arch","armv7e-m"]]],["thread-id","1"],["stopped-threads","all"],["core","0"]]}]}
49-interpreter-exec console "interrupt"
GDB -> App: {"token":49,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
50-interpreter-exec console "monitor reset hardware"
GDB -> App: {"outOfBandRecord":[{"isStream":true,"type":"log","content":"Reply contains invalid hex digit 83\n"}]}
Reply contains invalid hex digit 83
GDB -> App: {"token":50,"outOfBandRecord":[],"resultRecords":{"resultClass":"error","results":[["msg","Reply contains invalid hex digit 83"]]}}

My whole launch configuration is the following:

{
    "name": "Cortex Debug",
    "cwd": "${workspaceRoot}",
    "executable": "./build/example.elf",
    "request": "launch",
    "type": "cortex-debug",
    "servertype": "stlink",
    "stm32cubeprogrammer": "${env:CUBE_PROGRAMMER_BIN_DIR}",
    "serverpath": "${env:STLINK_GDB_SERVER}",
    "serverArgs": [
        "-l", "31", "-v", "-s", "-k", "-el", "${env:STM32_EXT_LOADER}"
    ],
    "overrideGDBServerStartedRegex": "Waiting for connection on port.*",
    "gdbPath": "${env:GDB}",
    "svdFile": "${env:STM32_SVD_FILE}",
    "overrideLaunchCommands": [
        "load",
        "tb handleError"
    ],
    "runToMain": true,
    "preLaunchTask": "Build",
    "demangle": true,
    "showDevDebugOutput": true,
    "overrideRestartCommands": [
        "interrupt",
        "monitor reset hardware",
        "j handleReset"
    ]
}

It works fine for flashing and launching but I had to tinker a bit to get it working. So don’t hesitate to tell me if some things look weird in it…

I guess I must be doing something wrong, but I was unable to find my error. Could someone point me to right direction?

Thanks, Lucas

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
haneefdmcommented, Oct 4, 2021

Unless I can reproduce the problem, there is nothing more I can do. All our testing is with V3 and it may very well be an issue between the ST gdb-server and the probe HW.

I will be fixing the monitor reset halt problem in the next release. Already fixed in my branch.

0reactions
lutrampalcommented, Oct 5, 2021

I understand, thank you for trying anyway.

Read more comments on GitHub >

github_iconTop Results From Across the Web

gdb drops connection (invalid hex digit 120) #1000 - GitHub
When I try to connect with arm-none-eabi-gdb , gdb says Reply contains invalid hex digit 120 and drops the connection. Since debugging the...
Read more >
[Solved][GDB-Server] flash-download: Reply contains invalid ...
Hi, often while flashing an LPC2368 I receive an error message from gdb: Source Code (5 lines) Sometimes it is possible to reconnect...
Read more >
gdbserver --> Reply contains invalid character - Stack Overflow
I found out that remote-debugging a cross-compiled executable needs gdb on the host computer to be compiled for this purpuse.
Read more >
Error Messages - Lauterbach
Error Messages Related to Debug Hardware and Software ... If the problem can not be fixed, please contact technical support (support@lauterbach.com).
Read more >
OB0101-OB9269 messages - IBM
You can issue the SCRN command to display a list of screens in RKOMPCSV. ... associated with parameter cccccccc must contain only hex...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found