This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
Re: twothreads example problem
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