RAM PAGED RTOS for HCS12X or use of stack pointer

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

RAM PAGED RTOS for HCS12X or use of stack pointer

跳至解决方案
2,277 次查看
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.
标签 (1)
标记 (1)
0 项奖励
回复
1 解答
1,086 次查看
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 项奖励
回复
2 回复数
1,086 次查看
kef
Specialist I
S12X stack pointer is 16bits wide and can't be expanded.
0 项奖励
回复
1,087 次查看
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 项奖励
回复