AnsweredAssumed Answered

How to map program and data memory to the SDRAM?

Question asked by Afinko on Feb 11, 2010
Latest reply on Feb 11, 2010 by DeepV



I am trying to add program and data memory to the SDRAM on ADSP-21371 EZ-KIT Lite.
The problem is to correctly map the memory blocks in .LDF file.
Even if the program memory should be 48 bit, if the program memory is mapped to the SDRAM, it has to have the 16 or 32 bit width, according to the SDRAM width (16 or 32 bit), otherwise the VisualDSP (VDSP) will generate the error.
This is the part of my .LDF file:

    seg_SDco  { TYPE(PM RAM) START(0x00200000) END(0x00201000) WIDTH(32)}
    seg_ext     { TYPE(DM RAM) START(0x00203000) END(0x005FFFFF) WIDTH(32)}


The 128 Mbit, 32 bit width SDRAM is used in EZ-KIT.
The SDRAM is mapped to the Bank 0. So it should start at 0x00200000 and end at 0x005FFFFF.
If I use only the 32 bit data memory to allocate this space, I can access the whole space without problem, and there is no "mirroring" in the memory.
However, If I map to the SDRAM also program memory, as it is shown in my .LDF file (seg_SDco), the data memory and program memory are overlapping each other.
Even if the compiling in VDSP do not process any error, and the program can run normally.
If I allocate the whole data memory space (seg_ext) with zeros, it will zeros also my program memory (seg_SDco).


From the ADSP-21371 datasheet:
"If 48-bit instructions are placed in any such bank (with two instructions packed into three 32-bit locations), then care must be taken to map data buffers in the same bank. For example, if 2k instructions are placed starting at the bank 0 base address (0x0020 0000), then the data buffers can be placed starting at an address that is offset by 3k words (0x0020 0C00)."


The problem is, that in this case, the seg_SDco is physically not at the place 0x00200000 - 0x00201000 (or 0x00200000 - 0x00201800, because of 48 bit instead of 32), but it appear in 0x00300000 - 0x00301800.
I am attaching the simple project for testing where is the program memory mapped in SDRAM physically. Firstly you need to clear the whole SDRAM, then rebuild the program and find where in SDRAM the program is saved.


I also found, that if I want to add the program memory in SDRAM at position 0x00200000 - 0x00201000(0x00201800), I need to make .LDF file like this:


    seg_SDco  { TYPE(PM RAM) START(0x006AAAAB) END(0x006ACAAA) WIDTH(32)}
    seg_ext      { TYPE(DM RAM) START(0x00203000) END(0x005FFFFF) WIDTH(32)}


The seg_SDco is "out of the SDRAM space", but this is the only one way (that I fount till now) to map program memory in space 0x00200000 - 0x00201000, and  still use the whole 0x00203000 - 0x005FFFFF data memory space.
The 0x006AAAAB - 0x006ACAAA is the mirror of the space 0x002AAAAB - 0x002ACAAA. However, I cannot add 0x002AAAAB - 0x002ACAAA directly to the .LDF file, because the VDSP will generate the overlap error.


If I add the program memory into the SDRAM, the addresses in "Disassembly window" in VDSP do not match with addresses in "Data(DM) Memory window" in VDSP.
It is probably caused by the 48 bit program memory allocated in 32 bit SDRAM memory.


Why the program memory 0x002AAAAB in .LDF file physically start in 0x00200000?
Is there any way how to compute it, instead of the testing and matching the correct starting place?
Am I doing something wrong?


I checked also the ADSP-21371-proc.xml in C:\Program Files\Analog Devices\VisualDSP 5.0\System\ArchDef\, if the SDRAM is configured correctly. I used even my configuration, but it doesn't help.


Thank you very much for any help.
Best regards,