4.编译出错
ti.sysbios.knl.Semaphore:line202:assertionfailure:A_badContext:badcallingcontext.MustbecalledfromaTask.
1.怀疑内核版本问题:更新BIOS版本,问题依旧。
2.是因为在TI-RTOS系统的环境下,要调用网络的SL_START()函数,这个函数要到操作系统库中,用到了信号量。但信号量需在任务中才能申请。2.1主函数添加Simplelinkspawntask()
lRetVal=VStartSimpleLinkSpawnTask(SPAWN_TASK_PRIORITY);if(lRetVal<0){
System_printf(\erro\\n\LOOP_FOREVER();}
2.2创建一个任务,确保SL_START()函数在任务中调用,因为SL_START()函数会请求信号量,信号量的请求只能在任务中进行。3.更改
#defineIP_ADDR
0xc0a8586F/*192.168.88.111
客户端监听的IP地址*/
#definePORT_NUM5001/*端口号*/
#defineBUF_SIZE1400#defineTCP_PACKET_COUNT1000
Application----BootLoader(application_bootloader.bin)
怎么用bootloader调用2个或者2个以上不通的应用程序。
1.资料----\\cc3200-sdk\\example\\application_bootloader
MCU’sPrimaryBootLoaderexecutesfromtheROM(hencecannotbemodified)andloadsuser’sapplicationimageresidinginSerialFLASHtotheMCU’sROMandtransferstheexecutioncontrol.User’sImageintheTIFileSystem(SFLASH)istaggedas“/sys/mcuimg.bin”.
41MCUThesecondaryboot-loaderonexecutionwillautorelocatetotheSRAMbasearea“0x20000000to0x20003FFF”beforeloadingtheapplicationimages;thisensuresthatactualapplicationcanstillstartat0x20004000.ApplicationbootloaderloadsapplicationimagesfromSFLASH
usingsimplelinkNVMEMAPI’s.Applicationbootloaderreferstothebootinfofile(/sys/mcubootinfo.bin)tokeeptrackofthelatestandbestknownimage,see“Applicationimageselectionandrollbacklogic”sectionformoredetails.2.用uniflash下载应用程序,上电后程序运行。
1.
如何生成.bin文件。
release、debug模式下生成的是.out文件,而不是.bin文件。
工程------>properties------>build----->steps---->post-buildsteps加上下面的命令(注意命令不能有空格和回车)
\\\\\\
2.
如何生成十六进制文件
(.hex)
Open\->\->\->\HexUtility\checkthe\ArmHexUtility\option.
然后Open\->\->\->\HexUtility\->\FormatOptions\选择\TI-TXThexformat(--ti_txt)\for\format\
NOTE:WhengeneratinganoutputfileinIntel-hexformat,inadditiontoselectingthisformatonealsoneedstosetthe\
dataordering(endianess)(--order,order)\parameterto\andthe\romwidth(--romwidth,-romwidth)\to\inthehexutility's\Options\configurationscreen.
3.
如何将程序下载到flash上并运行。
如果没有网页等相关内容,只需修改/sys/mcuimg.bin文件。(内核及应用程序),注意跳线帽位置。网页等相关内容是放在操作系统的文件系统上。
液晶屏程序调试:
2.1调试过程中,wifi任务不执行,将优先级设为最高后,程序执行(任务的优先级不要有相同值,否则系统会卡死)2.2调试过程中,uart0定期更新液晶屏任务不执行,但接收数据任务正常。更改优先级后执行。
此任务的优先级设为最低,始终无法执行,怀疑是周期时间太长500ms更新一次,更改为100ms也不执行。把此任务的优先级设为2.Findcmd任务优先级设为最低,所有任务正常运行。
422.3将硬中断的uart1扫描时间更改为2ms,因为调试过程中,经常会出现sem超出范围6553,估计是uart1扫描任务没来得及执行,sem累计过多,导致溢出。
文件系统的操作。
3.1读写文件系统偏移量方式,始终没调试成功。只能用偏移量为0方式进行。
文件中一句很重要的话:PreferredinsecurefilethattheOffsetandthelengthwillbealignedto16bytes.对齐方式为1words,结构体堆栈方式改为
#pragmapack(push)#pragmapack(2)//按字节对齐#pragmapack(pop)
结构体中数据定义为unsignedshort型,这样数据就可以按偏移量进行操作。
3.2这样就需提前定义结构体数组(读写buffer),配合sem方式就行读写(当写buffer满时,发送一个信号量,存入到flash中)例:
#pragmapack(push)
#pragmapack(2)//按字节对齐typedefstructfile_data{
unsignedshorta;unsignedshortb;unsignedshortc;unsignedshortd;unsignedshorte;}t_file_data,pfile_data;#pragmapack(pop)
t_file_datat_file_data_write[10]={
{
.a=1111,.b=2222,.c=3333,.d=4444,.e=5555
},
43{
.a=1111,.b=2222,.c=3333,.d=4444,.e=5555
}
};
t_file_datat_file_data_read[10];
WriteFileToDevice(\lFileHandle,&t_file_data_write,WriteReadOneSize*5);////写ReadFileFromDevice(\lFileHandle,&t_file_data_read,WriteReadOneSize*5);////读
4.向4取整
(iLineWidthReal+3)&~0x3;
/*向4取整*/
:
1.程序要兼容debug调试。
将system_printf根据功能进行define定义,当调试通过后,取消define定义。eg1.
#definedebug_uart0System_printf当调试通过:#definedebug_uart0(...)
用
System_printf(\%s%d\\n\__FILE__,__FUNCTION__,__LINE__);
来调试
2.
通过#ifdef来实现模块功能的切换。
例:调试过程中,需要动态的修改全局变量值,可以在主函数中通过scanf()函数来定义。但调试通过这段输入代码需要取消。
#ifdefdebugscanf(\scanf(\scanf(\
44关于程序的兼容性#endif
当程序发布时,predefinesysmbol中,取消debug的定义。这样在以后的维护中,通过修改预定义符号,可以进行快速的调试。
3.要定义一个配置文件config.h
debug调试或者其他情况下,修改config.h来实现。4.对于多版本程序兼容设计思路:
Memory_alloc()函数运用
1.1仿内核架构以数组形式配置typedefstructtask1{
pt_version_task_fxpt_version_task_fx1;/////操作函数pt_version1_variablept_Version1Variable1;////变量..................................其他结构体}t_task1,*pt_task1;.................................
定义、分配t_Version1TaskFxt_Version1Variable等结构体
结构体数组
t_task1t_task1attr[7]={
{
&t_Version1TaskFx,&t_Version1Variable
},
。。。。。。。。。。。。。。。{
&t_Version6TaskFx,&t_Version6Variable}
}
OPEN函数中找到配置数组的结构体handler
pt_task1handler;///handler实是pt_task1结构体指针,定义成全局变量handler=pt_task1open(inti)
{
pt_task1pt_task1temp;
pt_task1temp=(pt_task1)&t_task1attr[i];return(pt_task1temp);
45
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库基于TI-RTOS的CC3200调试过程记录在线全文阅读。
相关推荐: