您好:
我正在初学使用TMS320F280025C芯片,从C:\ti\c2000\C2000Ware_5_04_00_00\driverlib\f28002x\examples\led导入这个LED闪烁的项目时,main函数中的Device_init();跳转→SysCtl_setClock(DEVICE_SETCLOCK_CFG);跳转→SysCtl_delay(23U);这个延时函数是可以正常运行的。但是,当我尝试学习从零开始新建一个项目,把C:\ti\c2000\C2000Ware_5_04_00_00\driverlib\f28002x\driverlib里面的文件都复制到工作区,也正确设置了路径、也正确引用了相关头文件后,Device_init();跳转→SysCtl_setClock(DEVICE_SETCLOCK_CFG);跳转→SysCtl_delay(23U);延时函数就无法运行了,连接仿真器时显示No source available for "SysCtl_delay()"。
我查看这个延时函数,发现是在sysctl.c中使用汇编语言写的,如下:
// // Define to isolate inline assembly // #define SYSCTL_DELAY __asm(" .if __TI_EABI__\n" \ " .asg SysCtl_delay , _SysCtl_delay\n" \ " .endif\n" \ " .def _SysCtl_delay\n" \ " .sect \".TI.ramfunc\"\n" \ " .global _SysCtl_delay\n" \ "_SysCtl_delay:\n" \ " SUB ACC,#1\n" \ " BF _SysCtl_delay, GEQ\n" \ " LRETR\n") //***************************************************************************** // // SysCtl_delay() // //***************************************************************************** SYSCTL_DELAY;
在sysctl.h中也有声明
extern void SysCtl_delay(uint32_t count);
然后我试了其他示例,发现均是在C:\ti\c2000\C2000Ware_5_04_00_00\driverlib\f28002x\examples路径导入的项目全部能使用SysCtl_delay()函数,只要是自己引用sysctl.h文件使用SysCtl_delay()函数的就会失败,提示No source available for "SysCtl_delay()",找了很久一直没有找到原因,很奇怪,请帮忙解答一下,不甚感激!
I copied the file from C:\ti\c2000\C2000Ware_5_04_00_00\driverlib\f28002x\driverlib to my project path D:\LED_blinky\driverlib, In CCS, D:\LED_blinky\driverlib is also used as a reference path. Press F3 open declaration in the main.c file to jump to sysctl.h as shown in the problem description, indicating that this resource can be found
Do you have both the sysctl.c and sysctl.h file copied over? Are you including these files properly in your main file?
Yes, both files have been copied, and the correct inclusion paths have been configured.
Can you confirm that the disassembly is correct by going to View -> Disassembly ?