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.

C6713- Configuring SDRAM

Expert 2370 points
Other Parts Discussed in Thread: ADS7881

Hi,

I am using a simple DSP/BIOS program to sample analog signal using ADS7881. I need to save over 1 Million data points to analyze them but there are not much space in IRAM to save all the points.

My DSK board has 16MB of SDRAM so I want to use that memory to save all the points and then move to TEXT file.

I don't know to configure SDRAM using DSP/BIOS.

Can any one please help me who to do it.

I would appreciate your help.

Thanks.

  • A resource to use is the Board Support Library available from Spectrum Digital's support site for the DSK to get information on configuring the SDRAM interface.

    DSP/BIOS itself would not configure the processor external memory interface, but some setup code would be needed.  Again, there should be resources in the BSL to help do this.

    http://c6000.spectrumdigital.com/dsk6713/

     

  • Hi Brandon,

    Thanks for your reply.

    I used DSP/BIOS Memory Management to add SDRAM. You can follow the steps in the snapshot given below.

    http://i53.tinypic.com/jhahee.jpg

    Every thing is same as I followed while setting SDRAM except the Data Section (.data) under Compiler Sections TAB, mistakenly it is showing SDRAM but actually it is IRAM.

    When I build the project, I am getting the following warning.

    warning: creating output section SDRAM without SECTIONS specification

    This is how I defined my buffer to save large amount of data.

    #define ST_SZ 102400;

    float data_stats[ST_SZ];

    #pragma DATA_SECTION(data_stats,"SDRAM")

    Program runs pretty fine though with the above warning but it doesn't exit after writing all the data points from DATA_STATS buffer to .TEXT file. When I halt the program forcely I see the pointer at momory section: RTDX_Final_RT_Monitor. You can see this in the last picture of the snapshot.

    for(j=0; j<ST_SZ; j++)

               {
                          fprintf(fp, "%f\n", data_stats[j] );
                }

    fclose(fp);
    exit(1);

    But when the size of DATA_STATS is smaller to be fit in IRAM it exits fine.

    Whats wrong here ? Am I defining the SDRAM in the right way or should there be any changing in the setting which I showed you before ?

    I appreciate your help.

     

     

     

     

  • When the DSP/BIOS configuration tool generates the appropriate files which need to be included in your project, does the resultant linker command file have a SECTION declared SDRAM?

  • You can see my cmd file here. Only MEMORY section define SDRAM otherwise I don't see any SECTION saying any thing about SDRAM. I think thats the problem I am still getting warning.

    /* INPUT ADS7881.cdb */

    /* MODULE PARAMETERS */
    GBL_USERINITFXN = _FXN_F_nop;

    MEM_SEGZERO = IRAM;
    MEM_MALLOCSEG = IRAM;

    CLK_TIMEFXN = CLK_F_getshtime;
    CLK_HOOKFXN = HWI_F_dispatch;

    PRD_THOOKFXN = _KNL_tick;

    RTDX_DATAMEMSEG = IRAM;

    HST_DSMBUFSEG = IRAM;

    SWI_EHOOKFXN = GBL_NULL;
    SWI_IHOOKFXN = GBL_NULL;
    SWI_EXECFXN = SWI_F_iexec;
    SWI_RUNFXN = SWI_F_run;

    TSK_STACKSEG = MEM_NULL;
    TSK_VCREATEFXN = _FXN_F_nop;
    TSK_VDELETEFXN = _FXN_F_nop;
    TSK_VEXITFXN = _FXN_F_nop;

    IDL_CALIBRFXN = IDL_F_stub;

    SYS_ABORTFXN = _UTL_doAbort;
    SYS_ERRORFXN = _UTL_doError;
    SYS_EXITFXN = _UTL_halt;
    SYS_PUTCFXN = _UTL_doPutc;

    GIO_CREATEFXN = _FXN_F_nop;
    GIO_DELETEFXN = _FXN_F_nop;
    GIO_PENDFXN = _FXN_F_nop;
    GIO_POSTFXN = _FXN_F_nop;

    /* OBJECT ALIASES */
    _IRAM = IRAM;
    _SDRAM = SDRAM;
    _PRD_clock = PRD_clock;
    _RTA_fromHost = RTA_fromHost;
    _RTA_toHost = RTA_toHost;
    _HWI_RESET = HWI_RESET;
    _HWI_NMI = HWI_NMI;
    _HWI_RESERVED0 = HWI_RESERVED0;
    _HWI_RESERVED1 = HWI_RESERVED1;
    _HWI_INT4 = HWI_INT4;
    _HWI_INT5 = HWI_INT5;
    _HWI_INT6 = HWI_INT6;
    _HWI_INT7 = HWI_INT7;
    _HWI_INT8 = HWI_INT8;
    _HWI_INT9 = HWI_INT9;
    _HWI_INT10 = HWI_INT10;
    _HWI_INT11 = HWI_INT11;
    _HWI_INT12 = HWI_INT12;
    _HWI_INT13 = HWI_INT13;
    _HWI_INT14 = HWI_INT14;
    _HWI_INT15 = HWI_INT15;
    _KNL_swi = KNL_swi;
    _TSK_idle = TSK_idle;
    _LNK_dataPump = LNK_dataPump;
    _RTA_dispatcher = RTA_dispatcher;
    _IDL_cpuLoad = IDL_cpuLoad;
    _LOG_system = LOG_system;
    _IDL_busyObj = IDL_busyObj;

    /* MODULE GBL */

    SECTIONS {
       .vers (COPY): {} /* version information */
    }

    -priority
    -llnkrtdx.a62
    -ldrivers.a67          /* device drivers support */
    -lsioboth.a62          /* supports both SIO models */
    -lbiosi.a62            /* DSP/BIOS support */
    -lrtdx.lib             /* RTDX support */
    -lcsl6713.lib
    -lrts6700.lib          /* C and C++ run-time library support */

    _GBL_CACHE = GBL_CACHE;

    /* MODULE MEM */
    -stack 0x400
    MEMORY {
       IRAM        : origin = 0x0,         len = 0x40000
       SDRAM       : origin = 0x80000000,  len = 0x1000000
    }
    /* MODULE CLK */
    SECTIONS {
       .clk: {
            _CLK_start = _CLK_start6x;
            CLK_F_gethtime = CLK_F_getshtime;
            CLK_A_TABBEG = .;
            *(.clk)
            CLK_A_TABEND = .;
            CLK_A_TABLEN = (. - CLK_A_TABBEG) / 1;
       } > IRAM
    }
    _CLK_PRD = CLK_PRD;
    _CLK_COUNTSPMS = CLK_COUNTSPMS;
    _CLK_REGS = CLK_REGS;
    _CLK_USETIMER = CLK_USETIMER;
    _CLK_TIMERNUM = CLK_TIMERNUM;
    _CLK_TDDR = CLK_TDDR;

    /* MODULE PRD */
    SECTIONS {
       .prd: {
            PRD_A_TABBEG = .;
            /* no PRD objects */
            PRD_A_TABEND = .;
            PRD_A_TABLEN = (. - PRD_A_TABBEG) / 32;
       } > IRAM
    }

    /* MODULE RTDX */
    _RTDX_interrupt_mask = 0x0;

    /* MODULE HWI */
    SECTIONS {
        .hwi_vec: 0x0 {
            HWI_A_VECS = .;
            *(.hwi_vec)
        }
    }

    /* MODULE SWI */
    SECTIONS {
       .swi: {
            SWI_A_TABBEG = .;
            *(.swi)
            SWI_A_TABEND = .;
            SWI_A_TABLEN = (. - SWI_A_TABBEG) / 44;
       } > IRAM
    }

    /* MODULE IDL */
    SECTIONS {
       .idl: {
            IDL_A_TABBEG = .;
            *(.idl)
            IDL_A_TABEND = .;
            IDL_A_TABLEN = (. - IDL_A_TABBEG) / 8;
            IDL_A_CALBEG = .;
            *(.idlcal)
            IDL_A_CALEND = .;
            IDL_A_CALLEN = (. - IDL_A_CALBEG) / 8;
       } > IRAM
    }



    SECTIONS {
            .bss:     {} > IRAM
           
            .far:     {} > IRAM
           
            .sysdata: {} > IRAM
           
            .mem:       {} > IRAM
           
            .sysinit:    {} > IRAM
           
            .sysregs: {} > IRAM
           
            .gblinit:    {} > IRAM
           
            .trcdata:    {} > IRAM
           
            .args: fill=0 {
                *(.args)
                . += 0x4;
            } > IRAM
           
            .cinit:    {} > IRAM
           
            .pinit:   {} > IRAM
           
            .data:    {} > IRAM
           
            .const:    {} > IRAM
           
            .switch:    {} > IRAM
           
            .cio:     {} > IRAM
           
            .text:    {} > IRAM
           
            frt:    {} > IRAM
           
            .bios:    {} > IRAM
           
            .stack: fill=0xc0ffee {
                GBL_stackbeg = .;
                *(.stack)
                GBL_stackend = GBL_stackbeg + 0x400 - 1;
                _HWI_STKBOTTOM = GBL_stackbeg + 0x400 - 4 & ~7;
                _HWI_STKTOP = GBL_stackbeg;
            } > IRAM
           
            .trace: fill = 0x0 {
               _SYS_PUTCBEG = .;
               . += 0x200;
               _SYS_PUTCEND = . - 1;
            } > IRAM
           
            .rtdx_data: {}  > IRAM
           
            .rtdx_text: {}  > IRAM
           
            .hst: {
                 HST_A_TABBEG = .;
                _HST_A_TABBEG = .;
                *(.hst)
                HST_A_TABEND = .;
                _HST_A_TABEND = .;
                 HST_A_TABLEN = (. - _HST_A_TABBEG) / 20;
                _HST_A_TABLEN = (. - _HST_A_TABBEG) / 20;
            } > IRAM
           
            .dsm: {} > IRAM
           
           /* RTA_fromHost buffer */
           .hst1: align = 0x4 {} > IRAM
           
           /* RTA_toHost buffer */
           .hst0: align = 0x4 {} > IRAM
           
            .hwi: {}  > IRAM
           
            .tsk: {
                *(.tsk)
            } > IRAM
           
            .TSK_idle$stk: {
                *(.TSK_idle$stk)
            } > IRAM
           
            .log: {
                 LOG_A_TABBEG = .;
                _LOG_A_TABBEG = .;
                *(.log)
                LOG_A_TABEND = .;
                _LOG_A_TABEND = .;
                 LOG_A_TABLEN = (. - _LOG_A_TABBEG) / 24;
                _LOG_A_TABLEN = (. - _LOG_A_TABBEG) / 24;
            } > IRAM
           
            .printf (COPY): {} > IRAM
           
            /* LOG_system buffer */
            .LOG_system$buf: align = 0x100 fill = 0xffffffff {} > IRAM
           
            .pip: {
                 PIP_A_TABBEG = .;
                _PIP_A_TABBEG = .;
                *(.pip)
                PIP_A_TABEND = .;
                _PIP_A_TABEND = .;
                 PIP_A_TABLEN = (. - _PIP_A_TABBEG) / 100;
                _PIP_A_TABLEN = (. - _PIP_A_TABBEG) / 100;
            } > IRAM
           
            .sts: {
                 STS_A_TABBEG = .;
                _STS_A_TABBEG = .;
                *(.sts)
                STS_A_TABEND = .;
                _STS_A_TABEND = .;
                 STS_A_TABLEN = (. - _STS_A_TABBEG) / 16;
                _STS_A_TABLEN = (. - _STS_A_TABBEG) / 16;
            } > IRAM
           
            .sys:     {} > IRAM
           
            .gio:     {} > IRAM
           
            .IRAM$heap: {
                IRAM$B = .;
                _IRAM_base = .;
                IRAM$L = 0x8000;
                _IRAM_length = 0x8000;
                . += 0x8000;
            } > IRAM
           
    }

     

    How to solve this problem ?

  • I wonder if you have a namespace collision going on here.  Not sure, but something to check.  What I mean by that is you have defined a MEMORY in DSP/BIOS called SDRAM which is found in the highlighted MEMORY section of the linker command file.

    But you have also defined section called SDRAM as well in the C code and DSP/BIOS.

    As a quick test, would you change one of those to be unique.  It might be easiest to change the MEMORY one since I think you only need to modify one location in the DSP/BIOS configuration.

    Again, I don't know if this is the cause, but you should rule it out.

    Also, what version of DSP/BIOS and Code Composer Studio are you using?

  • Hi,

    The only problem I am having is that .cmd file doesn't define SECTION for SDRAM, I tried with SDRAM2 or some other name but still the same warning.

    #pragma DATA_SECTION(data_stats,".SDRAM2") ---- > I am using this line just to define data_stats buffer into SDRAM2 memory address range.

    I am using CCS Version: 3.1.0 and BIOS Version: cuda-4.90.02.10 and Code Generation Tools Version: 5.1.0

    However, I added SDRAM as SRAM_EXT into Memory Section Manager and added another .cmd file as ERAM.cmd and defined SECTION EXTRAM for SRAM_EXT as given below:

    SECTIONS
    {
      .EXTRAM  :> SRAM_EXT
    }

    DSP/BIOS doesn't allow to modify .cmd file thats why I added another .cmd file to define SECTION and I think its working, I am not getting any warnings. Is it ok to do this way ?

    One problem is that my program doesn't exit after writing data to .text file. When the buffer size is smaller it is working fine but as I increase the size of buffer, program doesn't exit. What I halt the program, it shows cursor at RTDX_Final_RT_Monitor.

    What wrong here ?

  • Yes, it is okay to add the additional linker command file into the project to define the SECTIONS and MEMORY definitions.

    I would suggest opening a different thread on the other issue.

  • Thanks Brandon.