Hi Huu,
As first, I would like to recommend look at our application note AN3784 Understanding the Memory Scheme in the S12(X) Architecture
http://www.nxp.com/files/soft_dev_tools/doc/app_note/AN3784.pdf
After that, please look at TN238 and TN240 PDFs in "c:\Program Files (x86)\Freescale\CWS12v5.2\Help\pdf\" directory.
In short, you may use linker directive “#pragma DATA_SEG” for placing variables into paged RAM. For example:
#pragma DATA_SEG PAGED_RAM
unsigned int my_counter = 0x1234;
//…
#pragma DATA_SEG DEFAULT
Note: PAGED_RAM section is defined by default in prm linker file. You may create your own section.
Note: You must add the option -D__FAR_DATA on the compiler command line for proper paged RAM variables initialization during startup.
Note: The #pragma CONST_SEG change default linker settings for constants. The #pragma CODE_SEG change default linker settings for code placement.
I hope it helps you.
Have a great day,
Radek
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------