Hi All,
We are using MC9S12XHY controller. Controller permits 8K non paged ram and 4k paged ram. Since ouyrram consumption is more than 8K, we used paged ram.
We referred the following documents for proper implementation
TN238.pdf TN240.PDF( From freescale)
#pragma DATA_SEG __GPAGE_SEG PAGED_RAM
static unsigned int a=23;
static unsigned int b=35;
#pragma DATA_SEG DEFAULT
We verified from the .map file and variables are allocated in the Paged RAM segment.
we also faced problem while copying values between two paged ram variables
While using this variables in runtime, we observed unprecedented behavior in these RAM variables. To sum it up, if we allocate these variables in non paged ram, we didnt face any issue.
Hi ruby,
please be aware, there is compiler/linker optimization.
When two variables are located in the same banked non default segment, Compiler/Linker suppose that they are in the same page and remove paging operations.
You could disable this optimization.
Go to project settings (Alt+F7), Compiler for HC12, Code Generation, check “Assume object are in same page for” and change settings to “never for different ojects”. Or you could simply add “-PSegObj” into Compiler Command Line Arguments.
I hope it helps you.
Have a great day,
RadekS
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Radek,
since Ruby is using __GPAGE_SEG and all RAM fits the same GPAGE segment, there's no need to worry about -PSegxxx switch, all settings must be fine. Ruby's issue must be somewhere else.
Regards,
Edward
Are these variables used in more than one C file? If so, then in your header file you need to surround these variables with the same #pragma DATA_SEG 's. This is necessary to make compiler aware about required addressing mechanism.
Are you using __RPAGE_SEG variables? These may need changing compiler's "Code Generation"->"Assume object are in same page for" setting.
Hi Edward,
They are are static variables and they are not used as extern more than one .c file.
but we pass those variables by value or reference(Address of the variables) via functions to other.c files.
we are using __GPAGE_SEG as per guidelines TN238.PDF!