Use of Paged Memory in code - S12 to S12X

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

Use of Paged Memory in code - S12 to S12X

1,814 Views
kp2309
Contributor I
I m porting my existing code from S12 to S12X and stuck up with RAM problem as default RAM is 12 KB instead of 14 KB
 
While using different segments in code while defining different varibles what is the process that should be follwed?
Likewise if I m declaring 5 variables and of type int and i want it in RAM page .
I ll make the changes in prm file and the in variable.c file what should be the format?????
 
Only at the start of variables like
#pragma DAT_SEG __RPAGE SEG XXXX
int a;
int b;
int c;
int d;
int e;
 
or at the start and end of the variables so that the variables after it can be assigned to some other block
#pragma DAT_SEG __RPAGE SEG XXXX
int a;
int b;
int c;
int d;
int e;
#pragma DAT_SEG __RPAGE SEG XXXX
and if this is the right way of doing then both the starting and ending #pragma should be same or different or any one of them has to be default??????
 
 
Added p/n to subject.


Message Edited by NLFSJ on 2008-02-29 09:19 AM
Labels (1)
0 Kudos
2 Replies

379 Views
CompilerGuru
NXP Employee
NXP Employee
The pragma DATA_SEG remains active until another pragma DATA_SEG defines another current section.
Therefore the second identical pragma does not do anything. Usually there is at the end also a
#pragma DATA_SEG DEFAULT, but that's for the variables defined elsewhere, so those get into the default section again.
Alternatively to the DEFAULT one, you can also put a #pragma push/#pragma pop around the
complete block, that has the advantage to restore the current section instead of just reseting it to DEFAULT.
That especially helps when you start using the XGATE, as the XGATE is using non DEFAULT sections for its code and data.
Please also have a look at the technical notes, there are at least 2 for the topic how to use the paging with the S12X.

Daniel

Code:
// example.h#pragma push#pragma DATA_SEG __RPAGE_SEG MY_RPAGE0_SECextern int i_rpage0;extern long i1_rpage0;#pragma pop// example.c#include "example.h"#pragma push#pragma DATA_SEG __RPAGE_SEG MY_RPAGE0_SECint i_rpage0;long i1_rpage0;#pragma DATA_SEG __RPAGE_SEG MY_RPAGE1_SECstatic char buf_rpage1[1000];#pragma popstatic char i_default;

 
0 Kudos

379 Views
kp2309
Contributor I
Thanks for the reply
I have done push and pop as told by you and assigned particular sectors in prm file but the code is not running ,As soon as burn the code and try to run it from debugger it doesnt go into running mode.
Can it be because of improper use of pages ?
 
also I am not able to find out technical notes, where can i get it exactly????
 
0 Kudos