IAR cortex-M3 +ucos-III问题集

移植:IAR cortex-M3 +ucos-III 时遇到的一些问题,归根到底是编译器不是很熟悉,这里记录下....

下载方式:

IAR设置的下载链接方式 与 板子的实际环境不统一,同样报错:"Failed to get CPU status after 4 retries retry?"


我的板子下载接口SWD方式,对应的IAR设置如下:



新建的IAR工程,莫名进入App_Fault_ISR异常处理程序:

之前移植的ucos-III,带着ST的V3.5库,稍微动一些代码,就会进入App_Fault_ISR,然那些代码与内存数据结构并无关系,着实郁闷。。。

多方比对,调试+++,定位到IAR设置问题。最后找到options-Debugger-download这块。

常规设置如下:


试着理解下这几项的含义,跑偏勿怪。。。

Attach to program:

"Makes the debugger attach to a running application at its current location, without resetting or halting (for J-Link only) the target system. To avoid unexpected behavior when using this option, the Debugger>Setup option Run to should be deselected. "

附加到程序:使调试器附加到一个正在运行的应用程序在其当前位置,无需重置或停止(仅供J-Link)目标系统。为了避免意想不到的行为,当使用此选项时,Debugger>Setup option "Run to" 应该去掉。

Verify download:

"Verifies that the downloaded code image can be read back from target memory with the correct contents"

验证下载:验证下载的代码映像可以从目标内存中读取正确的内容

Suppress download:

"Disables the downloading of code, while preserving the present content of the flash. This command is useful if you want to debug an application that already resides in target memory.
If this option is combined with the Verify download option, the debugger will read back the code image from non-volatile memory and verify that it is identical to the debugged application.
Note: It is important that the image that resides in target memory is linked consistently with how you use C-SPY for debugging. This applies, for example, if you first link your application using an output format without debug information, such as Intel-hex, and then load the application separately from C-SPY. If you then use C-SPY only for debugging without downloading, you cannot build the debugged application with any of the options Semihosted or IAR breakpoint—on the General Options>Library Configuration page—as that would add extra code, resulting in two different code images."

抑制下载:禁用下载代码,同时保留目前的flash内容。这个命令是有用的,如果您想要调试一个应用程序,该应用程序已经在目标内存驻留。
如果这个选项结合验证下载选项,调试器会读回代码映像从非易失性内存,并验证它是与被调试的应用程序相同。

注意:It is important that the image that resides in target memory is linked consistently with how you use C-SPY for debugging.

例如,如果你第一次联系您的应用程序使用一个没有调试信息输出格式,如Intel-hex,,则 C-SPY与加载应用程序分开的。

如果你然后使用C-SPY只有调试没有下载,你不能用任何构建调试应用程序关于Semihosted选项或IAR断点,在the General Options>Library Configuration 页,添加额外的代码,从而导致两种不同的图片代码。

Use flash loader(s) :

"Use this option to use one or several flash loaders for downloading your application to flash memory. If a flash loader is available for the selected chip, it is used by default. Press the Edit button to display the Flash Loader Overview dialog box."

使用flash加载程序:使用这个选项使用一个或多个闪存flash应用程序加载器下载。如果一个flash加载程序可供选择的芯片,在默认情况下使用它。按下编辑按钮对话框显示Flash加载程序概述。

关于IAR的设置,推荐关键字--”IAR EWARM项目选项常用设置


关于'CSTACK':(stack)栈指针

IAR中debug程序,断点位置会提示:"Tue Dec 15, 2015 14:06:55: The stack pointer for stack 'CSTACK' (currently 0x2000161C) is outside the stack range (0x20002878 to 0x20003078) " ,这很正常。

网友给出的解释:

应用程序启动时要有一个堆栈,不管是裸机,还是基于uCOS,,那就是CSTACK堆栈uCOS-III运行起来后,每个任务有自己的堆栈,所以,当任务运行的时候,IAR编译器会识别到堆栈指针不在CSTACK之内,所以会报The stack pointer for stack 'CSTACK' (currently 0x20007A1C) is outside the stack range (0x20008B88 to 0x20009B88) 这个不是问题,是正常的,,当然,uCOS-III官方移植中,中断堆栈也是独立的,专门用于处理中断,这个好处就是:每个任务堆栈不必考虑中断嵌套层数,从而不用为中断嵌套增加堆栈大小。所以执行中断程序时,也会报The stack pointer for stack 'CSTACK' (currently 0x20007A1C) is outside the stack range (0x20008B88 to 0x20009B88) CSTACK只是在系统启动时使用,之后就没用了,所以可以配置的小一点,以免造成太大的浪费。



jlink 是一款用于调试和烧录嵌入式系统的工具。"jlink failed to get cpu status" 这个错误信息是指在使用 jlink 进行操作时,无法获取嵌入式系统的 CPU 状态。 这个错误可能出现的原因有多种。首先,可能是由于与目标设备或连接线路之间的通信问题导致的。例如,连接线路可能松动或损坏,或者目标设备的硬件可能存在故障。解决此类问题的方法是检查连接线路,确保其稳定性,或者尝试更换线路。 其次,错误可能是由于目标设备的配置或设置错误引起的。例如,可能是由于指定了错误的芯片型号或芯片配置不正确导致的。解决此类问题的方法是确认目标设备的型号和配置正确,并根据实际情况进行更正。 此外,可能是由于 jlink 驱动程序或软件版本不兼容引起的。解决此类问题的方法是升级 jlink 驱动程序或软件到与目标设备兼容的版本。 最后,还有可能是由于目标设备本身出现异常状态引起的。例如,目标设备的电源故障或其他硬件问题可能导致无法获取 CPU 状态。解决此类问题的方法是检查目标设备的电源和硬件部件,并确保其正常工作。 总结起来,"jlink failed to get cpu status" 错误的原因可能是通信问题、设备设置错误、驱动程序版本不兼容或目标设备硬件故障等多种因素引起的。解决此问题需要仔细排查可能的原因,并根据实际情况采取相应的措施。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值