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.

TMS320F28379D: Memory Allocation

Part Number: TMS320F28379D
Other Parts Discussed in Thread: C2000WARE

Hi, 

Is it possible to access the FLASH memory and combine them with RAMGS to form one memory block so as i can write an array of 26 Variables (idealy) as shown below? Each Variable contains 2000 data points. I've combined all RAMGS and still require more space. 

I have attached the screenshot to my memory allocation.

// Define the structure
struct Data_struct {

float arrayVa[2000]; // Array to hold Va readings
float arrayVb[2000]; // Array to hold Vb readings
float arrayVc[2000]; // Array to hold Vc readings
float arrayVn[2000];

float arrayDCYa[2000];
float arrayDCYb[2000];
float arrayDCYc[2000];

float arrayVaLP[2000]; // Array to hold VaLP readings
float arrayVbLP[2000]; // Array to hold VbLP readings
float arrayVcLP[2000]; // Array to hold VcLP readings
float arrayVnLP[2000];

float arrayIa[2000];
float arrayIb[2000];
float arrayIc[2000];

float arrayVdc[2000];
float arrayVnx[2000];

// float arrayId[2000];
//float arrayIq[2000];

//float arrayId_REF[2000];
//float arrayIq_REF[2000];

//float arrayVdSS[2000];
//float arrayVqSS[2000];
//float arrayV0SS[2000];


float arrayPLL[2000];

//float arrayVd[2000];
//float arrayVq[2000];

//float arrayMPC_PLL[500];

}data;

Kind regards

Edwin

  • Hello Edwin,

    While the compiler may allow it, this is not recommended. RAM and Flash operate at different frequencies and have different hardware, trying to combine them for accessing a single struct/variable/array could produce possible timing issues, accessing stale data, etc. The better way would be to program the entire struct in Flash rather than just a portion of it. There should be plenty of space within the Flash sector to do this.

  • Hi Omer, 

    When i try and allocate on FLASHI_M, its says there is an ovelap with FLASHN.  Not sure if am doing it correctly

    Kind regards

    Edwin

  • I have managed to use FLASHI_M, it compiles alright but all variables in watch window are NaN as shown by the attachments

    FLASHI_M : origin = 0x0A8000, length = 0x0016000 /* on-chip Flash */
    //FLASHJ : origin = 0x0B0000, length = 0x008000 /* on-chip Flash */
    //FLASHK : origin = 0x0B8000, length = 0x002000 /* on-chip Flash */
    //FLASHL : origin = 0x0BA000, length = 0x002000 /* on-chip Flash */
    //FLASHM : origin = 0x0BC000, length = 0x002000 /* on-chip Flash */

    Kind regards

    Edwin

  • Hello Edwin,

    When you manually modify the existing Flash sectors in the linker command file, it looks like you're overlapping the sectors themselves. If you plan on combining a set of memory for a specific section like .text, instead of combining the memory sections in the pages themselves, you should just concatenate them in the SECTIONS:

    What you're doing is manually using more memory which overlaps with the address of an existing section. If you want to modify it you can, but you'll need to also manually check that you're using the right memory ranges yourself:

    This table comes from the datasheet, please refer to it if you plan to continue using custom memory sections.

  • Hi Omer, 

    When i Concatenate FLASHI and FLASHJ, a build error occurs (below)

    Description Resource Path Location Type
    <a href="file:/C:/Users/ezyen/PhD_Project/ccs/tools/compiler/dmed/HTML/10099.html">#10099-D</a> program will not fit into available memory, or the section contains a call site that requires a trampoline that can't be generated for this section. run placement with alignment/blocking fails for section ".ebss" size 0xddb5 page 1. Available memory ranges: 2837xD_FLASH_lnk_cpu1.cmd /NG_Initial_V2.7_FLASH line 98 C/C++ Problem

    Combining the memory, builds alright but the variables in the watch window are all NaN. 

    Kind regards

    Edwin

  • Hello Edwin,

    If you're using the default linker command file for Flash, you will need to check your Memory Allocation window to see which section does not have enough memory allocated for it. Based on this, you can add more " | FLASH" to that section until it fits. The Memory Allocation window will give you an idea of how much you need to add.

  • Hi Omer, 

    No matter how many i add am ending up with a trampoline error (please see below). This is with 16 variables of a data structure

    If i use RAMGS0_13 on 16 variables am able to compile and works fine.

  • Can you send a screenshot of the Memory Allocation window after you build the project?

  • Hi Omer, 

    Please see below

  • Hello Edwin,

    This is not the Memory Allocation window, this is a .map file. What I'm look for is the below window:

    You can open this window by going to View > Memory Allocation.

  • Apologies. Please see below

  • It doesn't look like you have any errors when allocating, I thought you were getting an error before that the program wouldn't fit into memory. Are you using a standard linker command file from an existing C2000Ware example or are you making your own with custom/combined sections? As of now it doesn't look like there should be any problem as long as you're using valid memory ranges which are contiguous.

  • Hi Omer, 

    Am using the standard linker command file. The files are from an existing project and all am trying to do is add extra variables.

    Am having trampolining issues if i follow the advice you've given or memory overlap

    Is it okay for me to attach a zipped file please as i think we've gone full circle and not sorted the problem?

    Kind regards

    Edwin 

  • Hi Edwin,

    You can try, but if there are other build errors outside of this error you initially mentioned then I will not be able to help much further.

  • Hi Omer, 

    There no other build errors. Everything is running fine. It has been until i try and switch from using using RAMGS to FLASH for .ebss

    3583.NG_Initial_V2.7_FLASH_Master.zip

  • Hi Omer, 

    Please have a look at the attached file. I noticed a mistake with FLASHI but still having trampolining issues

    8171.NG_Initial_V2.7_FLASH_Master.zip

    Kind regards

    Edwin

  • Hello Edwin,

    I fixed some build errors I got on my side and replaced your linker command file with one from the empty_driverlib_project example in C2000Ware for F2837xD and managed to see the memory allocation issues:

    It looks like your stack and and .ebss (global variables) section cannot be given enough memory. Why do you have 56K worth of global variables? These may need to be allocated to Flash instead (using a "#pragma DATA_SECTION" pre-processor instruction). What are you allocating to the stack at runtime from the boot file that needs to be present? There's no reason that the stack should be having this issue, you may need to re-examine how much memory you're using with this project, this is not something I can necessarily judge from my side, although the error is a valid issue being pointed out here.

  • Thanks Omer.

    Will stick to RAMGS and maximise its capability with my situation.

    Am not the original author therefore i can't comment on why there are soo many global variables.

    Thanks for your help.

    Kind regards

    Edwin