一:debug
1:一定要terminate正在debug的程序才能再次下载程序:当xTAG-3上红灯亮时,表明正在debug状态。如果需要再次下载程序,那么需要按菜单run->terminate终止程序,或者console中的红色按钮终止程序,此时xTAG-3上的红灯灭,就可以再次下载程序。如果不按terminate而直接再次下载程序debug,IDE就会出问题。
2:debug下单步跟踪有时会出错。
3:注意Toggle break-point时,如果在debug状态下出现(黄底感叹号)
则表明此处不能设断点。正确设置的
clip_image004.jpg
4:在Debug Configurations的对话框下
clip_image006.jpg设置stop onstartup at:可以设置第一次程序的断点。注意在大部分xmos的程序,main的作用是用于分配线程,并不作为正式的函数使用,因此在这种情况下,不能将startup设置为main。
二:xScope的配置
1:在.xn文件中添加xScope需要的资源(基本上每一个.xn文件中均已添加有了xscope的配置(类似于下面的文字))
<Link Encoding ="2 wire "Delays ="4,4" Flags =" XSCOPE ">
<LinkEndpoint NodeId ="0" Link =" X0LD "/>
<LinkEndpoint RoutingId ="0 x8000 " Chanend ="1"/>
</Link >
Note that whenthe link is set to 2 wire, the minimum delay is set to 4 and the flags specifythat this link is to be used for streaming debug. Setting the delay higher resultsin the output of packets used by xscope being less frequent. The RoutingId isalso important as the value 0x8000 specifies to the tools that this is aspecial link used for xscope.
When used in amulti-tile system the NodeId of the package which is connected to the XSYSconnector must be specified. The tools set up the links with the other tiles butthey need to know which specific device has the external link to be connected tothe XTAG-2.
在源文件中包含头文件:include <xscope.h>
2:注册xscope需要检测的变量,有两种方式,一种是config.xscope文件;一种用xscope_register注册函数。
注册函数示例:
port micL ;
port micR ;
void xscope_user_init ( void ) {
xscope_register(2,
*XSCOPE_CONTINUOUS, " Microphone Left ", XSCOPE_UINT , "mV",*
*XSCOPE_CONTINUOUS, " Microphone Right ", XSCOPE_UINT , "mV"*
);
}
int main () {
while (1) {
int sample ;
micL :> sample ;
xscope_uint (0, sample ); //0对应register的第一行:Microphone Left
micR :> sample ;
xscope_uint (1, sample ); //1对应register的第二行:Microphone Right
}
}
Config.xscope xscope配置文件
<xSCOPEconfigioMode="none" enabled="true">//注意type和datatype中没有“xscope_”的前缀
<Probe name="Sin Value" type="CONTINUOUS"datatype="FLOAT" units="Value"enabled="true"/>
<Probe name="Cos Value" type="CONTINUOUS" datatype="FLOAT"units="Value" enabled="true"/>
<Probe name="Tan Value" type="CONTINUOUS"datatype="FLOAT" units="Value"enabled="true"/>
</xSCOPEconfig>
3:配置文件中的说明
Figure 28 summarizes the different types ofprobes that can be configured. Only continuous probes can be displayedreal-time.
Probe Type | DataType | Scope View | Example |
---|---|---|---|
XSCOPE_CONTINUOUS | XSCOPE_UINT | Line graph. May | Voltage levels of a motor |
XSCOPE_INT | be interpolated | controller | |
XSCOPE_FLOAT | |||
XSCOPE_DISCRETE | XSCOPE_INT | Horizontal lines | Buffer levels of audio |
CODEC | |||
XSCOPE_STATEMACHINE | XSCOPE_UINT | State machine | Progression of protocol |
XSCOPE_STARTSTOP | XSCOPE_NONE | Start/stop bars | Recorded function entry |
XSCOPE_UINT | and exit, with | ||
XSCOPE_INT | optionallabel value | ||
XSCOPE_FLOAT |
4:Makefile中加上-fxscope.(现在在例程中没有看到加-fxscope呢?)
(1). Open the Makefile for yourproject.
(2). Locate the XCC_FLAGS_configvariable for your build configuration, for example XCC_FLAGS_Release.
(3). Add the option -fxscope.
5:设置:
在run configurations中的xscope中mode可设置Real-Time Mode或Offline Mode
网友评论