Using Paged RAM in XDP512

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Using Paged RAM in XDP512

4,014 Views
kp2309
Contributor I
Can we use Global variables and structures declarations in Paged RAM?
If yes, how can we use it? (Whether with #pragma derivative)

In linker file it is stated as
/* paged RAM:                       0x1000 TO   0x1FFF; addressed through RPAGE */
      RAM_F8        = READ_WRITE  0xF81000 TO 0xF81FFF;
      RAM_F9        = READ_WRITE  0xF91000 TO 0xF91FFF;
      RAM_FA        = READ_WRITE  0xFA1000 TO 0xFA1FFF;
      RAM_FB        = READ_WRITE  0xFB1000 TO 0xFB1FFF;
      RAM_FC        = READ_WRITE  0xFC1000 TO 0xFC1FFF;
      RAM_FD        = READ_WRITE  0xFD1000 TO 0xFD1FFF;

MYDATA INTO RAM_FD;  //this is our modification

in variable.c file we are specifying Data seg as
#pragma DATA_SEG MYDATA

Is this the right syntax and method or should we use something else?
Labels (1)
0 Kudos
Reply
7 Replies

1,407 Views
CompilerGuru
NXP Employee
NXP Employee
Which memory model?
when looking through other posts, there is a Technical Note TN238. Well, I don't have it in front of me, but I do remember that there was one (two?) TN's covering the topic quite well.

Concrete, your pragma just causes that variables end up in MYDATA, it does not contain the qualifiers to make the compiler generate code which sets the page.
The most efficient is to use RPAGE, and that would read as
#pragma DATA_SEG __RPAGE_SEG MYDATA

It's also possible to use GPAGE, that's a bit slower and generates more code, so I prefer RPAGE.
The main advantage of GPAGE is that it also works for constants in flash (with a #pragma CONST_SEG __GPAGE_SEG MY_CONST_DATA)

#pragma DATA_SEG __GPAGE_SEG MYDATA

look out for the Technical notes, they have been a separate download in the past. Also search this forum as this topic came up a few times although not recently.

Daniel
0 Kudos
Reply

1,407 Views
kp2309
Contributor I
Thanks for the quick reply.
I need to know some information regarding System Hang in Between?
It works perfectly for sometime and then the system hangs.
Is that bcos of Paged RAM not been declared properly?
As we are using Xgate XDP512 family
1) I am using it in CPU12X(Single Core) mode
I have many variables in Variables.c and their is Variables.h file having Extern.
I can't use the

   #pragma DATA_SEG DEFAULT

As Non Banked RAM is 0x2000 to 0x3FFF only. (8KB)

I need to use only Banked RAM for variables and structures.
How can i use the rest 24KB RAM directly for all variables declared and initialised in Variables.c?

Pls do the needfull.
 
0 Kudos
Reply

1,407 Views
Steve
NXP Employee
NXP Employee
If it works for a while and then stops there are a number of possible problems but one possibility is that an RPAGE/GPAGE value is being changed inside an interrupt routine.
You can deal with this situation by using the -Cp switch in the compiler. This stores the relevant page registers on entering an interrupt and restores it on exit.
 
0 Kudos
Reply

1,407 Views
kp2309
Contributor I
We have used -Cp switch for GPAGE,DPAGE,EPAGE & PPAGE. there is no option for RPAGE as such in compiler settings.
The thing is not working out.
Is there any means by which we can confirm that the System hang is because of problem related to RPAGE/GPAGE with respect to interrupt, we are discussing so far??????
 
 
0 Kudos
Reply

1,407 Views
CrasyCat
Specialist III
Hello
 
Just my 2 cents on this one.
 
CodeWarrior compiler has a flag -CpRPAGE as soon as you build code for HCS12X.
 
CrasyCat
0 Kudos
Reply

1,407 Views
kp2309
Contributor I
In .prm file following changes are done


SEGMENTS
/* paged FLASH:                     0x8000 TO   0xBFFF; addressed through PPAGE */


      FLASH_G1 = READ_ONLY 0x780000'G TO 0x78FFFF'G; // PAGE_E0 TO PAGE_E3

      //Commented
      /*
      PAGE_E0       = READ_ONLY   0xE08000 TO 0xE0BFFF;
      PAGE_E1       = READ_ONLY   0xE18000 TO 0xE1BFFF;
      PAGE_E2       = READ_ONLY   0xE28000 TO 0xE2BFFF;
      PAGE_E3       = READ_ONLY   0xE38000 TO 0xE3BFFF;
*/
END

PLACEMENT

USRPGM_FLASH INTO FLASH_G1;

END

Whenever I declare/Initialise the constant variables using the following Statement

#pragma CONST_SEG __GPAGE_SEG USRPGM_FLASH  

const BYTE Menu_List1[4][18] =
   
                                    {
                                        "aaa\0,
                                       
                                        bbbb\0",
                                       
                                        "cccc\0",                                   
                                       
                                        "ddd\0"
                              };

#pragma CONST_SEG DEFAULT

When i try accessing the contents of the constant variables it displays Junk characters on my Alphanumeric LCD.

Pls let me know the following changes to be done, if any.





0 Kudos
Reply

1,407 Views
CrasyCat
Specialist III
Hello
 
Here I would recommend you to first check whether the memory area 0x780000'G has been initialized properly.
 
If you are using CodeWarrior debugger:
  - Start the debugger
  - When you reach the main function, click within the Memory window with the right mouse button
  - Select Address, enter 0x780000'G in there and click OK.
 
Are the constants stored correctly in memory? If yes,  then you have a problem in your LCD function.
You need to specify you are using far pointer in that function.
 
 
CrasyCat
0 Kudos
Reply