RAM PAGED RTOS for HCS12X or use of stack pointer

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

RAM PAGED RTOS for HCS12X or use of stack pointer

Jump to solution
1,697 Views
simointe
Contributor I
Hello,
 
I`m trying to configured as most as possible data in PAGED ram on my hcs12x512, because my 8K of NEAR memory overflows.
 
In fact, I`m able to locate my own data in PAGED ram with no problem.  I have problem with my third-party codes (data) that do not handle this memory map (because of the big amount of casting void * I guess).
 
According to the technical support of my RTOS, the RTOS RAM stuff (task`s stacks, internal arrays, etc) cannot be located in PAGED ram because the stack pointer of this processor is 16 bits.  Well I don`t know how accurate is this statement.  This RTOS do not officially support the hcs12x.
 
So my question: is the hcs12x stack pointer register could also be expanded with the RPAGE register, as other datas?
And by the way, which RTOS are you using with the HCS12X ?
 
Regards. Simon.
Labels (1)
Tags (1)
0 Kudos
1 Solution
506 Views
CompilerGuru
NXP Employee
NXP Employee
Well, yes and no. If the SP is completely inside of the paged RAM area, then I'm sure accesses using SP will using the RPAGE to build a paged 24 bit address.
So while SP is a 16 bit register, SP relative accesses can still point into a paging window. The S12X does not have a dedicated extension register as the HC16 had though.

If stacks do require a lot of RAM space, an OS is available which can be extended to store RPAGE as part of its context switch and the OS is using independent stacks for different threads, then I would expect having the stack on RPAGE would work just fine. Using RPAGE for the stack means of course not using it for anything else, but the remaining paged RAM can still be used via the (less efficient) GPAGE mechanism. If there are thread specific globals, then those could be allocated on the same page as the stack of that thread and accessed "non banked", so that would further reduce the use of the normal non banked ram.

Daniel

(Of course this setup also assumes that no global pointer point ever to non active stack frames).

View solution in original post

0 Kudos
2 Replies
506 Views
kef
Specialist I
S12X stack pointer is 16bits wide and can't be expanded.
0 Kudos
507 Views
CompilerGuru
NXP Employee
NXP Employee
Well, yes and no. If the SP is completely inside of the paged RAM area, then I'm sure accesses using SP will using the RPAGE to build a paged 24 bit address.
So while SP is a 16 bit register, SP relative accesses can still point into a paging window. The S12X does not have a dedicated extension register as the HC16 had though.

If stacks do require a lot of RAM space, an OS is available which can be extended to store RPAGE as part of its context switch and the OS is using independent stacks for different threads, then I would expect having the stack on RPAGE would work just fine. Using RPAGE for the stack means of course not using it for anything else, but the remaining paged RAM can still be used via the (less efficient) GPAGE mechanism. If there are thread specific globals, then those could be allocated on the same page as the stack of that thread and accessed "non banked", so that would further reduce the use of the normal non banked ram.

Daniel

(Of course this setup also assumes that no global pointer point ever to non active stack frames).
0 Kudos