CodeWarrior for FreeScale 尝试使用 56800E 模拟器调试简单程序
我刚刚开始学习 FreeScale DSC(MC56F800x 系列)。我使用 Windows 上的 AVR Studio 和 Linux 上的 Eclipse 和 avr-gcc 完成了一些 AVR 工作。 CodeWarrior 只是不那么直观。
现在我正试图调试一个简单的程序。我使用内置模拟器启动调试器,但它从未到达 main() 的第一行。相反,它似乎陷入了一些初始化代码(MC56F8006_init.asm)中,特别是这一行:
;; Loop until OCCS_STAT[LCK0] = 1
wait_for_lock:
brclr #OCCS_STAT_LCK0,x:>OCCS_STAT,wait_for_lock
我已经让它运行了很长一段时间,但它永远不会超越这一点。显然是在等待什么,但是什么?你可能会认为模拟器会正常工作......啊。也许我可以更改一些选项以使其通过这一步?
我将继续挖掘,如果我先找到它,我会在这里发布答案。
更新:
以下是我发现的内容:
OCCS
- 片上时钟合成
brclr
- 如果位清除则
转移 该指令循环直至 OCCS_STAT LCK0 被置位。该寄存器表示片上振荡器的 PLL 已锁定(等待时钟稳定)。
我仍然不确定为什么模拟器会在这条线上永远旋转,以及如何在不破解初始化代码(这是代码库的一部分而不是在我的项目中)的情况下解决这个问题。
I'm just getting started learning FreeScale DSCs (MC56F800x series). I've done some work with AVRs using both AVR Studio on Windows and Eclipse and avr-gcc on Linux. CodeWarrior is just not as intuitive.
Right now I'm stuck trying to debug a simple program. I start the debugger using the built-in simulator, but it never reaches the first line of main(). Instead it seems to get stuck in some initialization code (MC56F8006_init.asm), specifically this line:
;; Loop until OCCS_STAT[LCK0] = 1
wait_for_lock:
brclr #OCCS_STAT_LCK0,x:>OCCS_STAT,wait_for_lock
I've let it run for quite a while and it never gets past this. It's obviously waiting for something, but what? You would think the simulator would just work... argh. Maybe there's some options I can change to make it pass this step?
I'm going to keep digging and will post an answer here if I find it first.
Updates:
Here's what I've found:
OCCS
- On Chip Clock Synthesis
brclr
- Branch if Bits Clear
The instruction loops until OCCS_STAT LCK0 is set. This register means the on-chip oscillator's PLL has locked (waits for clock stabilization).
I'm still not sure why the simulator spins forever on this line, and how I can solve this without resorting to hacking up the init code (which is part of the code library and not within my project).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不熟悉该部件或模拟器,但该模拟器似乎仅是指令集,并且不模拟 PLL 硬件。
在大多数嵌入式开发系统中,运行时启动代码作为源代码提供,您可以修改它(或者更确切地说,在项目中制作本地副本,然后汇编和链接它以覆盖默认启动)。或者,您可以简单地在此循环中放置一个断点,然后前进程序计数器寄存器以使其脱离循环。在许多调试器中,可以将脚本附加到断点以自动执行此操作。
I am not familiar with the part or the simulator, but it seems likely that the simulator is instruction-set-only and does not simulate the PLL hardware.
In most embedded development systems, the run-time startup code is provided as source and you could modify it (or rather make a local copy in your project and assemble and link that to override the default start-up). Alternately you could simply place a breakpoint in this loop, and advance the program-counter register to get it out of the loop. In many debuggers it is possible to attach a script to a breakpoint to do this automatically.