[Icc-mot] uexec and XGATE chip

Edward Karpicz ekarpicz at freemail.lt
Sat Oct 6 11:59:25 PDT 2007


Peter Lissenburg wrote:

> Hi Richard and all,
> I'm starting to use the uexec code on an xgate chip. Finding a problem(s),
> that I have not tracked down yet, so I thought I'd ask if anyone has done
> this and solved this (unknown as yet!) problem.
> Thanks for any insights.
> Peter L.
>
>

Hi Peter,

S12X CCR is 16bits wide, while S12 CCR is 8bits wide. As a result interrupt 
stack frames do differ. This doesn't hurt anybody except when code has to 
manipulate interrupt stack frame. I found two "suspect places" in hc12.s 
file from examples12\uexec_dp256.zip, please search for "create an interrupt 
stack frame":

...
_UEXC_SavregsAndResched::
 ; first create an interrupt stack frame
 pshy
 pshx
 pshd  ; what a concept, not A:B
 tpa
 anda #0xEF ; re-enable interrupt when it "returns" since
 psha  ; Defer() disables interrupt
...

In bottom three lines 8bit CCR is pushed to the stack. CCRh should be pushed 
next. CCRh holds interrupt priority level and it should be zero for 
foreground tasks. So add CLR 1,-SP after psha and it should get ported, I 
think.

...
_UEXC_SavregsAndResched::
 ; first create an interrupt stack frame
 pshy
 pshx
 pshd  ; what a concept, not A:B
 tpa
 anda #0xEF ; re-enable interrupt when it "returns" since
 psha  ; Defer() disables interrupt
   CLR   1,-SP
...

...
_UEXC_StartNewTask::
 lds _uexc_current_sp
 ; make KillSelf as the "return pc" of a new task, so if it
 ; ever returns, it will reclaim the storage
 ldd #_UEXC_KillSelf
 pshb
 psha
 ldd _uexc_current_func
 pshb
 psha
 ; create an interrupt stack frame
 pshy
 pshx
 pshd
 tpa
 anda #0xEF ; re-enable interrupt
 psha  ;
   CLR   1,-SP
...


Regards
Edward 




More information about the Icc-mot mailing list