Code in Paged RAM area MC9S12XET512

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

Code in Paged RAM area MC9S12XET512

1,333 Views
n3u3n0
Contributor I

Hello,

I'm using the MC9s12XET512 controller and I want to do the following:

-link some code in RAM paged area(use the FC,FD,FE,and FF RAM pages)

-download the code in these RAM pages using the existing application that resides in the flash memory,and CAN communication.

The issue that I'm facing is how can I call the functions that are stored in the paged RAM area?I know that for functions placed in the paged flash area, the modifier "@far" in function declaration allows  the CALL/RETC instructions to set and restore the PPAGE register, when calling paged functions in flash memory.

But how can a similar mechanism be used for RPAGE register?For calling the functions from paged RAM area I am using a pointer to function table, so at call time I will not know which function is placed in which RAM page.  

Labels (1)
0 Kudos
1 Reply

405 Views
kef
Specialist I

-link some code in RAM paged area(use the FC,FD,FE,and FF RAM pages)

CPU can run code only in "CPU local memory map". See 9S12XEP100 datasheet, Figure 1-2, MC9S12XE100 Global Memory Map. CPU local memory is on the left. CPU program counter register is 16bits wide only, that's 64-k addresses of CPU local memory. CPU runs code in PPAGE-paged/banked memory by mapping 16k memory chunks to PPAGE window in CPU local map at 0x8000-0xBFFF and executing code there. With the help of special CPU instructions, CALL and RTC, which manipulate PPAGE register, you can call routine on PPAGE=y from one PPAGE=x without need to jump to not paged memory. You can't do the same with R-, E- or G-paged memories, you need to switch paged register manually.

 

The issue that I'm facing is how can I call the functions that are stored in the paged RAM area?I know that for functions placed in the paged flash area, the modifier "@far" in function declaration allows  the CALL/RETC instructions to set and restore the PPAGE register, when calling paged functions in flash memory.

But how can a similar mechanism be used for RPAGE register?For calling the functions from paged RAM area I am using a pointer to function table, so at call time I will not

 

Again, there are no CPU instructions similar to CALL and RTC, that could automatically switch xPAGE register other than PPAGE. You have to set RPAGE manually, then using not paged JSR and RTS you may call and return from routines.

0 Kudos