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: TI C/C++ Compiler
I have qty 4 two dimensional floating point arrays I would like to store in the Shared RAM section. It appears there are 14 sections labelled RAMGS0-RAMGS13 in the Data Memory Page, each 0x001000 large. I have studied the documentation and I think I am close to understanding, but missing the final details. I would think the #pragma DATA_SECTION would work for the Arrays, but not sure how to make sure the memory sections are concatenated. Could I redefine a memory section in the .cmd file to encompass the memory space needed?
Thanks for your attention and help.
David,
You can combine the section, and make a larger section for your need.
Please refer to Linker Command Primer page and check the splitting the section.
software-dl.ti.com/.../sdto_cgt_Linker-Command-File-Primer.html
Thanks Santosh,
After a day going through that reference and the assembler documentation, not much closer (although I keep learning more about linking) So I am trying to figure out the syntax for the DATA_SECTION pragma (is it simply a name that gets translated into the object code as a section?) and then how to translate that section name to an output memory section. What is the input section name? is it the same as what is given in the DATA_SECTION pragma? Am I allowed to create any memory section output name (that is not reserved) and does it have to be a .xxxxx syntax?
Thanks again
David,
Compiler users guide also explains the linker command file.
David Peter1 said:What is the input section name? is it the same as what is given in the DATA_SECTION pragma?
Yes, You create a section with a given name, and then you place the section in your memory_section and then place your variable in this section using DATA_SECTION.
David Peter1 said:Am I allowed to create any memory section output name (that is not reserved) and does it have to be a .xxxxx syntax?
Yes, you can give the section name whatever you like. Do not use any section name which is already used by compiler. Refer to compiler documentation
Thanks again Santosh,
I have been using the Compiler users guide as well, it is not real specific on the actual argument syntax for the DATA_SECTION pragma, so I appreciate your response.
I did run into a few problems. One is that in creating a new .cmd file that I put in the project directory, had problems with a linked .cmd file. It took me some time to figure out that CCS looks in the project files first and had duplicate .cmd files. The linked .cmd file was from the original project setup, and when it was deleted (along with the same file in the build config), then it worked.
The other problem is that it appears that the linker does not like to cross memory boundaries with a single entity, such as my arrays. This limits the array size to the size of the memory section. This is workable for my application but it would be nice if larger arrays using multiple memory spaces was doable.So unless there is a way to do that then I am good with this solution.
Here is the snippet from the C code:
// Put Data in Global Shared RAM, DATA_ARRAY is assigned to RAMGSx in Linker .cmd file
#pragma DATA_SECTION (Data1_Int, "DATA_ARRAY_1")
#pragma DATA_SECTION (Data1_Dat, "DATA_ARRAY_2")
#pragma DATA_SECTION (Data2_Int, "DATA_ARRAY_1")
#pragma DATA_SECTION (Data2_Dat, "DATA_ARRAY_3")
#pragma DATA_SECTION (Data3_Int, "DATA_ARRAY_1")
#pragma DATA_SECTION (Data3_Dat, "DATA_ARRAY_4")
#pragma DATA_SECTION (Data4_Int, "DATA_ARRAY_1")
#pragma DATA_SECTION (Data4_Dat, "DATA_ARRAY_5")
Uint32 Data1_Int [Array_Depth1][2];
float Data1_Dat [Array_Depth1][Array_Width1];
Uint32 Data2_Int [Array_Depth2][2];
float Data2_Dat [Array_Depth2][Array_Width2];
Uint32 Data3_Int [Array_Depth3][2];
float Data3_Dat [Array_Depth3][Array_Width3];
Uint32 Data4_Int [Array_Depth4];
float Data4_Dat [Array_Depth4][Array_Width4];
And here is the snippet from the linker .cmd file in the Sections
DATA_ARRAY_1 : > RAMGS2 , PAGE = 1
DATA_ARRAY_2 : > RAMGS3 , PAGE = 1
DATA_ARRAY_3 : > RAMGS4 , PAGE = 1
DATA_ARRAY_4 : > RAMGS5 , PAGE = 1
DATA_ARRAY_5 : > RAMGS6 , PAGE = 1
Hi David,
David Peter1 said:I did run into a few problems. One is that in creating a new .cmd file that I put in the project directory, had problems with a linked .cmd file. It took me some time to figure out that CCS looks in the project files first and had duplicate .cmd files. The linked .cmd file was from the original project setup, and when it was deleted (along with the same file in the build config), then it worked.
Yes, all the files in the folder are included. So if you have more than one .cmd file in that folder, then you can "exclude the file from compile" by right-clicking on the file.
David Peter1 said:The other problem is that it appears that the linker does not like to cross memory boundaries with a single entity, such as my arrays. This limits the array size to the size of the memory section. This is workable for my application but it would be nice if larger arrays using multiple memory spaces was doable.So unless there is a way to do that then I am good with this solution.
Regarding this, your implementation looks good. If you want to have it split across multiple sections, then you can try something like below (not sure if you tried already):
DATA_ARRAY_1 : >> RAMGS2 | RAMGS3, PAGE = 1
I appreciate your time Santosh.
The "Exclude from Build" is a another option I had not considered.
I did try the
DATA_ARRAY_1 : >> RAMGS2 | RAMGS3, PAGE = 1
first but ended up with the "won't fit" error until I broke up the arrays into individual sections.
Thanks again for your help.