ticker hangs on bf537Stamp

Sebastian Huber sebastian.huber at embedded-brains.de
Tue Oct 15 13:01:49 UTC 2013


On 2013-10-15 14:44, Kolja Waschk wrote:
>> You can set a break point to _Thread_Delay_ended().
>
> Ok, thanks, that's a good starting point.
>
> After the first hit, it runs into _Scheduler_priority_Unblock which sets
> "_Thread_Dispatch_necessary" = true.

This is fine.

>
> The code following label doDispatch in cpu_asm.S shortly afterwards zeros the
> flag (revealed by a HW watch on the DISPATCH_NEEDED location).

Is this the following code (from cpu_asm.S):

[...]
	/* do thread dispatch if necessary */
	p0.h = DISPATCH_NEEDED;
	p0.l = DISPATCH_NEEDED;
	r0 = B[p0] (Z);
	cc = r0 == 0;
	if cc jump noDispatch
doDispatch:
	r0 = 0;
	B[p0] = r0; <-- here _Thread_Dispatch_necessary is set to zero?
	raise 15;
[...]

This code was introduced with:

2008-08-13     Allan Hessenflow <allanh at kallisti.com>

        * cpu.c, cpu_asm.S, irq.c, rtems/score/cpu.h,
        rtems/score/cpu_asm.h: reworked interrupt handling to fix
        context switching.

I really wonder if this ever worked.  The exception epilogue must not write to 
_Thread_Dispatch_necessary.

For a start you can remove the lines "r0 = 0;" and "B[p0] = r0;".

There is a comment in this file:

/* the approach here is for the main interrupt handler, when a dispatch is
    wanted, to do a "raise 15".  when the main interrupt handler does its
    "rti", the "raise 15" takes effect and we end up here.  we can now
    safely call _Thread_Dispatch, and do an "rti" to get back to the
    original interrupted function.  this does require self-nesting to be
    enabled; the maximum nest depth is the number of tasks. */
	.global SYM(_ISR15_Handler)
SYM(_ISR15_Handler):

A maximum nest depth limited by the number of tasks is questionable.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the users mailing list