AnsweredAssumed Answered

How to define and access a variable in paged ram?

Question asked by 赵子成 on Feb 20, 2018
Latest reply on May 14, 2018 by John Dammeyer

Hi all,

 

I have a problem. I need to define a variable lager than 4K, if I define as follow:

#pragma DATA_SEG PAGED_RAM
static char astLecuDataPagedRam[7360];
#pragma DATA_SEG DEFAULT

 

That leads to the complie error:Out of allocatin.

 

So I divided the variable into 2 halves as  follows:

#pragma DATA_SEG PAGED_RAM
static char astLecuDataPagedRam1[3680];
static char astLecuDataPagedRam2[3680];
#pragma DATA_SEG DEFAULT

 

Complie OK but access to astLecuDataPagedRam2 will lead to access to astLecuDataPagedRam1,which I use this code:

astLecuDataPagedRam2[1000] = 1;

But infact will lead to: astLecuDataPagedRam1[1000] = 1

 

My issue is :

1、How can I define a variable lager than 4K?

2、Why access to astLecuDataPagedRam2 will lead to access to astLecuDataPagedRam1?

 

The paged ram defined in prm file is as follow:

SEGMENTS

RAM_F0 = READ_WRITE DATA_FAR 0xF01000 TO 0xF01FFF;
RAM_F1 = READ_WRITE DATA_FAR 0xF11000 TO 0xF11FFF;
RAM_F2 = READ_WRITE DATA_FAR 0xF21000 TO 0xF21FFF;
RAM_F3 = READ_WRITE DATA_FAR 0xF31000 TO 0xF31FFF;
RAM_F4 = READ_WRITE DATA_FAR 0xF41000 TO 0xF41FFF;
RAM_F5 = READ_WRITE DATA_FAR 0xF51000 TO 0xF51FFF;
RAM_F6 = READ_WRITE DATA_FAR 0xF61000 TO 0xF61FFF;
RAM_F7 = READ_WRITE DATA_FAR 0xF71000 TO 0xF71FFF;

RAM_FC = READ_WRITE DATA_FAR 0xFC1000 TO 0xFC1FFF ALIGN 2[1:1]; /* is also mapped to XGATE: 0xC000..0xCFFF */
RAM_FD = READ_WRITE DATA_FAR 0xFD1000 TO 0xFD1FFF ALIGN 2[1:1]; /* is also mapped to XGATE: 0xD000..0xDFFF */

END

 

PLACEMENT 

PAGED_RAM INTO  RAM_FD, RAM_FC, RAM_F7, RAM_F6,RAM_F5, RAM_F4, RAM_F3, RAM_F2, RAM_F1, RAM_F0;

END

Outcomes