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.

CLA scratchpad size



I'm currently implementing CLA algorithms on 28033 with CCSv5.

Helpful ressources were:
http://e2e.ti.com/support/microcontrollers/c2000/f/171/t/253678.aspx
http://processors.wiki.ti.com/index.php/C2000_CLA_C_Compiler#C_Language_Restrictions

Because I need both CLA Data RAM 0 and 1 for the CPU I placed the scratchpad in CLA-to-CPU Messsage RAM (0x1480).
This does work, but as memory space is used both for scratchpad and messaging, I have to keep CLA_SCRATCHPAD_SIZE as small as possible.

Problems/questions:

1. How do I know the required scratchpad size?
The only way I found is to look for the highest offset to __cla_scratchpad_start in the CLA compiler's assembly output.

2. How can I make the linker warn me if the compiler uses more scratchpad memory than assigned by CLA_SCRATCHPAD_SIZE?
Currently, if the scratchpad overflows, there is no warning at all.

3. Apparently, the first 4 scratchpad memory locations are not used, the lowest reference I see is "__cla_scratchpad_start+4".

4. Why doesn't the compiler simply allocate space for scratchpad data like it does for all other segments?
This would make it much easier to use, and solve problems 1 und 2 as well.

CLA_SCRATCHPAD_SIZE = 0x10;
--undef_sym=__cla_scratchpad_end
--undef_sym=__cla_scratchpad_start
....
CLAscratch :
{
*.obj(CLAscratch)
. += CLA_SCRATCHPAD_SIZE;
*.obj(CLAscratch_end)
} > CLA1_MSGRAMLOW, PAGE = 1

  • Thank you for the feedback.

    ichlfgang said:
    1. How do I know the required scratchpad size?

    You will need to add the largest offset from the __cla_scratchpad_start symbol with the largest offset from the __cla_scratchpad_end symbol. Interrupt functions use offsets from the start of the scratchpad and leaf functions use offsets from the end of the scratchpad. To prevent overlap you need to allocate space for both.

    ichlfgang said:
    2. How can I make the linker warn me if the compiler uses more scratchpad memory than assigned by CLA_SCRATCHPAD_SIZE?

    There is no way to generate a warning from the linker at this time.

    ichlfgang said:
    3. Apparently, the first 4 scratchpad memory locations are not used, the lowest reference I see is "__cla_scratchpad_start+4".

    I will have to look into this further. 

    ichlfgang said:
    4. Why doesn't the compiler simply allocate space for scratchpad data like it does for all other segments?
    This would make it much easier to use, and solve problems 1 und 2 as well.

    We are already investigating this possibility for the next CLA compiler release. At this time it is not certain that we will add this support, but we will take your feedback into consideration when prioritizing the feature.