OPENOCD,针对 ARM Cortex M0 (JTAG) 的闪存编程
我是 OpenOCD 的新手,有没有人尝试使用 Olimex OpenOCD 将程序十六进制文件(来自 Kiel 说)实际闪存到 ARM CORTEX M0(通用)中。
我需要什么设置脚本文件来获取十六进制文件的每个字在 MCU 闪存内执行 mww(内存写入字)?谁能提供一个例子。我用的是蟒蛇。
我开放征求建议。
我使用Windows电脑。
I'm new on OpenOCD, has anyone attempted to use Olimex OpenOCD to actually flash program hex file (from Kiel say) into ARM CORTEX M0 (generic).
What do I need to setup script file to take each word of the hex file to performs mww (memory write word) within the MCU flash?, can anyone provide an example. I use python.
I open for suggestion.
I use Window PC.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
据我所知,所有 Cortex M0 都没有 JTAG,只有 SWD 支持。 SWD 在 OpenOCD 中尚不可用 - 它仍在开发中。
另请注意:写入闪存的方法因每个供应商/芯片而异。
All Cortex M0 that I know of have no JTAG, but only SWD support. SWD is not yet available in OpenOCD - it is still in development.
Another note: The method for writing the flash memory is specific for each vendor/chip.
当然,具体是什么平台?一些谷歌搜索会找到确切的序列。闪存解锁、擦除、编程等。
以本页第 6 节为例。
http://pygmy.utoh.org/riscy/cortex/led-lpc17xx.html
我试图弄清楚我在哪个板上执行了此操作,但这些命令几乎是我遵循的命令,而且效果很好。它可能是 leaflabs 枫木迷你。步骤是相同的。为了避免这些步骤或编写脚本等,我最终做的是编写几行引导加载程序,其中表示如果 ram+0 = 0x12345678,并且 ram+4 = 0x87654321,则分支到 ram+8 否则无限循环。然后使用 jtag 将程序加载到 ram 中,并使用两个字和 0x08 字节的入口点加载到 ram 中,按下重置并运行程序就很简单了。在冷启动时,它只会进入无限循环。我花了一天的时间在一个更大的基于arm的系统上,使用jtag将所有东西加载到ram中,所以它变得非常舒适。您只需在 openocd 中编写脚本并简单地键入 openocd 命令即可发生闪存加载。
Sure, what platform in particular? some googling will find the exact sequence. flash unlock, erase, program, etc.
Section 6 of this page for example.
http://pygmy.utoh.org/riscy/cortex/led-lpc17xx.html
I am trying to figure out what board I did it on but those were pretty much the commands I followed and it worked just fine. It may have been the leaflabs maple mini. The steps are the same. To avoid the steps or scripting it, etc. what I ended up doing was writing a few lines of bootloader that said if ram+0 = 0x12345678, and ram+4 = 0x87654321 then branch to ram+8 else infinite loop. then it was trivial to use the jtag to load a program into ram with the two words and an entry point at 0x08 bytes into ram, press reset and run the program. On a cold power up it just hits the infinite loop. I spend my day on a bigger arm based system loading everything into ram using jtag so it made it quite comfortable. You could just script it in openocd and simply type the openocd command have the flash load happen.
对于路过的人的更新...
如果您只是想将程序闪存(例如上传您自己的代码)到您的微控制器,则不必使用 mww。
不久前,OpenOCD 获得了一个(“内置”)便利脚本,您可以使用它进行编程,这个“命令”称为“程序”。
以下是来自“program”命令的文档的示例:
-Replace您的主板上的“stm32f3discovery”。如果您使用不同的适配器,请使用适当的配置文件替换该接口。
Update for people stopping by...
You do not have to use mww, if you're just trying to flash-program (eg. upload your own code) to your microcontroller.
Some time ago, OpenOCD got a ("built-in") convenience-script, that you can use for programming, this "command" is called "program".
Here's an example from the documentation on the "program" command:
-Replace "stm32f3discovery" by your board. If you use a different adapter, replace the interface with the appropriate configuration file.