There are a problem with "Reset target and restart debugging" button. I use simples project in RAM for STM32F4 and use OpenOCD debugging.
When I use standart configuration with "Load Executable" checkbox in Startup tab, then Debug session starts ok and I can debug my software. Configuration screens: one and two. When I need to reset target (from suspended mode, for example when PC stay in main() function) I press "Reset target and restart debugging" button and there are nothing: target goes to "running" mode, and OpenOCD print in console:
Warn : WARNING! The target is already running. All changes GDB did to registers will be discarded! Waiting for target to halt.
when I want to do anything with this, for example press "Suspend" button, I have got error in gdb console:
Program received signal SIGINT, Interrupt.
0x08002862 in ?? ()
then I simply stoped debug session by pressing Terminate and start new debugging to work next. Result - "Reset target and restart debugging" button do not work at all.
But I have good configuration. For this I unchecked "Load Executable" checkbox in Startup tab, set "Pre-run reset." and wrote some commands below:
monitor reset halt
file ${workspace_loc}\asd\Debug\asd.elf
load
ni
where asd.elf is my output file - configuration screen.
After this I can use "Reset target and restart debugging" button and it works! But after first pressing I have got some annoing message "The choosen operation is not enabled", but at next pressing it works fine.
Maybe exists a way to make working "Reset target and restart debugging" button with typically config without additional commands?
I guess I understand your request, you need the Run commands to be executed at Restart, right?
No, I request for work "out of box" without any special commands. My commands is workaround because standart configuration is not work with Restart for unknown for me reasons.
the standard configuration is tuned for running from flash, and the Restart button was intended as a shortcut to avoid rewriting the flash
when running from ram you need to reload the app after each reset, as you did in your configuration, and this is not supported in the current standard configuration.
although for other ARM cores that do not have internal flash running from ram is ok, I fail to understand why someone would prefer it for Cortex-M cores with internal flash.
I'll study the Restart specifics when running from ram, and see what solutions are available.
please review your ticket and if the subject is indeed related to Restart when running from RAM, update it accordingly.
if some of the problems apply to the standard configuration running from flash, please try to isolate them and describe them as clear as possible.
My ARM (STM32F407 launchpad) have internal flash memory but I prefer debug in RAM because it's more safety and do not utilize flash rewrite cycles.
Now I configure project to run from flash but problems remain with Restart button and with standart configuration.
To try investigate them I go to "OpenOCD gdb traces" console and found commands that performed when I press Restart button. This is
I tried to perform this commands manually in OpenOCD gdb console when target standing on some breakpoint. I got same reaction that after Restart button: target has been restarted but do not stopped in "main" breakpoint.
Then I tried next commands on same conditions:
and this commands works fine - target make a reset and go to main.
Then I tried next:
but this do not stopped target in main breakpoint too.
I do not know why but correct restarting performed only after "monitor reset halt" in my case.
Of course this solution can work only with flash but for RAM debugging needed other recipe. Maybe you create additionally checkbox "Reload program on reset" in settings? And RAM-users can check it, FLASH-users can uncheck...
ok, it looks like the break must be set after reset (a safe way, after all).
the reason it was set before is that the openocd plug-in was done with copy/paste from the j-link plug-in, and j-link does not forget breakpoints during reset.
anyway, I updated all debug plug-ins to this, including the Start tab in the interface.
I also checked and at during Restart all commands in the Run section are applied, so I renamed the section as Run/Restart.
the new version is available on updates-test; comments are welcome.
regarding the suggestion to reload program at restart, yes, I also considered this, and I'll probably implement it tomorrow.
No, it doesn't work. Now you make:
but working way is
I think this because after "monitor reset" target automatically runs. And break can't be set. Command "monitor reset halt" do as reset, as halt simultaneous. And then break can be setted. To prove this I do in console "monitor reset", after this try "continue" and GDB say that target is running:
Maybe this is OpenOCD - specific, maybe my target or JTAG-specific, but in my case work only "monitor reset halt".
'monitor reset' only? no I do 'monitor reset <type>'. what does the field 'Type:' read in your case?
oh, yes! I have set "Pre-run reset." checkbox and have got
it works now! Maybe interface is not so clear - the tooltip on this checkbox says what this is second reset. I thought that enough first reset and type of this first reset is "halt".
great!
could you check in this configuration if you manually add a 'load' line in the large field does it also solve the restart when running from ram?
if so, I'll add the 'Reload on Restart' button.
"load" is not work because it want a file path. Previously called "load" is not stores filename. "load" without filepath work only after "file" command.
I have added filepath for "load" and have run program from RAM, but it not go to main because I have got next commands sequence:
I think break can't work after loading a program. I have checked what next commands is ok:
You need to call "tbreak" necessarily after "load".
ok, then I'll move tbreak just before continue.
I'll make these changes and publish a new version shortly.
I finally opted for a slightly different solution, I added a 'Debug in RAM' button. when set, it always loads the elf after each reset.
I also moved tbreak just before continue.
please let me know if it works in your configuration too.
Yes! This is works fine as in RAM, as in Flash! Thanks!
you're welcome!
thank you for helping improve the plug-ins.
there was some significant code restructuring, also affecting openocd backslash processing.
could you retest the latest beta?
Now it is broken. I try to load to RAM with "Load executable" checkbox and without any additional commands. There are errors in GDB trace console:
openocd backslash processing is broken now for standard loading way.
this windows backslash issue was a nightmare :-(
to my surprise, the double slash patch was required for J-Link and QEMU too, otherwise manually entering load commands was not possible, so the culprit might not be the openocd tcl interpreter, but the eclipse & gdb.
could you retest the version 2.5.2-201501031434 available from updates-test?
Now it works. I have tested "Load executable" checkbox and loading by additional comands with one backslash.
ok, thank you.
There are new small bug what appear after last update-test. When i create new OpenOCD configuration the text field "C/C++ Application" is empty now, while "Project" contains correct project name. In old version of plugin both fields have filled automatically. Most likely problem appears after
please be sure you selected the elf you want to debug before creating any debug launch configuration.
Yes, it helps - I have compiled project, and elf-file is exists but Eclipse can't see it because i have not refresh Eclipse's "Project Explorer". After I do "Refresh", elf-file appears in "Project Explorer" and all is ok now, excuse me for worry.