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.
Tool/software:
Hi,
As per my understanding, there are two options for creating a function in RAM:
However, both approaches result in different memory allocations.
sharing the sample for the reference
int ramFuncA(int x) { int i = 0; for(i = 0; i < x; i++){} for(i = 0; i < x; i++){} for(i = 0; i < x; i++){} for(i = 0; i < x; i++){} for(i = 0; i < x; i++){} for(i = 0; i < x; i++){} for(i = 0; i < x; i++){} for(i = 0; i < x; i++){} for(i = 0; i < x; i++){} for(i = 0; i < x; i++){} return x * x; }
Could you please explain why these two methods produce different results? I'd appreciate any insights you can provide.
Hello,
I have brought this thread to the attention of the compiler experts for further analysis.
Thanks
ki
For both of these builds ...
- __attribute__((ramfunc))
- #pragma CODE_SECTION(ramFuncA, ".TI.ramfunc")
... please supply the linker command file and the build log. The linker command file has a name similar to name_of_project.map. It is in the directory named after the build configuration, often Debug or Release. To create the build log, please rebuild the entire project. One way to do that is to right-click on the name of the project and select Rebuild Project. Then save the contents of the Console (not Problems) view to a text file. Use the icon named Copy Build Log (older versions of CCS) or Save build log to file (newer versions of CCS). Organize the files into directories with obvious names like attribute_build and pragma_build. Then zip it up and attach that zip to your next post.
Thanks and regards,
-George
Thank you for the map file and build logs.
Both the attribute and the pragma change the default section name for the function from .text to .TI.ramfunc. But the attribute does more. It tells the compiler to use the fast branch instruction instead of a normal branch instruction. A fast branch instruction is 1 word (16-bits) bigger. For details, please search the C28x compiler manual for the sub-chapter titled Controlling Code Size Versus Speed. Focus on the last 2 paragraphs.
Thanks and regards,
-George