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.

[参考译文] TMS320F28388D:在调用_IQ24mpyI32时、IQMath 部分在映射文件中不可见()

Guru**** 2484615 points
Other Parts Discussed in Thread: C2000WARE

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1428174/tms320f28388d-iqmath-section-not-visible-in-map-file-on-calling-_iq24mpyi32

器件型号:TMS320F28388D
Thread 中讨论的其他器件:C2000WARE

工具与软件:

您好!
按如下所示修改 c2000ware 中的 IQMath 示例:

// Include The Following Definition Files:
#include <stdio.h>
#include <stdlib.h>
#include "IQmathLib.h"


//----------------------------------------------------------------------------
// Main code:
//----------------------------------------------------------------------------
int main(void)
{
    _iq tempP;
            tempP = _IQ24mpyI32 ((2L), (3L));
}

我观察到在映射文件中没有创建 IQMath 部分、我认为这不是预期行为。 如果是、这是为了什么?

此致、

Ganesh

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Ganesh

    假设链接器命令文件为输出段分配了 IQMath、则映射文件中应该会包含 IQmath 相关内容、如下所示:

    /*分配 IQ 数学区域:*/
    IQmath :> RAMLS
    IQmathTables :> RAMLs.
    IQmathTablesRam :> RAMLs.

    例如:

    00008eca  00000b50   IQmath_fpu32_eabi.lib : IQmathTables.obj (IQmathTables)

    IQMath 0 0000ab00 000003ba
    0000ab00 0000009d IQmath_fpu32_eabi.lib:IQ29log.obj (IQmath)
    0000ab9d 0000008f:atoIQN.obj (IQmath)
    0000ac2c 00000088:IQ29atan2pu.obj (IQmath)
    0000acb4 00000060:IQ29mag.obj (IQmath)
    0000ad14 00000050:IQ29asin.obj (IQmath)
    0000ad64 00000047:IQ29div.obj (IQmath)
    0000adab 00000042:IQ29sqrt.obj (IQmath)
    0000ADD 0000003b:IQ29exp.obj (IQmath)
    0000ae28 00000032:IQ29sin.obj (IQmath)
    0000ae5a 00000030 : IQ29cos.obj (IQmath)
    0000ae8a 00000016:IQ29toF.obj (IQmath)
    0000aea0 00000011:IQ29mpyI32int.obj (IQmath)
    0000aeb1 00000009:IQ29acos.obj (IQmath)

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Ganesh

    您是否在项目中包括 IQMath 库? 它是否在编译时生成任何警告?

    您在 IQMathlib.h 中的 MATH_TYPE 是否设置为 IQMath 或 FLOAT_MATH?

    谢谢!

    SIRA

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Sira:

    •  是的、IQMath 库包含在工程中:
    • 构建有两条警告:
      • 已设置变量"tempP"、但从未使用
      • 指定了"_c_int00"以外的入口点符号: "code_start"
      • 构建日志如下所示:
      • **** Build of configuration Debug_fpu32IQMATH_EABI for project 2838x_IQsampleC ****
        
        "C:\\ti\\ccs1270\\ccs\\utils\\bin\\gmake" -k all 
         
        Building file: "C:/ti/c2000/C2000Ware_5_03_00_00/libraries/math/IQmath/c28/examples/C/source/IQsample.c"
        Invoking: C2000 Compiler
        "C:/PROGRA~3/MATLAB/tic2000/3P778C~1.INS/TIC28X~1.INS/ti-cgt-c2000_22.6.0.LTS/bin/cl2000" -v28 -ml -mt --float_support=fpu32 --fp_mode=relaxed --include_path="C:/PROGRA~3/MATLAB/tic2000/3P778C~1.INS/TIC28X~1.INS/ti-cgt-c2000_22.6.0.LTS/include" --include_path="C:/ti/c2000/C2000Ware_5_03_00_00/libraries/math/IQmath/c28/include" --advice:performance=all --define=_DEBUG --define=LARGE_MODEL -g --optimize_with_debug=on --diag_warning=225 --quiet --abi=eabi -k --asm_listing --output_all_syms --preproc_with_compile --preproc_dependency="IQsample.d_raw"  "C:/ti/c2000/C2000Ware_5_03_00_00/libraries/math/IQmath/c28/examples/C/source/IQsample.c"
        "C:/ti/c2000/C2000Ware_5_03_00_00/libraries/math/IQmath/c28/examples/C/source/IQsample.c", line 27: warning: variable "tempP" was set but never used
        Finished building: "C:/ti/c2000/C2000Ware_5_03_00_00/libraries/math/IQmath/c28/examples/C/source/IQsample.c"
         
        Building target: "2838x_IQsampleC.out"
        Invoking: C2000 Linker
        "C:/PROGRA~3/MATLAB/tic2000/3P778C~1.INS/TIC28X~1.INS/ti-cgt-c2000_22.6.0.LTS/bin/cl2000" -v28 -ml -mt --float_support=fpu32 --fp_mode=relaxed --advice:performance=all --define=_DEBUG --define=LARGE_MODEL -g --optimize_with_debug=on --diag_warning=225 --quiet --abi=eabi -k --asm_listing --output_all_syms -z -m"2838x_IQsampleC.map" --heap_size=2000 --stack_size=0x0400 --warn_sections -i"C:/PROGRA~3/MATLAB/tic2000/3P778C~1.INS/TIC28X~1.INS/ti-cgt-c2000_22.6.0.LTS/lib" -i"C:/PROGRA~3/MATLAB/tic2000/3P778C~1.INS/TIC28X~1.INS/ti-cgt-c2000_22.6.0.LTS/include" -i"C:/ti/c2000/C2000Ware_5_03_00_00/libraries/math/IQmath/c28/examples/C/2838x" -i"C:/ti/c2000/C2000Ware_5_03_00_00/libraries/math/IQmath/c28/lib" --reread_libs --xml_link_info="28235_IQsampleC_linkInfo.xml" --entry_point=code_start --rom_model -o "2838x_IQsampleC.out" "./CodeStartBranch.obj" "./IQsample.obj" "C:/ti/c2000/C2000Ware_5_03_00_00/libraries/math/IQmath/c28/examples/cmd/2838x_RAM_lnk_CProj_cpu1.cmd"  -lIQmath_fpu32.lib -llibc.a 
        warning: entry-point symbol other than "_c_int00" specified:  "code_start"
        Finished building target: "2838x_IQsampleC.out"
         
        
        **** Build Finished ****
    • 将 IQMathlib.h 中的 MATH_TYPE 设置为 IQMath

    此致、

    Ganesh

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Ganesh

    您的项目基于 IQMath 函数设置 tempP、但从不使用、因此编译器会优化出来。 这就是.map 文件中没有任何 IQMath 引用的原因。

    例如、如果您在 main()中打印 tempP、则应该可以解决您的问题。

    谢谢!

    SIRA

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Ganesh、您的程序是否能正常运行并打印出正确的结果?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Sira:

    该程序可以正常工作、并打印出正确的结果、如下所示:

    第一个操作是2*3=6、在控制台输出中打印、然后是6*3=18。

    此致、

    Ganesh

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Ganesh:

    这真的很奇怪。 您可以在函数中放置一个断点、并检查反汇编代码是否显示 IQMath 函数吗?

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Sira:

    反汇编未显示 IQMath 调用:

    这是优化技术吗?

    此致、
    Ganesh

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Ganesh

    您正在使用的函数在 IQmathlib.h 本身中定义、因此没有函数调用。 此外、编译器能够进一步优化、因为它看到你正在尝试执行2 x 3、因此它会直接将6加载到 ACC 中。 未使用 MPY 指令。

    #define  _IQ24mpyI32 (A、B) ((A)*(B))

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Sira:

    当我用变量替换常量时、我可以看到 IMPYL 运算发生在反汇编中。 然而、映射文件中没有 IQMath 部分:


    此致、
    Ganesh

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    Ganesh

    这是因为您没有调用 IQMath 库汇编函数。 请阅读我之前的回复。

    您正在使用的 IQ 乘法函数定义为常规乘法运算、该运算是使用 C28 IMPYL 指令实现的。 因此、未使用 IQMath 库.o 文件。

    希望这是明确的。 你正变得比你需要的更加困惑。