stm32l0: Failed to execute MI command. Error erasing flash with vFlashErase packet - eclipse

I'm using a Nucleo STM32L031 with AC6 STM32 workbench (eclipse).
I write my application and go to debug mode, everthing was working well until I add another function in my application. I notice that when I remove/comment the "new_function", the software can go to debug mode again. However when I add the "new_function" to the code and go to debug, an error occurs and it cannot go to debug mode.
Error: Error in final launch sequence
Failed to execute MI command:
load C:Project_STM32L031K6-Nucleo\\Debug\\Project.elf
Error message from debugger back end:
Error erasing flash with vFlashErase packet
Error erasing flash with vFlashErase packet
This error does not occur only for this specific "new_function", but also for other functions e.g TIM21_Init() generated by STM32Cube.
I tried to search for the solution, but couldn't find it.
Thanks
Bien

In my case (stm32f429) changing this option helped:

This is an OpenOCD issue, not a problem with your code. I got this issue when the debugger command file was referring to a "stlink-v2-1" but what I actually have is an "stlink-v2". I'm using the STM32F0 Discovery board.
I believe the Nucleo board has the "stlink-v2-1" so you might have the opposite problem as me. Check to make sure that the setting under "Run menu > Debug Configurations > Debugger > OpenOCD setup" is set to the correct debugger.
If a debug configuration file is being used (the "use default script" or "use local script" option is selected) open that file and look for a line like:
source [find interface/stlink-v2.cfg]
In my case the project wizard had created a template that was referencing stlink-v2-1. Changing it to the above fixed the problem.
UPDATE:
I also got this problem when Eclipse crashed and left OpenOCD running in the background. Run
$ ps aux | grep openocd
And if you see an instance of OpenOCD running when the debugger is not, kill it.

Related

Eclipse CDT Error in GDB debugger target is null

I want to debug my test.out program with the the gdb debugger from mingw. Calling the gdb debugger with the image file is running successful on the terminal window, but every time I started the debugger from eclipse I got the
**Error message from debugger back end:
You can't do that when your target is `None'
Failed to execute MI command:
load C:\Temp\test.out
The gdb commander was configured as path/gdb.exe and image and symbol files are the out file.
In the debugger console view I only see the the information about the installed gdb version simular the output that I got when I type only gdb in the terminal window. No MI command.
Any hints how I can solve my problem or find more informatio about it?
Thanks.
I found the solution, I was too stupid. I configured my debug configuration as gdb hardware debugger, but since it is a c-application, I have to configure it as such one.

'Failed to execute MI command: -exec-run' error when trying to debug a GNU project with Eclipse

I wish to debug GNU Emacs in Eclipse IDE for C/C++ on my macOS Sierra. I have downloaded the source code with Git and built the project successfully via the command line. I then imported the project to Eclipse as an existing Makefile project with the GNU autotools toolchain setting.
I can now run the Emacs GUI from Eclipse. However, when I try to debug it (with gdb), I get the following error message:
'Launching emacs-26.0.50.1' has encountered a problem.
Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
During startup program terminated with signal ?, Unknown signal.
During startup program terminated with signal ?, Unknown signal.
I managed to get rid of this error by specifying the full path to the .gdbinit file in the Run > Debug Configurations... > C/C++ Application > emacs-26.0.50.1 > Debugger > GDB command file: textbox.
I now get a different error, but this is a matter for another question...
I had a similar error message while using the debugger for a small dummy code. I used the suggestion given in this link and got it fixed. In short, I had to change the debugger to an older one. Hope that helps if you are still having the same issue.
The problem for me was using USB 3.0 port. Connected board to USB 2 port and it was working fine.

Eclipse: what is MI command and why does it matter for running the C code?

While trying to debug my C code snippet with Eclipse, it shows out the following popup.
Error in final launch sequence
Failed to execute MI command:
-exec-run
Error message from debugger back end:
Unable to find Mach task port for process-id 4550: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))
Unable to find Mach task port for process-id 4550: (os/kern) failure (0x5).\n (please check gdb is codesigned - see taskgated(8))
Is there a solution for this matter? Also, I want to ask you if it actually bothers a lot to use Eclipse when writing a code in C. I never had this kinds of trouble when I first started learning Xcode, but now there seems to be quite a lot of things I should care with Eclipse.
From Community Forums
When CDT launches, it tries to set a breakpoint at main, so it will interrupt execution when your program starts. However, your target is already running so the breakpoint cannot be set and the whole things fails.
You could simply tell your launch not to set that breakpoint and let it connect to your target.
Go to: Run->Debug Configurations... and find your launch configuration. Then select the Startup subtab, scroll down and uncheck "Set breakpoint at" in the "Runtime options" subsection.
or See gdb fails with “Unable to find Mach task port for process-id” error

No Java console output in Eclipse; works with PyDev

I have both a Java and a PyDev project in one workspace. When I run the PyDev project (either the main script with Run > Run As > Python Run or its associated unit test with Python unit-test), the console output looks fine. However, when I switch to the Java project, open the main class, make sure the cursor focus is in the main class, and run it with Run > Run as > [my run config], no output shows up in the console, stdout or stderr. I've tried with Run/Debug > Console > Fixed width console checked and unchecked, similarly for Limit console output. "Allocate console" is check in [my run config].
I have tried redirecting output to a file in my run configuration, but the log file is empty after a run; thus, I suspect stdout/stderr are being trapped somewhere. I suspect that it is PyDev causing the issue because when I run the Java project, this exception reliably shows up about 6 times in the error log:
Launch shortcut 'org.python.pydev.debug.ui.launchShortcut.python.unittest' enablement expression caused exception. Shortcut was removed.
stacktrace:
org.eclipse.core.runtime.CoreException: No property tester contributes a property org.python.pydev.debug.ui.python_type to type class org.eclipse.ui.part.FileEditorInput
at org.eclipse.core.internal.expressions.TypeExtensionManager.getProperty(TypeExtensionManager.java:123)
at org.eclipse.core.internal.expressions.TestExpression.evaluate(TestExpression.java:96)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateOr(CompositeExpression.java:68)
at org.eclipse.core.internal.expressions.OrExpression.evaluate(OrExpression.java:21)
at org.eclipse.core.internal.expressions.CompositeExpression.evaluateAnd(CompositeExpression.java:53)
at org.eclipse.core.internal.expressions.AndExpression.evaluate(AndExpression.java:29)
(... and so on)
Additionally, printing from a Java program in a different workspace that only has Java projects works fine.
I tried uninstalling PyDev and restarting Eclipse, but I'm still having the same issue. I still have those errors after reinstalling PyDev, too.
Has anyone run into this issue before, or know of a way to fix it?
Well, I feel like an idiot; turns out, I had redirected stdout/err to a log file that I had long since forgotten about, and stuck somewhere difficult to find.
I ran into the same problem so I did some research. Seems like there was an old issue (2006-2008), but it was resolved by adding an option to the launch configurations to allocate a console. This is available from the Run -> Debug Configurations menu option, Common tab. Perhaps this is simply unchecked after the PyDev install?
If this is a new bug, there were two possible workarounds suggested:
Set up debug launch configuration that uses remote debugging instead of local debugging.
Use a buffered writer to System.out.
Here are the threads for reference:
Eclipse bug - https://bugs.eclipse.org/bugs/show_bug.cgi?id=122429
Workaround thread - java.io.Console support in Eclipse IDE

Difference in Run & Debugg mode in Eclipse for Perl

I am using Eclipse along with EPIC plug in and pad walker for running my Perl project.
I am facing a strange issue
If I "Run" the project, the system fails and exits Perl without any error message.
But if I "Debug" the project and then give "Run" the same Perl scripts work fine as expected.
Could anyone let me know the difference in the two mode ("Direct Run" & "Debug & Run")?
Found it in the EPIC source code: EPIC adds the "-d" command line option for the debug target. It does some interesting things with the stdin/stdout too to remotely control the debugger. So maybe there's some side effect there? Can you share the error message?