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.

TMS320F28035: 如何在CLA中使用sqrt 或 _sqrt函数?

Part Number: TMS320F28035
Other Parts Discussed in Thread: C2000WARE

我在CLA程序中使用了sqrt 或 _sqrt 都报警 且 DSP运行不正常,  

信息如下

undefined first referenced
symbol in file
--------- ----------------
__sqrt ./CLA.obj?

请问, 怎么样才能CLA中正确使用库函数?

  • 一、看相关手册不需要什么配置,如下

    C28x Control Law Accelerator Math Library SPRC99.PDF

    Description Returns the square root of a floating-point argument X using a Newton-
    Raphson algorithm.
    Header File None
    Macro Declaration CLAsqrt .macro y, x
    Input: x = 32-bit floating-point input
    Output: y = sqrt(x) in 32-bit floating-point
    Lookup Tables None
    Special Cases If X = FLT_MAX or FLT_MIN CLAsqrt will set the LUF flag.
    If X = -FLT_MIN CLAsqrt will set both the LUF and LVF flags.
    If X = 0.0, CLAsqrt sets the LVF flag.
    If X is negative, CLAsqrt will set LVF and return 0.0.

    二、看了C200WARE中的sqrt例子,详细对比了CMD LIB等配置,也没找出原因

  • 你好,不知道你看的是哪个例程?这个路径下的例程sqrt的代码:C:\ti\c2000\C2000Ware_4_01_00_00\device_support\f2803x\examples\cla\asin

    检查一下你的程序中是否include了必要的.h文件。

    另外,也可以考虑使用 C28x 控制律加速器 (CLA) 数学宏程序库:https://www.ti.com.cn/tool/cn/SPRC910?_ticdt=MTY0OTk5MjY4N3wwMTc5N2Q3MDUxZjkwMDE5ZDI0ZGZmMzRhYWZlMDMwNzMwMDEzMDZiMDA4NmV8R0ExLjIuODA4MzUxNDAzLjE2MjEzMjQyMzA#overview

  • 你好 

    我搜索了一下,不止我一个人出现这个问题

    且网上没有具体解决办法

    一般都说建议看例程, 或者数学宏函数库

    但是我对比来对比去也没发现问题

    能否详细联系一下, 彻底找出问题来, 公布在网上, 给后来者也可以有个帮助

    另外, 我自己是可以通过把代码复制到例子上去这样是可以解决, 但是我还是不明白问题出在哪里

  • __sqrt

    有两个下划线  我看成一个下划线   真是搞死人了   耗了我2天时间

  • 额,非常感谢你的反馈。。。这个问题确实很容易忽略