TMS320F280025C: 导入示例项目可以使用SysCtl_delay(),但如果自行引用sysctl.h来使用SysCtl_delay()就显示No source available for "SysCtl_delay()"

Part Number: TMS320F280025C
Other Parts Discussed in Thread: C2000WARE

您好:

我正在初学使用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中使用汇编语言写的,如下:

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//
// 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;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

在sysctl.h中也有声明

Fullscreen
1
extern void SysCtl_delay(uint32_t count);
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

然后我试了其他示例,发现均是在C:\ti\c2000\C2000Ware_5_04_00_00\driverlib\f28002x\examples路径导入的项目全部能使用SysCtl_delay()函数,只要是自己引用sysctl.h文件使用SysCtl_delay()函数的就会失败,提示No source available for "SysCtl_delay()",找了很久一直没有找到原因,很奇怪,请帮忙解答一下,不甚感激!

  • 您好,

    已经收到了您的案例,调查需要些时间,感谢您的耐心等待。

  • Have you verified that the include options and file search paths are the same between the example projects and your project that you have created?
    If there is no source available for sysctl_delay, can you browse for the correct file and will it show it?
  • 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 ?