This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Allocating PSRAM to a module with medium memory model

Hi,
We are using XC164CS architecture which has 2K-DPRAM, 2K-SRAM and 2K-PSRAM.
The address ranges are:
We have project memory model set as Medium. We would like to allocate PSRAM to some modules ( C files ) and rest of the modules ( C files ) working with DPRAM and SRAM.
To allocate PSRAM to a module we use renameclass as follows:
#pragma RENAMECLASS (NDATA = FDATA)
where the FDATA refers to PSRAM location.
Our questions in this above assumptions are as follows:
1. Will this renameclass definition is sufficient to allocate all RAM variables in that module into PSRAM.
2. Do we need to assign the module to use the PSRAM as LARGE and rest of them as MEDIUM. If so the compiler does not allow me to do that. The compiler allows to change only small to large and not medium to large. I can't understand why it is so?
3. We dont want to add all variable to use the PSRAM to say FAR in it which will increase the complexity of the coding and review processes.
If anyone experienced the same kind of issue and found a solution, request you to please share me the suggestions for the same.
Thanks,
John

  • This is what I believe to be true but realize this information may not be the best way either. From what I know you can only assign DDP's to the NDATA or NCONST classes and they must be contiguous (using the DPPUSE directive) as there is no possibility of paged DPP's (or at least I can't figure it out). This is where I would prefer to have a choice for the possibility of three NDATA types (to individually assign DPP's "paged") and assignment of the User Stack to any of them (realizing DPP3 is never changed and fixed at starting address 0xC000). Then you could have DPP3 used for the existing NDATA class and allow two new NDATA classes, one for PSRAM (0xE00000) and another for peripherals (0x200000) as examples. This still leaves at least one DPPx to be used for 16K of NCONST data. Now all the data with in single chip mode could be accessed via DPP's.

    Ok so given that under the L166 Misc tab select use linker control file and add the following as an example.

    CLASSES (ICODE (0xC00000-0xC1FFFF), NCODE (0xC00000-0xC0FFFF),
    FCONST (0xC00000-0xC1FFFF), HCONST (0xC00000-0xC1FFFF),
    XCONST (0xC00000-0xC1FFFF), NCONST (0xC04000-0xC0BFFF),
    NDATA (0xE00000-0xE007FF), NDATA0 (0xE00000-0xE007FF),
    SDATA (0xC000-0xC7FF, 0xF600-0xFDFF), SDATA0 (0xC000-0xC7FF, 0xF600-0xFDFF),
    IDATA (0xF600-0xFDFF), IDATA0 (0xF600-0xFDFF),
    FDATA (0xC000-0xCFFF, 0xF600-0xFDFF, 0xE00000-0xE007FF), FDATA0 (0xC000-0xC7FF, 0xF600-0xFDFF, 0xE00000-0xE007FF),
    HDATA (0xC000-0xCFFF, 0xF600-0xFDFF, 0xE00000-0xE007FF), HDATA0 (0xC000-0xC7FF, 0xF600-0xFDFF, 0xE00000-0xE007FF),
    XDATA (0xC000-0xCFFF, 0xF600-0xFDFF, 0xE00000-0xE007FF), XDATA0 (0xC000-0xC7FF, 0xF600-0xFDFF, 0xE00000-0xE007FF))
    DPPUSE (0=NDATA(0xE00000 - 0xE03FFF), 1=NCONST(0xC04000 - 0xC0BFFF))
    CINITTAB (0xC00000-0xC1FFFF)

    The "near" data is now 0xE00000 to 0xE007FF. Be sure to follow the instructions to use the "USERSTACKDPP3" compiler directive if you want to keep the user stack in DSRAM or DPRAM. Then you have to use the keywords "idata" or "sdata" to allocate the RAM variables in the DPP3 space. This will allow you DPP access to all RAM variables (internal RAM memory at least) and up to 32K of NCONST data.

    I also assume you know the access time to the PSRAM is not single cycle. Whereas the access times to DPRAM and DSRAM is single cycle (0 Wait State).

    Hope this helps,
    -Chris