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.

TMS320F28377D: CLA中三角函数计算问题

Part Number: TMS320F28377D

Hello!在线调试下(连着仿真器运行):CLAsinCLAcos的三角运算正常。程序烧到FLASH中脱开仿真器运行时:三角函数CLAsin,CLAcos运算结果一直是0。但是CLAdiv和CLAsqrt的计算结果都是正确的,程序中添加的库和clasincostable的使用方法如附件。7433.CLA中CLAsin和CLAcos运算问题.pdf

  • 您好我们已收到您的问题并升级到英文论坛,温馨提示您由于圣诞及新年假期,英文论坛的答复将稍晚。敬请谅解!

  • 您好,您是说应用程序是在debug模式下运行, 而不是在standalone模式下运行?

    如果是Flash config, 您需要确保 CLA 代码和常量加载到了闪存中并复制到 RAM 中。 从您提供的信息来看, .const_CLA 部分直接加载到 RAM 存储器中, 这些值在加电复位后会丢失.

  • 您的问题1:您是说应用程序是在debug模式下运行, 而不是在standalone模式下运行?

    回答问题1:CPU1设定在Release模型下运行

    您的问题2:如果是Flash config, 您需要确保 CLA 代码和常量加载到了闪存中并复制到 RAM 中。

    回答问题2:是Flash 配置,我们已经可以离线跑程序了,实现了其他功能,比如开根号,除法运算等,仅仅三角函数运算不对,这样是否可以说明代码加载到闪存并复制到RAM中是成功的?

    CLA的代码和常量加载到闪存并复制到RAM中的代码如下所示:

    #if defined(__TI_EABI__)
    Cla1Prog : LOAD = FLASHA_M,
    RUN = RAMLS0123,
    LOAD_START(Cla1funcsLoadStart),
    LOAD_END(Cla1funcsLoadEnd),
    RUN_START(Cla1funcsRunStart),
    LOAD_SIZE(Cla1funcsLoadSize),
    PAGE = 0, ALIGN(8)
    #else
    Cla1Prog : LOAD = FLASHA_M,
    RUN = RAMLS0123,
    LOAD_START(_Cla1funcsLoadStart),
    LOAD_END(_Cla1funcsLoadEnd),
    RUN_START(_Cla1funcsRunStart),
    LOAD_SIZE(_Cla1funcsLoadSize),
    PAGE = 0, ALIGN(8)
    #endif

    CLA1mathTables : > RAMLS45, PAGE = 1

    CLA1mathTables : LOAD = FLASHA_M,
    RUN = RAMLS45,
    RUN_START(_CLA1mathTablesRunStart),
    LOAD_START(_CLA1mathTablesLoadStart),
    LOAD_SIZE(_CLA1mathTablesLoadSize),
    PAGE = 1

    memcpy((uint32_t *)&Cla1funcsRunStart, (uint32_t *)&Cla1funcsLoadStart,(uint32_t)&Cla1funcsLoadSize);
    memcpy((uint32_t *)&CLA1mathTablesRunStart, (uint32_t *)&CLA1mathTablesLoadStart,(uint32_t)&CLA1mathTablesLoadSize);

    同时给出CPU代码从flash中复制到RAM中的代码如下:

    memcpy(&RamfuncsRunStart, &RamfuncsLoadStart, (size_t)&RamfuncsLoadSize);

    #ifdef __TI_COMPILER_VERSION__
    #if __TI_COMPILER_VERSION__ >= 15009000
    #if defined(__TI_EABI__)
    .TI.ramfunc : {} LOAD = FLASHA_M,
    RUN = RAMGS8_13,
    LOAD_START(RamfuncsLoadStart),
    LOAD_SIZE(RamfuncsLoadSize),
    LOAD_END(RamfuncsLoadEnd),
    RUN_START(RamfuncsRunStart),
    RUN_SIZE(RamfuncsRunSize),
    RUN_END(RamfuncsRunEnd),
    PAGE = 0, ALIGN(8)
    #else
    .TI.ramfunc : {} LOAD = FLASHA_M,
    RUN = RAMGS8_13,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_SIZE(_RamfuncsLoadSize),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    RUN_SIZE(_RamfuncsRunSize),
    RUN_END(_RamfuncsRunEnd),
    PAGE = 0, ALIGN(8)
    #endif
    #else
    .TI.ramfunc : LOAD = FLASHA_M,
    RUN = RAMGS8_13,
    LOAD_START(_RamfuncsLoadStart),
    LOAD_SIZE(_RamfuncsLoadSize),
    LOAD_END(_RamfuncsLoadEnd),
    RUN_START(_RamfuncsRunStart),
    RUN_SIZE(_RamfuncsRunSize),
    RUN_END(_RamfuncsRunEnd),
    PAGE = 0, ALIGN(8)
    #endif
    #endif

    您的问题3:从您提供的信息来看, .const_CLA 部分直接加载到 RAM 存储器中, 这些值在加电复位后会丢失.

    回答问题3:您的意思是不是将  .const_cla       : > RAMLS45,       PAGE = 1 修改如下:

    .const_cla : LOAD = FLASHA_M,
    RUN = RAMLS0123,
    RUN_START(_Cla1ConstRunStart),
    LOAD_START(_Cla1ConstLoadStart),
    LOAD_SIZE(_Cla1ConstLoadSize),
    PAGE = 0

  • Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    // The user must define CLA_C in the project linker settings if using the
    // CLA C compiler
    // Project Properties -> C2000 Linker -> Advanced Options -> Command File
    // Preprocessing -> --define
    #ifdef CLA_C
    // Define a size for the CLA scratchpad area that will be used
    // by the CLA compiler for local symbols and temps
    // Also force references to the special symbols that mark the
    // scratchpad are.
    CLA_SCRATCHPAD_SIZE = 0x100;
    --undef_sym=__cla_scratchpad_end
    --undef_sym=__cla_scratchpad_start
    #endif //CLA_C
    MEMORY
    {
    PAGE 0 :
    /* BEGIN is used for the "boot to SARAM" bootloader mode */
    BEGIN : origin = 0x080000, length = 0x000002
    /* RAMM0 : origin = 0x000123, length = 0x0002DD*/
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    附上CMD文件

  • 回答问题3:您的意思是不是将  .const_cla       : > RAMLS45,       PAGE = 1 修改如下:

    对的,CLA CONST 要加载到flash并复制到 RAM。 请确保添加 memcpy 函数以将内容从flash复制到 RAM。

  • 好的,我试一下看看