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.

[参考译文] TMS320F28377S:即使将 CLA1mathTables 添加到闪存和 memcpy 后、CLA 数学三角函数也不工作

Guru**** 2419530 points


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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/1200665/tms320f28377s-cla-math-trignomateric-functions-are-not-working-even-after-adding-cla1mathtables-in-flash-and-memcpy-to-ram

器件型号:TMS320F28377S

大家好、

我只想在28377s CLA 中使用 CLAsin 和 CLOCOS 函数。 CLAdiv & CLAsqrt 工作正常、但三角函数不工作。 我在调试模式下进行了检查、结果 与其他 CLA 数学运算符合预期、但三角函数结果始终为零。 下面是内存配置(*。cmd 文件、

MEMORY
{
PAGE 0:    /* Program Memory */
   BEGIN_M0            : origin = 0x000000, length = 0x000002     /* Part of M0 RAM - used for "Boot to M0" bootloader mode */
   RAMLS4              : origin = 0x00A000, length = 0x000800     /* L4 RAM, DCSM secure, CLA Program RAM */
   RAMLS5              : origin = 0x00A800, length = 0x000800     /* L5 RAM, DCSM secure, CLA Program RAM */
   RAMGS0123           : origin = 0x00C000, length = 0x004000     /* GS0-3 RAM, Parity, DMA */
   BEGIN_FLASH         : origin = 0x080000, length = 0x000002     /* Part of FLASH Sector A - used for "Jump to flash" bootloader mode */
   FLASH_A             : origin = 0x080002, length = 0x001FFE     /* Part of FLASH Sector A - DCSM secure */
   FLASH_BCDEFGHIJKLMN : origin = 0x082000, length = 0x03E000     /* FLASH Sectors B,C,D,E,F,G,H,I,J,K,L,M,N combined - DCSM secure */
   RESET           (R) : origin = 0x3FFFC0, length = 0x000002     /* Part of Boot ROM */

PAGE 1:    /* Data Memory */
   BOOT_RSVD           : origin = 0x000002, length = 0x00004E     /* Part of M0 RAM, BOOT rom will use this for stack */
   RAMM0               : origin = 0x000050, length = 0x0003B0     /* M0 RAM */
   RAMM1               : origin = 0x000400, length = 0x000400     /* M1 RAM */
   CLA1_MSGRAMLOW      : origin = 0x001480, length = 0x000080     /* CLA to CPU Message RAM, DCSM secure */
   CLA1_MSGRAMHIGH     : origin = 0x001500, length = 0x000080     /* CPU to CLA Message RAM, DCSM secure */
   RAMLS0              : origin = 0x008000, length = 0x000800     /* L0 RAM, DCSM secure, CLA Data RAM */
   RAMLS1              : origin = 0x008800, length = 0x000800     /* L1 RAM, DCSM secure, CLA Data RAM */
   RAMLS2              : origin = 0x009000, length = 0x000800     /* L2 RAM, DCSM secure, CLA Data RAM */
   RAMLS3              : origin = 0x009800, length = 0x000800     /* L3 RAM, DCSM secure, CLA Data RAM */
   RAMD0               : origin = 0x00B000, length = 0x000800     /* D0 RAM, DCSM secure, ECC */
   RAMD1               : origin = 0x00B800, length = 0x000800     /* D1 RAM, DCSM secure, ECC */   
   RAMGS4              : origin = 0x010000, length = 0x001000     /* GS4 RAM, Parity, DMA */
   RAMGS5              : origin = 0x011000, length = 0x001000     /* GS5 RAM, Parity, DMA */
   RAMGS6              : origin = 0x012000, length = 0x001000     /* GS6 RAM, Parity, DMA */
   RAMGS7              : origin = 0x013000, length = 0x001000     /* GS7 RAM, Parity, DMA */
   RAMGS89ABCDEF       : origin = 0x014000, length = 0x008000     /* GS8-15 RAM, Parity, DMA */
}

 
SECTIONS
{
/*** Compiler Required Sections ***/

  /* Program memory (PAGE 0) sections */
   .text               : > FLASH_BCDEFGHIJKLMN,   PAGE = 0
   .cinit              : > FLASH_BCDEFGHIJKLMN,   PAGE = 0
   .const              : > FLASH_BCDEFGHIJKLMN,   PAGE = 0
   .econst             : > FLASH_BCDEFGHIJKLMN,   PAGE = 0
   .pinit              : > FLASH_BCDEFGHIJKLMN,   PAGE = 0
   .reset              : > RESET,                 PAGE = 0, TYPE = DSECT  /* Not using the .reset section */
   .switch             : > FLASH_BCDEFGHIJKLMN,   PAGE = 0

  /* Data Memory (PAGE 1) sections */
   .bss                : > RAMM0,                 PAGE = 1
   .ebss               : > RAMGS89ABCDEF,                 PAGE = 1
   .cio                : > RAMM0,                 PAGE = 1
   .stack              : > RAMM1,                 PAGE = 1
   .sysmem             : > RAMM1,                 PAGE = 1
   .esysmem            : > RAMM1,                 PAGE = 1

/*** CLA Compiler Required Sections ***/
   .scratchpad         : > RAMLS0,                PAGE = 1                /* Scratchpad memory for the CLA C Compiler */

/*** User Defined Sections ***/
   codestart           : > BEGIN_FLASH,           PAGE = 0                /* Used by file CodeStartBranch.asm */
   dmaMemBufs          : > RAMGS4,                PAGE = 1                /* Link to DMA accessible memory */
   Cla1ToCpuMsgRAM     : > CLA1_MSGRAMLOW,        PAGE = 1                /* Link to CLA Message RAM */
   CpuToCla1MsgRAM     : > CLA1_MSGRAMHIGH,       PAGE = 1                /* Link to CLA Message RAM */
   Cla1Data1           : > RAMLS1,                PAGE = 1                /* Link to CLA Data RAM */
   Cla1Data2           : > RAMLS2,                PAGE = 1                /* Link to CLA Data RAM */

   /* Section secureRamFuncs used by file Flash.c. */
   secureRamFuncs      :  LOAD = FLASH_BCDEFGHIJKLMN, PAGE = 0            /* Load to flash, run from DCSM secure RAM */
                          RUN = RAMLS5,               PAGE = 0
                          LOAD_START(_secureRamFuncs_loadstart),
                          LOAD_SIZE(_secureRamFuncs_loadsize),
                          RUN_START(_secureRamFuncs_runstart)

   /* Section Cla1Prog used by file Cla.c */
   Cla1Prog            :  LOAD = FLASH_BCDEFGHIJKLMN, PAGE = 0            /* Load to flash, run from CLA Program RAM */
                          RUN_START(_Cla1Prog_Start)
                          RUN = RAMLS4,               PAGE = 0
                          LOAD_START(_cla1Funcs_loadstart),
                          LOAD_SIZE(_cla1Funcs_loadsize),
                          RUN_START(_cla1Funcs_runstart) 

  CLA1mathTables   :   LOAD = FLASH_BCDEFGHIJKLMN, PAGE = 0
                       RUN = RAMLS4, PAGE = 0
                       RUN_START(_CLA1mathTablesRunStart),
                       LOAD_START(_CLA1mathTablesLoadStart),
                       LOAD_SIZE(_CLA1mathTablesLoadSize)
}

我使用下面的代码将内容从闪存复制到 RAM、

void InitCla(void)
{
    extern uint32_t CLA1mathTablesRunStart, CLA1mathTablesLoadStart, CLA1mathTablesLoadSize;

    asm(" EALLOW");                     // Enable EALLOW protected register access

//--- Copy the CLA program code from its load address to the CLA program
//--- memory (using memcpy() from RTS library).
    memcpy(&cla1Funcs_runstart, &cla1Funcs_loadstart, (Uint32)&cla1Funcs_loadsize);

    memcpy((uint32_t *)&CLA1mathTablesRunStart, (uint32_t *)&CLA1mathTablesLoadStart,
            (uint32_t)&CLA1mathTablesLoadSize);

下面我将使用 CLAmath。

#include "Lab.h"                        // Main include file

#include "CLAmath.h"

interrupt void Cla1Task1 (void)
{
    // Local Variables
    float32 Y,X;

    __mdebugstop();
   
    X = CLAcosPU(0.5);// Just for example I put this example line of code

}

我在接头下面列出了这些内容

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

    您好!

    您的查询已分配给 CLAMath 专家。 您很快就会收到回复。

    此致、

    Veena