SPRU514Z July 2001 – October 2023 SM320F28335-EP
Uninitialized global data is placed in section .bss_cla.
Initialized const data is placed in section .const_cla.
There is no C system heap for CLA, because there is no support for malloc().
Local variables and compiler temps are placed into a scratchpad memory area, which acts as the CLA C software stack. It is expected that the scratchpad memory area is defined and managed in the application's linker command file.
Instead of using a stack, each function has a generated function frame that is part of the .scratchpad section. Therefore, the only section that needs to be placed in the linker command file is the .scratchpad section. A scratchpad frame is designated for each function to hold local data, function arguments, and temporary storage. The linker determines which function frames can be overlaid in placement to save memory.
CLA function frames are placed in the .scratchpad section and are named in the form ".scratchpad:functionSectionName". Each function has its own subsection, and thus a unique section name. For example, if the source-level function name is "Cla1Task1", then the COFF function name will be "_Cla1Task1", the function section name will be "Cla1Prog:_Cla1Task1", and the function's scratchpad frame will be named ".scratchpad:Cla1Prog:_Cla1Task1". The function's scratchpad frame will use the base symbol "__cla_Cla1Task1_sp".
CLA2 background tasks are placed in the .scratchpad section and are named in the form ".scratchpad:background:functionSectionName". The background task frame cannot be overlaid with any other function frames, since the background task is likely to be returned to after yielding to interrupts.
Note that if an assembly writer uses a different naming convention for the data space of a function, it cannot be overlaid nor placed within the .scratchpad section.
It is not necessary to specify a size for the .scratchpad section.
CLA object files compiled with compiler versions prior to 6.4 are compatible with newly generated object files so long as the linker command file supports both scratchpad naming conventions. However, the scratchpad section used for old object files cannot be overlaid with the new .scratchpad section and you must ensure that enough memory is available for both sections.