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: How can I increase ram memory (.ebss memory error)

Part Number: TMS320F28379D

Hi everyone,

I have a code for DSP 320F28379D that needs high memory RAM on CPU 2 (high RAM memory is due to high size matrices (e.g. 60X60, 60X80 size matrices)). When I compile the code via CCS, I get the following error.

Lab_11_cpu2.cmd", line 46: error #10099-D: program will not fit into available memory. run placement with alignment/blocking fails for section ".ebss" size 0x4eb7 page 1. Available memory ranges:
RAMM0 size: 0x3b0 unused: 0x1b0 max hole: 0x1b0

As seen in the above error massege, there is a total of 3b0 bytes of RAMM0 memory, but the my code  needs approximately 0x4eb7 bytes. My Lab_11_cpu2.cmd section is below.

MEMORY
{
PAGE 0: /* Program Memory */
BEGIN_M0 : origin = 0x000000, length = 0x000002 /* Part of M0 RAM - used for "Boot to M0" bootloader mode */
RAMLS45 : origin = 0x00A000, length = 0x001000 /* L4-5 RAM, DCSM secure, CLA Program RAM */
BEGIN_FLASH : origin = 0x080000, length = 0x000002 /* Part of FLASH Sector A - used for "Jump to flash" bootloader mode */
FLASH_A : origin = 0x080002, length = 0x001FFE /* Part of FLASH Sector A - DCSM secure */
FLASH_BCDEFGHIJKLMN : origin = 0x082000, length = 0x03E000 /* FLASH Sectors B,C,D,E,F,G,H,I,J,K,L,M,N combined - DCSM secure */
RESET (R) : origin = 0x3FFFC0, length = 0x000002 /* Part of Boot ROM */

PAGE 1: /* Data Memory */
BOOT_RSVD : origin = 0x000002, length = 0x00004E /* Part of M0 RAM, BOOT rom will use this for stack */
RAMM0 : origin = 0x000050, length = 0x0003B0 /* M0 RAM */
RAMM1 : origin = 0x000400, length = 0x000400 /* M1 RAM */
CLA1_MSGRAMLOW : origin = 0x001480, length = 0x000080 /* CLA to CPU Message RAM, DCSM secure */
CLA1_MSGRAMHIGH : origin = 0x001500, length = 0x000080 /* CPU to CLA Message RAM, DCSM secure */
RAMLS0 : origin = 0x008000, length = 0x000800 /* L0 RAM, DCSM secure, CLA Data RAM */
RAMLS1 : origin = 0x008800, length = 0x000800 /* L1 RAM, DCSM secure, CLA Data RAM */
RAMLS2 : origin = 0x009000, length = 0x000800 /* L2 RAM, DCSM secure, CLA Data RAM */
RAMLS3 : origin = 0x009800, length = 0x000800 /* L3 RAM, DCSM secure, CLA Data RAM */
RAMD0 : origin = 0x00B000, length = 0x000800 /* D0 RAM, DCSM secure, ECC */
RAMD1 : origin = 0x00B800, length = 0x000800 /* D1 RAM, DCSM secure, ECC */
}

For soleving memory error, the RAM regions allocated for L0-L5, D0-D1 and GS0-GS15 were combined with RAMM0, but the code did not work.

I especially need to increase the RAM memory of .ebss. Can you help me on how to do it?

Thanks...

Best regards...

  • Hello Baris,

    To increase the memory allocated for the .ebss section you can do the following:

    .ebss            : >> RAMLS5 | RAMLS6

    You can continue to add " | RAMLS#" for as much RAM as the section needs as long as the RAM is on the same page. If you add as much RAM as possible and you still have this issue, you may have to store the data to Flash so that you can compile the project properly.

    Best regards,

    Omer Amir

  • Hi Omer,

    As you said, I added the section from LS0 to LS5 and other RAM sections, but as seen in the figure I added below,after this procedure, the values assigned to the variables on the expression screen are incorrect (All values are zero). For example, I define float w1=0.4, w2=0.3, w3=0.2, w4=0.1; but their values are very different in the expression window. This is also valid for other variables.

  • In addition, if I need, how can I sue flash like RAM?

  • Hello Baris,

    Are you defining their values outside the scope of a function or within some part of the main program? Are you using COFF or EABI output format in your project properties?

    In addition, if I need, how can I sue flash like RAM?

    To set up with Flash, simply right click on the project and go to Build Configurations > Set Active > and select one of the Flash options appropriate for you. Next, right-click on the RAM linker command file and select "Exclude from build" and then right-click on the Flash linker command file and unselect "Exclude form build". This should set your project to run from Flash.

    Best regards,

    Omer Amir

  • Hella Omer, 

    My section to define values is below. 

    #include "Lab.h" // Main include file
    #include "math.h"
    #include "IQmathLib.h"
    //#define _IQdiv(A,B) ((float)(A) / (float)(B))
    #define _IQ24div(A,B) ((float)(A) / (float)(B))
    
    int Vbat1, Vsc1, Ibat1, Isc1, Iyuk1; // Sensörlerden okunacak dijital veriler
    float Vbat2, Vsc2, Ibat2, Isc2, Iyuk2; // İşlenen sensör verileri
    int N=20, sayac, j, jj, Pbatref; // N: Tahmin bölgesi boyutu
    float gamae[60][1], gama[10][1], zref[80][1],h=0.000005, Energy_sc_f=10, Energy_bat_f; // h adım aralığı
    float A1, A2, oran;
    int donusturucu1=1, k, l, m, n, o, p, iii, uye1, uye2, uye3, uye3, uye_son;
    float T_anah, pulse, Pyuk, Preq, soc_bat, soc_sc;
    float Pbat, Psc;
    unsigned long int f_anah=10000, n1, N_dongu1;
    float Pbatmak=1100, SOCbatmak=0.9, SOCscmak=0.9, SOCscth=0.4;
    // MPC ön hazırlık parametre hesabı
    int a=1;
    float w1=0.4, w2=0.3, w3=0.2, w4=0.1;
    float E[80][80], F[80][1], GG[80][1], NM[60][80], zmin[60][1], zmak[60][1];

    In addition to this, I have some defining part in main kod as in below.

    while(1) // endless loop - wait for an interrupt
    {
    GpioDataRegs.GPATOGGLE.bit.GPIO26 = 1;
    // Ölçüm işlemi;
    Vbat1= (AdcaResultRegs.ADCRESULT0);
    Vsc1= (AdcaResultRegs.ADCRESULT2);
    Ibat1= (AdcaResultRegs.ADCRESULT3);
    Isc1= (AdcaResultRegs.ADCRESULT4);
    Iyuk1= (AdcaResultRegs.ADCRESULT5);
    
    // Ölçüm kalibrasyonu
    Vbat2= (Vbat1)*0.002102245*0.4;
    Vsc2= (Vsc1)*0.002102245*0.4;
    Ibat2= (Ibat1)*0.002102245*0.4;
    Isc2= (Isc1)*0.002102245*0.4;
    Iyuk2= (Iyuk1)*0.002102245*0.4;
    
    Pyuk=295;//Vbat2*Iyuk2;
    soc_bat=0.8;//Ibat2;
    soc_sc=1;//Isc2;

    Definitions both outside the main code and inside the values do not appear in the express window.

    Finally, I'm using COFF format.

  • Hello Baris,

    If you define the variables individually instead of inline, is there any change? I know I had trouble initializing global variables in a single line, but I don't remember if I used the same syntax/variable type.

    Try this:

    float w1=0.4;
    float w2=0.3;
    float w3=0.2;
    float w4=0.1;

    Best regards,

    Omer Amir

  • Dear Omer,

    Sorry it took me a while to reply. In fact, my RAM memory problem was partially solved with your previous response.

    My code has some big size matrix e.g. F[60][80], but with using this size, I receive the memory error message I mentioned before.

    I can solve this error with decreasing the matrix size. For example F[60][60]. In fact, this version of matrix is satisfactory. But in future studies, if I need big size matrix over than [60][60], how can I solve.

    Thanks...

  • Hello Baris,

    My code has some big size matrix e.g. F[60][80], but with using this size, I receive the memory error message I mentioned before.

    I assume you're talking about the program not fitting into the available memory. You can merge sections (there should be examples of this within the linker command file), but I don't think it's proper to split a 2D array across multiple memory units with how it gets accessed (I would need to double-check this if you need the array to be stored in RAM). Is there a reason you can't store the array on Flash instead?

    I can solve this error with decreasing the matrix size. For example F[60][60]. In fact, this version of matrix is satisfactory. But in future studies, if I need big size matrix over than [60][60], how can I solve.

    This is a limitation of the memory units allocated for the specific sections (with the same details as above).

    Best regards,

    Omer Amir