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.

TMS320F28379D: Not able to run CLAmath from Flash on CPU2 CLA

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Tool/software:

Today I have a dual core delfino.  On CPU2 I'm using CLAmath (e.g.CLAsinPU and CLAcosPU)  on the CLA of the second core.  This works great in RAM but seems to fail when running from FLASH even though the rest of the CLA & CPU programs run fine on that core.   I have debug code to isolate it to these two function calls from CLAmath.  What do you think I'm missing or appears wrong?  Here are a few of the critical pieces in the code that I've been trying to adjust.  Thanks in advance!!

The linker file includes the following:

Fullscreen
1
2
3
4
5
6
7
8
9
10
CPU_CLA_LS_DATA : origin = 0x00A000 length = 0x001000 //CLA data space
CLA1mathTables : > CPU_CLA_LS_DATA, PAGE = 1//was page=1
CLA1mathTables : LOAD = FLASHL,
RUN = CPU_CLA_LS_DATA,
RUN_START(CLA1mathTablesRunStart),
LOAD_START(CLA1mathTablesLoadStart),
LOAD_SIZE(CLA1mathTablesLoadSize),
PAGE = 1, ALIGN(8)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Memory configuration

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//local shared RAM master sel register: value 0==CPU, 1==shared between CPU and CLA
MemCfgRegs.LSxMSEL.bit.MSEL_LS0 = 0;
MemCfgRegs.LSxMSEL.bit.MSEL_LS1 = 0;
MemCfgRegs.LSxMSEL.bit.MSEL_LS2 = 1;
MemCfgRegs.LSxMSEL.bit.MSEL_LS3 = 1;
MemCfgRegs.LSxMSEL.bit.MSEL_LS4 = 1;
MemCfgRegs.LSxMSEL.bit.MSEL_LS5 = 1;
//local shared memory data/prog control register: value 0==CLA data memory, 1==CLA program memory
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS0 = 0;
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS1 = 0;
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS2 = 1;
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS3 = 1;
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS4 = 0;
MemCfgRegs.LSxCLAPGM.bit.CLAPGM_LS5 = 0;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Variables defined before main()

Fullscreen
1
2
3
extern uint16_t CLA1mathTablesLoadStart;
extern uint16_t CLA1mathTablesRunStart;
extern uint16_t CLA1mathTablesLoadSize;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Memory allocation

  • Hi Ryan,

    Just to verify, are you copying your CLA program from flash to RAM in your main C code like the below?

    Also, for the F2837xD devices, the CLA math tables are available in the data ROM so you don't need to load them into flash and copy them to RAM. You don't need to include any lines of the example linker cmd file from the example that are defined for !(CLA_MATH_TABLES_IN_ROM) since this only should apply to older devices. I would recommend using the f2837x_cla_c_lnk.cmd file provided by C2000ware and defining CLA_MATH_TABLES_IN_ROM=1 in your project's predefined symbols, and this should set up your configurations properly.

    Best Regards,

    Delaney

  • Thank you!  This resolved my issue with the CLA trig functions.  I referred to f2837x_cla_c_lnk.cmd as you suggested in order to update my linker file. I didn't fully appreciate that the CLA math tables were available in ROM when I originally studied the cla_cosPU example project, but now I understand the example better after your clear explanation. 

    The biggest issue was that I didn't copy my CLA program from flash to RAM with the memcpy() function.  That was a very critical piece that you found as well.  

    Thank you for your quick response and thorough answer.  Great work!!