我最近买了一个STM32F7发现板1,因此我尝试使用openocd闪存它,因为它有一个嵌入的st-link调试器。我有我的工具链工作(我使用makefiles和手臂-无eabi-gcc),但我想使用eclipse闪盘,以便我可以有一个图形调试器。
为了做到这一点,我从他们的git安装openocd,并使用以下配置文件启动它:
source [find board/stm32f7discovery.cfg]然后,我在eclipse中使用了以下命令-没有eabi-gdb-以闪存板:
target remote localhost:3333
monitor flash protect 0 0 11 off
monitor flash erase_address 0x08000000 0x100000
monitor flash write_image erase "/absolute/path/hello-world.hex" 0 ihex
monitor reset halt我尝试了不同的命令列表,包括我用来在eclipse 2上设置调试链的教程中的命令列表,或者其他的命令列表。有时写操作失败,如果没有,我会得到错误的PC (例如,0 0xfffffffe而不是0x080004ac,这是重置处理程序的地址)。因此,CPU将尝试执行一些甚至不存在的东西(在我的内存之外)并且失败。
你知道可能出了什么问题吗?一个小精度:我正在Linux上工作。
干杯,
安托万
1: www.st.com/web/en/catalog/tools/FM116/SC959/SS1532/LN1848/PF261641?sc=stm32f7-discovery
2: vedder.se/2012/12/debugging-the-stm32f4-using-openocd-gdb-and-eclipse/
3: stackoverflow.com/questions/5535110/stm32-gdb-openocd-commands-and-initialization-for-flash-and-ram-debugging
4: stackoverflow.com/questions/17003519/stm32f4discovery-openocd-telnet-uploading-demo-program
5: github.com/texane/stlink
编辑
我还尝试使用github 5中的st-link程序并加载gdb,并得到了类似的错误:
2016-03-23T09:22:22 INFO src/stlink-common.c: Attempting to write 32768 (0x8000) bytes to stm32 address: 134217728 (0x8000000)
2016-03-23T09:22:22 WARN src/stlink-common.c: Failed to unlock flash!
EraseFlash - Sector:0x0 Size:0x8000
Flash page at addr: 0x08000000 erased
2016-03-23T09:22:22 INFO src/stlink-common.c: Finished erasing 1 pages of 32768 (0x8000) bytes
2016-03-23T09:22:22 INFO src/stlink-common.c: Starting Flash write for F2/F4/L4
2016-03-23T09:22:22 INFO src/stlink-common.c: Successfully loaded flash loader in sram
enabling 32-bit flash writes
size: 32768
2016-03-23T09:22:23 INFO src/stlink-common.c: Starting verification of write complete
2016-03-23T09:22:23 ERROR src/stlink-common.c: Verification of flash failed at offset: 0发布于 2016-03-24 14:20:05
我设法解决了这个问题。结果我一定是修改了内部的选项字节,当我试图闪盘的时候,这是在阻止我。
我使用st-link实用程序将它们设置为默认值,现在一切都很好!也许可以使用openocd代替,但我还没有尝试。如果有人知道怎么做的话,他能分享会很好。
有关选项字节的更多详细信息,您可以查看参考手册1,第80至83页。
1:manual/DM00124865.pdf
https://stackoverflow.com/questions/36160986
复制相似问题