I have problems with the PPage switching within banked flash memory. I added some service-routines which are used all over the code. The problem occurs e.g. when code located in bank 31 calls the service-routines located in bank 32. To call the service-routine the compiler generates a "call 0x1234,0x32" instruction but when I step over the assembly code with the debugger I can see that the call instruction puts the address of the following instruction and the PPAGE register to the stack, but the PPAGE register is not changed from 31 to 32 and the instruction pointer points to 0x31 0x1234 after the call.
I compiled the code with the Compiler-Flags "-CpPPAGE=0x0030 -Mb". I tried to compile the code with the flags "-CpPPAGE=RUNTIME -Mb" and linked datapage.c to the code but this doesn`t fixed the problem.
In the S12CPU15UG.pdf I have read within chapter 4.4.8:
"The HCS12 has dedicated signal lines that allow the CPU to access the bank page register without having
to use an address in the normal 64K byte address space. This eliminates the need for the program to know
where the page register is physically located."
So why do I have to specify the PPAGE address to the compiler at all?
Used Tool Versions:
CodeWarrior Development Studio for Motorola HC12 3.1, build 4047. (see Attachment for more details)
Thanks for your help