Problems with the blackfin port

André Keller Abadie akabadie at gmail.com
Mon Mar 31 18:11:18 UTC 2008


Hi again!

I've already talked to Alain about this and he suggested me to discuss it here.

The problem happens when thread_dispatch is scheduled within an isr to
be executed after its return. This scheduling procedure has a flaw and
RTEMS keeps crashing every time a few conditions are met.

Blackfin is an architecture that saves the return pointer of a call in
a register - called RETS - instead of saving in the stack. However you
can use the instruction 'link' to create a stack frame and this
automatically pushes the RETS' value. All C code has this call+link
pair so technically we do save the return pointer in the stack.

This routine that schedules the execution of thread_dispatch after the
return of an interruption does so by changing the RETI's ('return from
interrupt' register) value to point to thread_dispatch and then
changes RETS's value to the old RETI's. Because of this operation, the
old RETS is lost if not previously saved by 'link'. All this procedure
goes perfectly well if the call+link pair is executed, but there are a
few functions that doesn't use 'link' (gcc code written in assembly).

I guess there are other architectures that, as blackfin, don't save
the return pointers in the stack. If so, how did you solve this
problem?

Any suggestions?

I do have a working solution but it uses a separate software
interruption to handle the threaddispatch function.

Thanks

André--



More information about the users mailing list