eclipse stm32l0:无法执行 MI 命令。使用 vFlashErase 数据包擦除闪存时出错

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38914955/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 23:15:38  来源:igfitidea点击:

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

eclipsestm32

提问by bienle

I'm using a Nucleo STM32L031 with AC6 STM32 workbench (eclipse).

我正在使用带有 AC6 STM32 工作台 (eclipse) 的 Nucleo STM32L031。

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.

我编写我的应用程序并进入调试模式,一切正常,直到我在我的应用程序中添加另一个功能。我注意到当我删除/评论“ new_function”时,软件可以再次进入调试模式。但是,当我将“ new_function”添加到代码中并进行调试时,会发生错误并且无法进入调试模式。

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.

该错误不仅发生在这个特定的“new_function”上,还会发生在其他函数上,例如由 STM32Cube 生成的 TIM21_Init()。

I tried to search for the solution, but couldn't find it.

我试图搜索解决方案,但找不到。

Thanks Bien

谢谢边

回答by bcattle

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.

这是 OpenOCD 问题,而不是您的代码问题。当调试器命令文件指的是“stlink-v2-1”但我实际拥有的是“stlink-v2”时,我遇到了这个问题。我正在使用 STM32F0 探索板。

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.

我相信 Nucleo 板有“stlink-v2-1”,所以你可能和我有相反的问题。检查以确保“运行菜单 > 调试配置 > 调试器 > OpenOCD 设置”下的设置设置为正确的调试器。

enter image description here

在此处输入图片说明

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.

在我的例子中,项目向导创建了一个引用 stlink-v2-1 的模板。将其更改为上述解决了问题。

UPDATE:

更新:

I also got this problem when Eclipse crashed and left OpenOCD running in the background. Run

当 Eclipse 崩溃并让 OpenOCD 在后台运行时,我也遇到了这个问题。跑

$ ps aux | grep openocd

And if you see an instance of OpenOCD running when the debugger is not, kill it.

如果您看到一个 OpenOCD 实例在调试器未运行时运行,请杀死它。

回答by user1923363

In my case (stm32f429) changing this option helped: option to change

就我而言(stm32f429)更改此选项有帮助: 更改选项