Debugging basic BSP tasking functionality

Matthew J Fletcher amimjf at gmail.com
Wed Apr 17 14:04:14 UTC 2013


Hi,

Yes it the stack pointer out of range, because the current stack pointer
returned by GCC _builtin_frame_XX in the IDLE thread looks like its
actually that from the Init() thread.


Thinking this through,my target is Thumb, so the C interrupt handler should
be in a arm file with -mthumb-interwork set on the compile line.

I guess GCC can not auto-magicly know what particular functions are
interrupts, so should there be some entry/exit functions to save/restore
the stack, etc, like these...

http://www.procyonengineering.com/embedded/arm/armlib/docs/html/group__processor__lpc2000.html

ISR_ENTRY / ISR_EXIT






On 17 April 2013 13:40, Sebastian Huber
<sebastian.huber at embedded-brains.de>wrote:

> On 04/17/2013 02:27 PM, Matthew J Fletcher wrote:
>
>>  >Here a context switch from the Init to the idle (I guess) thread
>> happens.
>>   The >_User_extensions_Thread_**switch
>>  >() is called before the context switch and the running thread is
>> checked.  So
>> a sp of >0x814d299c must be in the range of the Init stack area.
>>
>> Yes it is, Init() stack area is 0x814d1a70 -> 0x814d2a74 (4100 bytes). So
>> it
>> looks like the stack pointer is not getting adjusted correctly when task
>> switching into a new thread ? as the rtems_idle task is using the Init()
>> stack
>> pointer.
>>
>
> Now I am a bit confused.  What check goes wrong in
>
>
> Stack_check_Frame_pointer_in_**range() at check.c:69 0x81180f6e
> rtems_stack_checker_switch_**extension() at check.c:276 0x81180f6e
> _User_extensions_Thread_**switch() at userextthreadswitch.c:41 0x8118cbaa
> _Thread_Dispatch() at threaddispatch.c:128 0x8118bce6
> _Thread_Enable_dispatch() at threaddispatch.c:59 0x8118bd5e
> rtems_task_delete() at taskdelete.c:94 0x81189750
> Init() at startup.c:241 0x81007840
>
> ?
>
> In case the stack pointer is out of range, then I guess that the interrupt
> exception processing is broken.  It is hard to know what happens without an
> actual target.
>
>
>
>>  > nm your-app.exe | grep 'bsp_\(section\|stack\)' | sort
>>
>> No matches.
>>
>
> Ok, 4.10 uses the old linker command files.  These symbols are only
> available in 4.11.
>
>
> --
> 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<sebastian.huber at embedded-brains.de>
> PGP     : Public key available on request.
>
> Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
>



-- 

regards
---
Matthew J Fletcher
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20130417/85db7c25/attachment-0001.html>


More information about the users mailing list