您的位置:首页 > 其它

DSP28027— DELAY_US总结

2015-10-14 14:26 330 查看
在很多程序中都会调用延时程序DELAY_US(A),在文件DSP281x_Examples.h中有如下宏定义:

#define DELAY_US(A) DSP28x_usDelay(((((long double) A * 1000.0L) / (long double)CPU_RATE)
- 9.0L) / 5.0L)

DELAY_US(A)必须要在RAM里运行,因此必须使用代码

#ifdef
FLASH

// Copy time critical code and Flash setup code to RAM

// The  RamfuncsLoadStart, RamfuncsLoadEnd, and RamfuncsRunStart

// symbols are created by the linker. Refer to the linker files.

  MemCopy(&RamfuncsLoadStart, &RamfuncsLoadEnd, &RamfuncsRunStart);

// Call Flash Initialization to setup flash waitstates

// This function must reside in RAM

  InitFlash();
// Call the flash wrapper init function

#endif

把程序从flash搬运到ram中运行,否则的话程序在debug模式下正常,但是release模式下能编译通过但是运行会进入非法中断。

具体做法请参考http://blog.sina.com.cn/s/blog_762cf5f80101asmq.html。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: