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.

F28335 Program will not fit into memory error

Hi all,

I am using the TMS320F28335 Delfino Experimental kit.

I have 7,  float32 arrays each of size 400, my program works fine.

In the next step I want to implement additional ADC sampling. As a result, I double the array to a total of 14 and build it. That gave a memory and linking error.

The controller I am using has 34K RAM, if my calculation are right  (400*32*14)/8192= 21.8 KB RAM is used by the arrays. I don't understand how I am using more memory than available. 

I also tried, reducing all array size to 200 each. That will occupy 10.93 KB of RAM,  with 14 arrays,  still there was memory error.

The other thing I noticed that the memory error points to the line below:

.text            : > RAML1,     PAGE = 0

Upon searching for the compiler section on TI wiki, .text file, I read that it is related to constant and executable code. I tried commenting all variable I had declared. But still got memory error.

My question is, how can I access different section of the RAM separably as I feel I am not able to access the complete RAM memory ? Is there other setting that I might have missed?

Earlier modification I had done was, to  merge different section of the RAM as a single block (RAML4L6    : origin = 0x00C000, length = 0x003000 ) of the memory and all the other modification to  fit all my 7 arrays of 400 size. And the code work fine.

Thanks in advance.

Pankaj Kadam

  • Hello Pankaj,

    How about you try to combine two RAMs?

    For example:

    .text            : > RAML0|RAML1,     PAGE = 0

     

    Best regards,

    Maria

  • Dear Maria,

    Thanks for your suggestion. After combining the two RAM it still gave the memory error. But when I split the .text into the two RAM it worked. I used the line below.  I am not understanding how combining the two RAM did not worked but splitting the file worked?

    .text            : >> RAML0|RAML1,     PAGE = 0

    The error has now moved to the .ebss

     .ebss            : > RAML4L6,     PAGE = 1 

    Over here I am combining RAM4, RAM5, RAM6 of PAGE 1, From the TI wiki .ebss handles Global and static variables. In my program I can't remove any of the Global variables I have declared.

    Is there a fixed memory size allotted to Global variables even if more memory is available? As I have already merged the three RAM. I also tried merging RAM7 with the others and tried splitting it across the four RAM. But nothing worked.

    I still feel I am not utilizing all of the RAM, is there a way to check the actual RAM utilization, similar to PC, Task Manager or on mobile phone?

    Pankaj 

  • Hi Pankaj,

    still feel I am not utilizing all of the RAM, is there a way to check the actual RAM utilization, similar to PC, Task Manager or on mobile phone?

    Not as interactive as the above devices but you can surely check the generated .map file for memory usage details.

    Regards,

    Gautam

  • Dear Gautam,

    Thank you for your suggestion, .map is good enough for me to check used/available memory. I checked it and it work well in my previous code for smaller array size .

    As currently I am working with larger and multiple arrays, along with memory error,  the .map is not updated with proper results as I am not able to compile the code.

    I am planning to save few array in the flash instead of the RAM to accommodate my larger program. Can you point me in the right direction? Do I have to boot from Flash for this setup?

    In the TI wiki (http://processors.wiki.ti.com/index.php/C28x_Compiler_-_Understanding_Linking), the .cinit, handles initialized global and static variables and has a link location in Flash. How can I link the arrays I want in flash to point through .cinit?

    Best Regards,

    Pankaj

  •  Do I have to boot from Flash for this setup?


    Yes, booting from flash would help you resolve this memory issue. Here's a doc that would make you understand how to achieve that:
     7510.Running from Internal Flash.pdf

    Regards,

    Gautam

  • Dear Gautam,

    I tried booting it from Flash, but the memory error still persists. 

    I have combined the RAM together as 

     RAML4L7     : origin = 0x00C000, length = 0x004000 

    but if I assign .ebss to one of the flash block the code compiles without error.

    .ebss : > FLASHB PAGE = 1

    As FLASHB is 0x008000 and RAML4L7  is 0x004000 

     FLASHB      : origin = 0x330000, length = 0x008000 

    Can you guide me how to assign the run-time critical arrays in RAM and the other arrays in Flash? As the slide below states(I got the slide from a different post).

    Best Regards,

    Pankaj

  • Heya Gautam,

    In the document, running from internal flash, they had discussed about "Running a Specific Constant Array from RAM "page 19. But the arrays I want to move to RAM are not constant. I still implemented the method with few changes. 

    I assigned .ebss to FLASHB, and then only moved arrays I want into RAM (all four RAM are merged, length 0x4000). I crossed checked if array space was properly allocated in RAM using the .map file, you mentioned. All was perfect, the project build without any errors, but when I hit Run the program doesn't run.

    I tried adding breakpoints (I was only able to add 2 breakpoints at a time, Is it one of the limitation of running from Flash?). In the ADC register the value obtained was -1.#QNAN (Not a number). 

    I feel that this error are due to the fact that I only moved arrays in RAM and not the other variable used to capture ADC values, etc.

    Is assigning .ebss(As it handles Global and Static Variable) to FLAHB wrong? 

    Is there other method to solve my problem, or my original problem of accommodating arrays of large size in the available RAM?

     

    Best Regards,

    Pankaj Kadam

  • Is assigning .ebss(As it handles Global and Static Variable) to FLAHB wrong?

    Yes, it is. It has to be RAM.

    Is there other method to solve my problem, or my original problem of accommodating arrays of large size in the available RAM?

    You can try, but I'm not sure as I'm unaware about your array size and dimension. Else what you can do is, instead of running the complete application from RAM:

    -> Run your main code from flash and just transfer the array part to your RAM and execute that section. Let me know how feasible this is.

    This doc might help you in achieving this: 2072.Flash to RAM.pdf

    Regards,

    Gautam

  • Dear Gautam,

    I overlooked that information about .ebss, that its always link to RAM as Flash was twice the size of the available RAM.

    At the moment, I want to have a total of 14 arrays of float32 size of 400 elements each. My code works fine with RAM boot, of 7 arrays of float32 size of 400 elements each. 

    The document link you attached, is for providing a boost in execution time by copying initialized compiler sections (.text, .cinit, .econst, .switch, etc.) from the Flash to RAM at run-time  Its not applicable to my problem as I am already crossing the limit of available RAM. 

    Can I merge part of RAM from PAGE 0 with PAGE 1? I did read that they need to be kept separate, PAGE 0:  Program Memory and PAGE 1 :  Data Memory. 

    As I am running out of other option, I guess I have to use an external RAM then?

    Best Regards,

    Pankaj 

  • Can I merge part of RAM from PAGE 0 with PAGE 1? I did read that they need to be kept separate, PAGE 0:  Program Memory and PAGE 1 :  Data Memory.

    Nope, as you've already answered your query above.

    As I am running out of other option, I guess I have to use an external RAM then?

    If the existing RAM memory is insufficient and using Flash is not helping you out; then I feel using an external RAM is the only option that is left!

    Regards,

    Gautam