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.

28335调用正弦函数的问题

你好!我有相关问题请教一下。

我采用rts2800_fpu32.lib浮点FPU支持库进行正弦函数的使用。dsp为28335;ccs版本为CCS6.0.1

我已经按照相关要求进行如下配置:

1 in Runtime Model Options, under "Specify floating point support (--float_support) pull-down menu: Select "fpu32".

2 In "Include linker file or command file as input (--library, -l)"box, click green plus sign and add rts2800_fpu32.lib(run-time support library).

但是,编译工程后,警告我“function sin declared implicitly”,并且计算结果也是错的。请问是什么情况?谢谢!

  • 请您查看TMS320C28x Floating Point Unit and Instruction Set Reference Guide

    www.ti.com/.../sprueo2a.pdf

    1.2.1 Floating-Point Code Development

    确保IDE和CGT版本符合要求并使能了fpu32,同时加入了相关的浮点库。
  • 另外我们有专门的wiki页面,您可以参考一下

    processors.wiki.ti.com/.../C28x_Code_Generation_Tips_and_Tricks
  • 你好!

    我之前已经按照processors.wiki.ti.com/.../C28x_Code_Generation_Tips_and_Tricks中所说添加了rts2800_fpu32.lib,并且使能了fpu32。所用CCS的版本为6,应该也是没问题的。

    下面是debug文件夹下的截取的部分.map文件,应该可以说明,已经调用了rts2800_fpu32.lib了吧?

    .text 0 00009000 00000a32
    00009000 00000323 DSP2833x_DefaultIsr.obj (.text:retain)
    00009323 00000280 ADC_SOC_INT.obj (.text:retain)
    000095a3 000000f8 DSP2833x_SysCtrl.obj (.text)
    0000969b 000000a1 DSP2833x_EPwm.obj (.text)
    0000973c 0000009b ADC_SOC_INT.obj (.text)
    000097d7 00000088 rts2800_fpu32.lib : fs_div.obj (.text)
    0000985f 0000007b DSP2833x_CpuTimers.obj (.text)
    000098da 00000058 rts2800_fpu32.lib : sin.obj (.text)
    00009932 00000046                              : boot.obj (.text)
    00009978 0000002a DSP2833x_Adc.obj (.text)
    000099a2 00000028 DSP2833x_PieCtrl.obj (.text)
    000099ca 00000022 DSP2833x_PieVect.obj (.text)
    000099ec 00000019 rts2800_fpu32.lib : args_main.obj (.text)
    00009a05 00000019 : exit.obj (.text)
    00009a1e 00000009 : _lock.obj (.text)
    00009a27 00000008 DSP2833x_CodeStartBranch.obj (.text)
    00009a2f 00000003 DSP2833x_DBGIER.obj (.text)

    另外,我不清楚出现问题是否与cmd有关,所以下面附上cmd文件。敬请斧正!谢谢!

    MEMORY
    {
    PAGE 0 :
    /* BEGIN is used for the "boot to SARAM" bootloader mode */
    /* BOOT_RSVD is used by the boot ROM for stack. */
    /* This section is only reserved to keep the BOOT ROM from */
    /* corrupting this area during the debug process */

    BEGIN : origin = 0x000000, length = 0x000002 /* Boot to M0 will go here */
    BOOT_RSVD : origin = 0x000002, length = 0x00004E /* Part of M0, BOOT rom will use this for stack */
    RAMM0 : origin = 0x000050, length = 0x0003B0

    RAML0 : origin = 0x008000, length = 0x001000
    RAML1 : origin = 0x009000, length = 0x001000
    RAML2 : origin = 0x00A000, length = 0x001000
    RAML3 : origin = 0x00B000, length = 0x001000
    ZONE6A : origin = 0x100000, length = 0x00FC00 /* XINTF zone 6 - program space */
    CSM_RSVD : origin = 0x33FF80, length = 0x000076 /* Part of FLASHA. Program with all 0x0000 when CSM is in use. */
    CSM_PWL : origin = 0x33FFF8, length = 0x000008 /* Part of FLASHA. CSM password locations in FLASHA */
    ADC_CAL : origin = 0x380080, length = 0x000009
    RESET : origin = 0x3FFFC0, length = 0x000002
    IQTABLES : origin = 0x3FE000, length = 0x000b50
    IQTABLES2 : origin = 0x3FEB50, length = 0x00008c
    FPUTABLES : origin = 0x3FEBDC, length = 0x0006A0
    BOOTROM : origin = 0x3FF27C, length = 0x000D44


    PAGE 1 :
    RAMM1 : origin = 0x000400, length = 0x000400 /* on-chip RAM block M1 */
    RAML4 : origin = 0x00C000, length = 0x001000
    RAML5 : origin = 0x00D000, length = 0x001000
    RAML6 : origin = 0x00E000, length = 0x001000
    RAML7 : origin = 0x00F000, length = 0x001000
    ZONE6B : origin = 0x10FC00, length = 0x000400 /* XINTF zone 6 - data space */
    }


    SECTIONS
    {
    /* Setup for "boot to SARAM" mode:
    The codestart section (found in DSP28_CodeStartBranch.asm)
    re-directs execution to the start of user code. */
    codestart : > BEGIN, PAGE = 0
    ramfuncs : > RAML0, PAGE = 0
    .text : > RAML1, PAGE = 0
    .cinit : > RAML0, PAGE = 0
    .pinit : > RAML0, PAGE = 0
    .switch : > RAML0, PAGE = 0

    .stack : > RAMM1, PAGE = 1
    .ebss : > RAML4, PAGE = 1
    .econst : > RAML5, PAGE = 1
    .esysmem : > RAMM1, PAGE = 1

    IQmath : > RAML1, PAGE = 0
    IQmathTables : > IQTABLES, PAGE = 0, TYPE = NOLOAD
    IQmathTables2 : > IQTABLES2, PAGE = 0, TYPE = NOLOAD
    FPUmathTables : > FPUTABLES, PAGE = 0, TYPE = NOLOAD

    DMARAML4 : > RAML4, PAGE = 1
    DMARAML5 : > RAML5, PAGE = 1
    DMARAML6 : > RAML6, PAGE = 1
    DMARAML7 : > RAML7, PAGE = 1

    ZONE6DATA : > ZONE6B, PAGE = 1

    .reset : > RESET, PAGE = 0, TYPE = DSECT /* not used */
    csm_rsvd : > CSM_RSVD PAGE = 0, TYPE = DSECT /* not used for SARAM examples */
    csmpasswds : > CSM_PWL PAGE = 0, TYPE = DSECT /* not used for SARAM examples */

    /* Allocate ADC_cal function (pre-programmed by factory into TI reserved memory) */
    .adc_cal : load = ADC_CAL, PAGE = 0, TYPE = NOLOAD

    }

  • 您现在还是有编译错误?相同的错误?
  • 不是编译错误,是warning:“function sin declared implicitly”,可以运行程序。但是,正弦函数的计算结果是错的。
  • 你好!若已经配置好rst2800_fpu32.lib。还需要包含头文件“math.h”吗?

  • 需要包含的 math.h中有sin函数的定义
  • 我找了个板子试了一下,可以正常计算结果的