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.

SDRAM DSK 6713

Hi,

I have a problem with the declaration of the tables in SDRAM.

In my project is more than a dozen files

My  Linker command file for 6713 DSP is

-heap  0x400

-stack 0x400 /* very large stack for DSP programs. */

-lrts6700.lib /* floating point library */

MEMORY

{

    vecs:       o = 00000000h   l = 00000200h

    IRAM:       o = 00000200h   l = 0003FE00h                          

    CE0:        o = 80000000h             l = 01000000h

 }

SECTIONS

{

    "vectors"  >       vecs

    .cinit          >       IRAM

    .text           >       IRAM

    .stack         >       IRAM

    .bss             >       IRAM

    .const        >       IRAM

    .data          >       IRAM

    .far              >       IRAM

    .switch      >       IRAM

    .sysmem   >       IRAM

    .tables       >       IRAM

    .cio              >       IRAM

    "SDRAM"  >       CE0

}

 

In another file (Tables.h) I have declared arrays:

#pragma DATA_SECTION (Table_A, "CE0");

#pragma DATA_SECTION (Table_B, "CE0");

#pragma DATA_SECTION (Table_C, "CE0");

 

double Table_A[64] = {0};

double Table_B[512] = {0};

double Table_C[12][32] = {0};

 

Data from the audio codec also writes SDRAM

When I try to compile the project everything is OK, I have only a few warnings.

But when I run the project data stored in tables are overwritten, and I do not know why.

How should I declare the arrays so that the incoming data, for example, the audio codec did not change their contents

 

Jarek

  • Jarosław Wojtuń said:
    #pragma DATA_SECTION (Table_A, "CE0");
    #pragma DATA_SECTION (Table_B, "CE0");
    #pragma DATA_SECTION (Table_C, "CE0");

    /* ... */

    MEMORY
    {
         CE0:        o = 80000000h             l = 01000000h
    }

    /* ... */

    SECTIONS
    {

        /* ... */

        "SDRAM"  >       CE0
    }

    Judging by this I am guessing you are getting some warnings with regards to an undefined section? I think you should set things up like this (changes in bold):

    #pragma DATA_SECTION (Table_A, ".extdata");
    #pragma DATA_SECTION (Table_B, ".extdata");
    #pragma DATA_SECTION (Table_C, ".extdata");

    /* ... */

    MEMORY
    {
         CE0:        o = 80000000h             l = 01000000h
    }

    /* ... */

    SECTIONS
    {

        /* ... */

        .extdata  >       CE0
    }
    I did not see anywhere an "SDRAM" code/data section was ever defined so I think you meant to place your Tables A, B and C into the CE0 memory via what I call the .extdata section. This should be one step in ensuring that these tables are located where you desire.

    Jarosław Wojtuń said:
    But when I run the project data stored in tables are overwritten, and I do not know why.
    How should I declare the arrays so that the incoming data, for example, the audio codec did not change their contents
    Without knowing more about your project I can only speculate, but this sounds like you may be using direct addressing via a pointer rather than a symbol name for data buffers? Perhaps your stack was located right next to these tables and the stack is overflowing? There could be a number of other things similar to this, so an easy test would be to relocate these tables to their own "island" so as to help ensure that nothing is overflowing.

    Also, make sure that none of your algorithms are overwriting the tables instead of a temp variable. I've been bitten by this myself before, so I know how easy it is to make that mistake!