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.

Defining Memory in External Memory



I am using the simulator/debugger to run some of tests of my software. To do this I create a driver that contains arrays of data used to initialize the inputs and arrays of data that contain the expected values for the outputs. This driver is compiled and linked with libraries to create an executable. Through the use of some scripts the simulator/debugger is executed and the test is run. I have been able to do this in the past with no problems. However, when the test data I now have (55 inputs/outputs which get converted into 55 arrays with 28000 elements) the code for the driver gets extremely large.

Within the scripts that run the executable I have the following commands to load the executable into the simulator/debugger:

    /* Create debug environment */
        Env = ScriptingEnvironment.instance();
    /* Create script server object and set the configuration */
        Server = Env.getServer("DebugServer.1");
        Server.setConfig(Path + "tms320f283xx_sim.ccxml");
    /* Open the debug session */
        Session = Server.openSession(".*");
    /* Connect to target */
        Session.target.connect();
    /* Open the session so we can start the tests */
        Session = Server.openSession();
    /* Load the test */
        Session.memory.loadProgram("C:/Test/rbt_test.out");

My original .cmd file looked as follows:

    MEMORY
    {
        PAGE 0:     /* Flash */
            /* FPGA Flash (128KB) */
            MEDL : origin = 0x180000, length = 0x000800  /* MEDL Table */
            TASM : origin = 0x180800, length = 0x001000  /* TASM */
            HWCC : origin = 0x181800, length = 0x003000  /* HW-COM Configuration */
            /* Internal Flash (512KB) */
            IMGH     : origin = 0x300000, length = 0x000010  /* Processor Flash for Prime Image Header. */
            INTFLASH : origin = 0x300010, length = 0x070000  /* Processor Flash for Prime Image. */
            CSMD     : origin = 0x370010, length = 0x000076  /* CSM Data, zero when using CSM. */
            BTFEP    : origin = 0x370086, length = 0x000002  /* Boot-to-Flash Entry Point. */
            CSMPW    : origin = 0x370088, length = 0x000008  /* CSM Password, do not zero. */
            BROM     : origin = 0x3FE000, length = 0x001FC0  /* Boot ROM. */
            BVEC     : origin = 0x3FFFC0, length = 0x000040  /* Boot Interrupt Vector. */
       
        PAGE 1:     /* RAM */  
            INTDATA1 : origin = 0x000000, length = 0x000800 /* Processor SARAM [M0-M1] */
            STACK    : origin = 0x008000, length = 0x001000 /* Processor SARAM [L0] */
            INTDATA2 : origin = 0x009000, length = 0x003000 /* Processor SARAM [L1-L3] */
            INTDATA3 : origin = 0x00C000, length = 0x004000 /* Processor SARAM [L4-L7] (DMA Accessible) */
            EXTDATA  : origin = 0x200000, length = 0x100000 /* Processor External SRAM (CS7) */
    }
   
    SECTIONS
    {
        /* Image Header: */
          .ImageHeader    : > IMGH, PAGE = 0
        /* Data Initialization Table: */
           .cinit          : > INTFLASH, PAGE = 0
        /* Constants: */
           .const          : > INTFLASH, PAGE = 0
           .econst         : > INTFLASH, PAGE = 0
        /* INTFLASH-Resident Executable Code: */
           .text           : > INTFLASH, PAGE = 0
        /* Switch Statement Tables: */
           .switch         : > INTFLASH, PAGE = 0
        /* Unused Reset Pointer: */
           .reset          : > INTFLASH, PAGE = 0, TYPE = DSECT
        /* Stack: */
           .stack          : > STACK, PAGE = 1,
                               START(_SP_INIT),
                               SIZE(_STACK_SIZE),
                              END(_SP_END)
        /* Data by default resides in either Internal or External RAM: */
           .ebss           : >> INTDATA1 | INTDATA2 | INTDATA3 | EXTDATA, PAGE = 1
        /* DMA Accessible Data: */
           .dmadata        : > INTDATA3,  PAGE = 1
    }

With the new drivers the .cinit .ebss sections need to be increased, as shown by the following error messages:

    "TI.cmd", line 110: error #10099-D: run placement fails for object
       ".ebss", size 0x531c40 (page 1).  Available ranges:
       INTDATA1     size: 0x800        unused: 0x0          max hole: 0x0
       INTDATA2     size: 0x3000       unused: 0x0          max hole: 0x0
       INTDATA3     size: 0x4000       unused: 0x0          max hole: 0x0
       EXTDATA      size: 0x100000     unused: 0xfef6c      max hole: 0xfef48  
    "TI.cmd", line 88: error #10099-D: placement fails for object ".cinit",
       size 0x3b7b44 (page 0).  Available ranges:
       INTFLASH     size: 0x70000      unused: 0x379c3      max hole: 0x379c2  
    error #10010: errors encountered during linking;
       "rbt_test.out" not built

To me it looks as if I would need to define memory regions in the external memory area. But, I am not sure how to do this. From what I have read once I have my memory map defined I might need to use a .gel file to initialize the memory.

My problem is that I don't know if I need to define memory in external memory area. If so, how do I do that in the .cmd file. And how would I initialize it in the .gel file (in the F28335_Memory_Map function?).

Any assistance would be greatly appreciated!

Thanks,

Bill

  • Bill,

    Please take a look at this related post (specifically point 3) and hope it answers your questions. Let us know if you have any remaining questions.
    http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/259849/911213.aspx#911213

  • I will look at that and let you know how I make out.

     

    Thanks!

  •  I modified my .cmd file as follows with no luck:

      MEMORY
      {
      PAGE 0:     /* Flash */
          /* FPGA Flash (128KB) */
          TTPMEDL : origin = 0x180000, length = 0x000800  /* TTP MEDL Table */
          TTPTASM : origin = 0x180800, length = 0x001000  /* TTP TASM */
          TTPHWCC : origin = 0x181800, length = 0x003000  /* TTP HW-COM Configuration */
          /* Internal Flash (512KB) */
          IMGH     : origin = 0x300000, length = 0x000010  /* Processor Flash for Prime Image Header. */
          INTFLASH : origin = 0x300010, length = 0x070000  /* Processor Flash for Prime Image. */
          CSMD     : origin = 0x370010, length = 0x000076  /* CSM Data, zero when using CSM. */
          BTFEP    : origin = 0x370086, length = 0x000002  /* Boot-to-Flash Entry Point. */
          CSMPW    : origin = 0x370088, length = 0x000008  /* CSM Password, do not zero. */
          BROM     : origin = 0x7FE000, length = 0x001FC0  /* Boot ROM. */
          BVEC     : origin = 0x7FFFC0, length = 0x000040  /* Boot Interrupt Vector. */
          EXTFLASH : origin = 0x800000, length = 0x500000 
     
      PAGE 1:     /* RAM */  
          INTDATA1 : origin = 0x000000, length = 0x000800 /* Processor SARAM [M0-M1] */
          STACK    : origin = 0x008000, length = 0x001000 /* Processor SARAM [L0] */
          INTDATA2 : origin = 0x009000, length = 0x003000 /* Processor SARAM [L1-L3] */
          INTDATA3 : origin = 0x00C000, length = 0x004000 /* Processor SARAM [L4-L7] (DMA Accessible) */
          INTDATA4 : origin = 0x001000, length = 0x007000
          EXTDATA  : origin = 0xD00000, length = 0x600000
      }
     
      SECTIONS
      {
          /* Image Header: */
            .ImageHeader    : > IMGH, PAGE = 0
          /* Data Initialization Table: */
            .cinit          : > EXTFLASH, PAGE = 0
          /* Constants: */
            .const          : > INTFLASH, PAGE = 0
            .econst         : > INTFLASH, PAGE = 0
          /* INTFLASH-Resident Executable Code: */
            .text           : > INTFLASH, PAGE = 0
          /* Switch Statement Tables: */
            .switch         : > INTFLASH, PAGE = 0
          /* Unused Reset Pointer: */
            .reset          : > INTFLASH, PAGE = 0, TYPE = DSECT
          /* Stack: */
            .stack          : > STACK, PAGE = 1,
                                START(_SP_INIT),
                                SIZE(_STACK_SIZE),
                                END(_SP_END)
          /* Data by default resides in either Internal or External RAM: */
            .ebss           : >> INTDATA1 | INTDATA2 | INTDATA3 | EXTDATA, PAGE = 1
          /* DMA Accessible Data: */
            .dmadata        : > INTDATA3,  PAGE = 1
      }

    I also use a .gel file to try to initialize memory and activate external memory.

    I modified the f28335.gel as follows:

      OnReset(int nErrorCode)
      {
        C28x_Mode();
        Unlock_CSM();
        ADC_Cal();
        XINTF_Enable();
        F28335_Memory_Map();
      }

      OnTargetConnect()
      {
        C28x_Mode();
        F28335_Memory_Map();            /* Initialize the CCS memory map */
       
        /* Check to see if CCS has been started-up with the DSP already */
        /* running in real-time mode.  The user can add whatever        */
        /* custom initialization stuff they want to each case.          */
        if (GEL_IsInRealtimeMode())     /* Do real-time mode target initialization */
        {
        }
        else                            /* Do stop-mode target initialization */
        {
          GEL_Reset();                /* Reset DSP */
        }
      }
     
      hotmenu F28335_Memory_Map()
      {
        GEL_MapReset();
        GEL_MapOn();
        GEL_MapDelete(0x00000000, 0);
        GEL_MapDelete(0x00000000, 1);
       
        /* Program memory map */
        GEL_MapAdd(0x000000,0,0x000800,1,1);             /* INTDATA1 : Processor SARAM [M0-M1]                  */
        GEL_MapAdd(0x800,0,0x800,1,1);
        GEL_MapAdd(0x001000,0,0x007000,1,1);
        GEL_MapAdd(0x008000,0,0x001000,1,1);             /* STACK    : Processor SARAM [L0]                     */
        GEL_MapAdd(0x009000,0,0x003000,1,1);             /* INTDATA2 : Processor SARAM [L1-L3]                  */
        GEL_MapAdd(0x00C000,0,0x004000,1,1);             /* INTDATA3 : Processor SARAM [L4-L7] (DMA Accessible) */
        GEL_MapAdd(0x10000,0,0x20000,1,1);
      //    GEL_MapAdd(0x800000,0,0x400000,1,1);             /* EXTFLASH  : Processor External SRAM (CS7)            */
      //    GEL_MapAddStr(0x800000,0,0x400000,"EX",0);
        GEL_MapAdd(0x300000,0,0x000010,1,1);             /* IMGH     : Processor Flash for Prime Image Header.  */
        GEL_MapAdd(0x300010,0,0x070000,1,1);             /* INTFLASH : Processor Flash for Prime Image.         */
        GEL_MapAddStr(0x300010,0,0x070000,"RAM",0);
        GEL_MapAdd(0x370010,0,0x000076,1,1);             /* CSMD     : CSM Data, zero when using CSM.           */
        GEL_MapAdd(0x370086,0,0x000002,1,1);             /* BTFEP    : Boot-to-Flash Entry Point.               */
        GEL_MapAdd(0x370088,0,0x000008,1,1);             /* CSMPW    : CSM Password, do not zero.               */
       
        /* Data memory map */
        GEL_MapAdd(0x000000,1,0x000800,1,1);             /* INTDATA1 : Processor SARAM [M0-M1]                  */
        GEL_MapAdd(0x008000,1,0x001000,1,1);             /* STACK    : Processor SARAM [L0]                     */
        GEL_MapAdd(0x009000,1,0x003000,1,1);             /* INTDATA2 : Processor SARAM [L1-L3]                  */
        GEL_MapAdd(0x00C000,1,0x004000,1,1);             /* INTDATA3 : Processor SARAM [L4-L7] (DMA Accessible) */
        GEL_MapAdd(0x300000,1,0x000010,1,1);             /* IMGH     : Processor Flash for Prime Image Header.  */
        GEL_MapAdd(0x300010,1,0x070000,1,1);             /* INTFLASH : Processor Flash for Prime Image.         */
        GEL_MapAdd(0x370010,1,0x000076,1,1);             /* CSMD     : CSM Data, zero when using CSM.           */
        GEL_MapAdd(0x370086,1,0x000002,1,1);             /* BTFEP    : Boot-to-Flash Entry Point.               */
        GEL_MapAdd(0x370088,1,0x000008,1,1);             /* CSMPW    : CSM Password, do not zero.               */
        GEL_MapAdd(0x800,1,0x800,1,1);
        GEL_MapAdd(0x001000,1,0x007000,1,1);
       
        GEL_MapAdd(0xD00000,1,0x600000,1,1);             /* EXTDATA  : Processor External SRAM (CS7)            */
        GEL_MapAddStr(0xD00000,1,0x600000,"EX",0);
      }

    This allows me to compile, link, and start execution in the simulator/debugger. However, I notice that the my data is not initialized. And when I try to open a file for output the program crashes since memory has not been properly initialized.

    As can be seen very large chunks of memory are needed. And this seems to be the problem. I am trying to place the .cinit on page 0 into an area that is out of range for program memory.

  • Are you using the F283x simulator in CCS or actual hardware to load and debug your code? If you are using the simulator this will not work. If you are using a target board, is it a TI development board or your own custom board?

  • I am using the F283x simulator in CSS.

    So, there is no way around this?

  • As far as I know the simulator does not model the external memory interface. You would either need a target board or would need to reduce the size of your .ebss section such that it fits within the available internal memory regions, RAM or FLASH. Note that you can can combine adjacent memory ranges within the linker command file, however I still think the size of your section will be too large to fit into any of the available ranges.

  • Thanks for your help!

    Bill