Hi Team,
Here's an issue from the customer need your help:
I'm having an issue debugging shared variables for CPU1 and CPU1.CLA.
/*CPU1 .c file */ #pragma SET_DATA_SECTION("cla_shared") int32_t a = 10; #pragma SET_DATA_SECTION() // // Configure LSRAMs // MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS0, MEMCFG_LSRAMCONTROLLER_CPU_CLA1); MemCfg_setCLAMemType(MEMCFG_SECT_LS0, MEMCFG_CLA_MEM_DATA); MemCfg_setLSRAMControllerSel(MEMCFG_SECT_LS1, MEMCFG_LSRAMCONTROLLER_CPU_CLA1); MemCfg_setCLAMemType(MEMCFG_SECT_LS1, MEMCFG_CLA_MEM_DATA); /*CPU1 .cmd file */ CLA_SCRATCHPAD_SIZE = 0x100; --undef_sym=__cla_scratchpad_end --undef_sym=__cla_scratchpad_start CLAscratch : { *.obj(CLAscratch) . += CLA_SCRATCHPAD_SIZE; *.obj(CLAscratch_end) } > RAMLS1 .scratchpad : > RAMLS1 .bss_cla : > RAMLS1 cla_shared : >> RAMLS1 /*CPU1 CLA shared.h */ extern int32_t a; /*CPU1_CLA .cla file */ void Func1(void);
The above is the approximate configuration of my project code. When variable a is defined in cla and cpu sharing LSRAM, variable a is assigned in the c code, and then triggers CLA to execute the task. Execute the Func1 function in the CLA task to read the value of variable a, and find that the value of a has become 0 at this time.
When I comment out the Func1 function and directly read the value of a, it is correct again, and the Func1 function only performs some if statement judgments.
Func1 is defined in the .cla file, and is directly called by the CLAtask1() function in the .cla file. The optimization level is 3. If it is turned off, the memory will overflow.
Why this happened?
--
Thanks & Regards
Yale