* [ECOS] twothreads example problem
@ 2008-02-18 12:53 Zavi
2008-02-20 14:14 ` [ECOS] " Zavi
0 siblings, 1 reply; 2+ messages in thread
From: Zavi @ 2008-02-18 12:53 UTC (permalink / raw)
To: ecos-discuss
Hi all,
I'm a newbie to eCos.
I'm trying to run the twothreads example on my ARM7TDMI (lpc2119). I
tried to run it even with only one thread (allocated a stack only for
it).
cyg_user_start() runs , however the thread never resumes, and all I
get is an infinite loop of the entire startup sequence.
What can be the reason for this?
I'm using the default configuration with some minor adjustments.
Could it be that I don't have enough RAM (16k)?
I added prints to the startup function, and the scheduler
initializtion is called as expecter, however with no effects.
Thank you
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 2+ messages in thread
* [ECOS] Re: twothreads example problem
2008-02-18 12:53 [ECOS] twothreads example problem Zavi
@ 2008-02-20 14:14 ` Zavi
0 siblings, 0 replies; 2+ messages in thread
From: Zavi @ 2008-02-20 14:14 UTC (permalink / raw)
To: ecos-discuss
I've isolated the problem to the 1st scheduler call to
hal_thread_load_context(), specifically to the first line in the
following assembly code (from context.S)
FUNC_START_ARM(hal_thread_load_context, r2)
ldr fp,[r0] // get context to restore
mrs r0,cpsr // disable IRQ's
orr r0,r0,#CPSR_IRQ_DISABLE|CPSR_FIQ_DISABLE
msr cpsr,r0
ldr r0,[fp,#armreg_cpsr]
msr spsr,r0
ldmfd fp,{r0-r10,fp,ip,sp,lr}
#ifdef __thumb__
mrs r1,spsr // r1 is scratch
// [r0 holds initial thread arg]
msr cpsr,r1 // hopefully no mode switch here!
bx lr
#else
movs pc,lr // also restores saved PSR
#endif
I manipulated the r0 so that first 4 bits were zeroized, and found out
that the problem was some misallignment in the address passed to this
function (stack pointer of first thread), since now the program
continued.
Has anyone encountered such a problem, and can instruct me as to why
it occurs (and how to fix it)?
Thank you
On Feb 18, 2008 2:52 PM, Zavi <zavi05@gmail.com> wrote:
> Hi all,
>
> I'm a newbie to eCos.
> I'm trying to run the twothreads example on my ARM7TDMI (lpc2119). I
> tried to run it even with only one thread (allocated a stack only for
> it).
> cyg_user_start() runs , however the thread never resumes, and all I
> get is an infinite loop of the entire startup sequence.
>
> What can be the reason for this?
> I'm using the default configuration with some minor adjustments.
> Could it be that I don't have enough RAM (16k)?
> I added prints to the startup function, and the scheduler
> initializtion is called as expecter, however with no effects.
>
> Thank you
>
--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-02-20 14:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-18 12:53 [ECOS] twothreads example problem Zavi
2008-02-20 14:14 ` [ECOS] " Zavi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).