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;