This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

简单的定时器打印代码



本想用下面代码进行隔些时间打印hello world!的,但是在调试时,load程序后,在debug里Go main就是不运行到main,在main函数里加上一个while(1);就可以Go main了,这是怎么回事。

tcf文件里的内容
utils.loadPlatform("ti.platforms.dsk6713");
 
/* The following DSP/BIOS Features are enabled.  */
bios.enableRealTimeAnalysis(prog);
bios.enableTskManager(prog);
 
bios.LOG.create("trace");
bios.HWI.instance("HWI_INT15").fxn = prog.extern("display");
// !GRAPHICAL_CONFIG_TOOL_SCRIPT_INSERT_POINT!
 
prog.gen();
主程序main.c
#include <std.h>
#include <log.h>
 
#define CHIP_6713
#include <csl_timer.h>
 
#define uint unsigned int
 
TIMER_Handle hTimer;
 
extern LOG_Obj trace;
 
Void Delays(uint ms)
{
       uint i;
       while(ms--)
              for(i = 0; i < 1000; i++);
}
 
Void main()
{
       TIMER_Config Timer1_config = {0x2c0, 0x10000, 0x0};
      
       //while(1)
       {
              LOG_printf(&trace, "hello world!");
              Delays(10);
       }
 
       hTimer = TIMER_open(TIMER_DEV1, 0); //Opens a TIMER device for use wnself
       TIMER_config(hTimer, &Timer1_config); //配置定时器 wnself
      
       TIMER_start(hTimer); //启动定时器 wnself
       return;
}
 
Void display()
{
       LOG_printf(&trace, "hello world!");
}