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.

Sections in SDRAM

Hi.

as I ran out of memory on the EVM5515 I plan to use some SDRAM at less critical points. I was thinking e.g. of the cinit section. Is it that way, that it will be used only at the startup to initialize variables or is it used also during normal operation (which would make the dsp slow)?

Any comments are welcome. Perhaps also a point to other possible sections.

Micky

  • Hi,

     

    First of all, you need to modify linker file like this:

    -stack 0x1000   /* PRIMARY STACK SIZE    */

    -sysstack 0x1000   /* SECONDARY STACK SIZE  */

    -heap       0x3F80   /* HEAP AREA SIZE        */  

     

    MEMORY

    {

        MMR     (RW) : origin = 0000000h length = 0000C0h /* MMRs */

        VEC     (RX) : origin = 00000C0h length = 000300h /* on-chip ROM vectors */

        DARAM   (RW) : origin = 0000400h length = 007A00h /* on-chip DARAM  */

        SARAM   (RW) : origin = 0008000h length = 01FE80h /* on-chip SARAM  */

    SDRAM (RW) : origin = 0050000h length = 100000h /* External  SDRAM  */

    NOR (RW) : origin = 0800000h length = 100000h /* External NOR */

    }

     

    SECTIONS

    {

        vectors     : > VEC    ALIGN = 256

        .text       : > SARAM  ALIGN = 4

        .stack      : > SARAM  ALIGN = 4

        .sysstack   : > SARAM  ALIGN = 4

        .data       : > SARAM

        .bss        : > SARAM, fill = 0

    .cinit : > SARAM

    .const : > SARAM

    .sysmem : > DARAM

    .cio     : > DARAM

    .switch     : > DARAM

    .buffer : > SDRAM  ALIGN = 4

    .nor_buffer : > NOR   ALIGN = 4

    }

     

    In the code, assign variable in  SDRAM space:

    #pragma DATA_SECTION(dmaSRCBuff_sdram, ".buffer")

    Uint32 dmaSRCBuff_sdram[CSL_DMA_BUFFER_SIZE];

     

    #pragma DATA_SECTION(dmaDESTBuff_sdram, ".buffer")

    Uint32 dmaDESTBuff_sdram[CSL_DMA_BUFFER_SIZE];

     

    Add EMIF SDRAM setup before use SDRAM memory area:

    //=====================================================================================

    /* EMIF SDRAM setup */

    //=====================================================================================

    *(ioport volatile unsigned *)0x1C02 &= 0xf7ff; // EMIF Clock on

    *(ioport volatile unsigned *)0x1C00 = 0x0100; // GPIO to I2S

    for(i=0;i<20000;i++);

    *(ioport volatile unsigned *)0x1C04 = 0x0400; // RESET_COUNT

    *(ioport volatile unsigned *)0x1C05 = 0x0002; // RESET_CONTRL

    for(i=0;i<20000;i++);

    *(ioport volatile unsigned *)0x1C33 = 0x0000; // EMIF_ACCESS

     

    *(ioport volatile unsigned *)0x1020 = 0x4710; // SDTIMR1

    *(ioport volatile unsigned *)0x1021 = 0x3911; // SDTIMR2

    *(ioport volatile unsigned *)0x100C = 0x061A; // SDRCR SDRAM Refresh Control Register

    *(ioport volatile unsigned *)0x1008 = 0x4720; // SDCR1

    *(ioport volatile unsigned *)0x1009 = 0x0001; // SDCR2

    *(ioport volatile unsigned *)0x1C1E = 0x0001; // CCR1 SD Clock ON/OFF

    //=====================================================================================

    Now you can use SDRAM memory.

    Regards,

    Hyun

     

  • Hi Hyun,

    thanks for your reply, but I think you misunderstood me. I know the things with the registers and linker File. But what I was thinking of:

    If I place cinit into SDRAM, I have to be aware, that SDRAM is a slow RAM compared to the internal ram. Anyway, if I init only my variables this might not cause any speed problem at all. So my question was: Am I right, that cinit section only refers to initializing variables during startup or can it be, that later on in the programm other variables would be initialized from SDRAM,too. This would speed down the whole programm, which I want to avoid. Or is cinit section something completely different?

  • Hi,

     

    I got you. There are two options you can select. It seems that you want to choose autoinitializing variables at load time. This case you need to use -cr linker option.

    The details are at section 4.4.5 in the TMS320C55x Optimizing C/C++ Compiler User's Guide.pdf (SPRU281E). http://focus.ti.com/lit/ug/spru281f/spru281f.pdf

    Also referring Table 4-1 is good for assigning your variables at the right sections.

    Regards,

    Hyun