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.
Dear Champs,
I am asking this for our customer.
The user wonders if it possible to change CLA codes from flash to RAM "online".
The CLA can be stopped (not triggered) temporarily during code change.
For example, A(), B() are both in the flash initially.
A() is moved from flash to CLA program RAM (task1) first and run.
When an event happens, then CLA stops running, and then move B() codes from flash to CLA program RAM (task1) and override A(), and then run B().
Likewise, when another event happens, then CLA stops running, and then move A() codes from flash to CLA program RAM (task1) and override B(), and then run A().
Based on the event, the CLA should be able to run either of A(), B().
Note that because the total code size of A()+B() are much larger than CLA program RAM, the user could not put them together on CLA program RAM. The user could not put A() or B() on CPU either because CPU is occupied by others.
Questions:
1) Is it possible to run CLA A() or B() like the above?
2) Because the use of function pointers is not supported on CLA C compiler, the A(), B() should be used like this way in CLA task1 where one of A() and B() is on CLA program RAM and the other is on flash at the same time.
Does this work?
That is, if the user can ensure that the code (either A() or B()) running on CLA is on CLA program RAM at that time, is there any concern (from compiler/HW) about writing codes in this way?
CLA_task1()
{
if (event A)
{
A()
}
else
{
B()
}
}
3) OR do you have any other suggestion for writing CLA codes for the above usage?
Wayne Huang
Wayne,
Yes, this should work. You will need to make sure no task is running and won't be triggered while the code is swapped out. If the vector for the task start changes you will need to update this also.
I suggest taking a small example and trying it out.
Best Regards
Lori
Dear Lori,
"If the vector for the task start changes you will need to update this also"
Do you mean the task start (interrupt vector), right?
If we only use task 1, the task start should not change, right?
But you mean if we also use other tasks like task2... they might change because the codes of task1 is changed. Therefore, we need to re-initialize the CLA task start (interrupt vectors). Is our understanding correct?
Wayne Huang
Yes, if the task is the same, or more importantly in the same start location, then the interrupt vector will be the same. It is something to check.
Regards
Lori