hi ,
I am defining an array in CLA file. However, when I debug through ccs, the variable reads 0 in the watch window.
float x[] = {1,2};
The x size is correct in CCS watch window but the values are 0.
Can we not use arrays inside CLA?

Thanks,
Mukul
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.
hi ,
I am defining an array in CLA file. However, when I debug through ccs, the variable reads 0 in the watch window.
float x[] = {1,2};
The x size is correct in CCS watch window but the values are 0.
Can we not use arrays inside CLA?

Thanks,
Mukul
Hi Mukul,
You can use arrays in CLA. I believe the issue is with the Expressions window, All the local variables in CLA tasks seems to be read as 0.
Thank you for reporting it. I will report the issue to the CCS team
As a workaround, please view the memory contents through the memory browser view
Regards,
Veena
Hi Mukul,
in CLA it is not possible to initialize a variable when declaring it (there is no memory section for initialized variables).
The initialization must be done in a task that is called during system initialization, preferably in task 8 as it has the lowest priority.
Regards,
Jan
I was able to see array values in CLA when I declared and initialized arrays separately. But the same thing didn't hold true for single numbers.
Note, I am using local variables inside CLA task.
For example , For the code below in CLA
float a = 5.6; // This worked and I was able to read value in CCS watch window correctly
In case of arrays initialization at the time declaration didn't work.
What is the reason for the above observation?
Hi Mukul,
Are you talking about global variables or local variables?
In case of global variables, as Jan mentioned, it cannot be initialized during the declaration. But local variables can be initialized along with declaration
For some reason, I am unable to reproduce the issue now. I am able to read the local variables under Expressions window

Regards,
Veena
Hi Veena,
I am talking about local variables. I tried using the array in one of the examples from TI. When I boot from RAM, the initialization works during declaration. However , it does not work when I boot from flash.
Thanks,
Mukul
Hi,
I am using TI example cla_ex1_asin. I didn't make any change in the command linker file . I had just added a dummy code in the cla task.
here are the reproduction steps:
1) Working Configuration:
Set in build configuration CPU1_RAM as active and deploy code in hardware. I could see the array values in the ccs watch window.

2) Not working Configuration
Set in build configuration CPU1_Flash as active and deploy code in hardware. I could not see the array values in the ccs watch window.

Let me know if you need any more information to reproduce the issue, or is there something that I am dong wrong.
Thanks,
Mukul
Hi Mukul,
I think I found the issue. In case of Flash configuration, we are loading CLA const section in Flash and later copied to RAM. This copying is missing in the example.
The following copies the CLAProg section. Similarly, you need to do the same for const_cla section as well.
memcpy((uint32_t *)&Cla1funcsRunStart, (uint32_t *)&Cla1funcsLoadStart,
(uint32_t)&Cla1funcsLoadSize);
Regards,
Veena