public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Zavi <zavi05@gmail.com>
To: ecos-discuss@ecos.sourceware.org
Subject: [ECOS] Re: twothreads example problem
Date: Wed, 20 Feb 2008 14:14:00 -0000	[thread overview]
Message-ID: <e499980f0802200614y5b019c91h85de633d20657ce7@mail.gmail.com> (raw)
In-Reply-To: <e499980f0802180452n7ad87652i74c03abb73042249@mail.gmail.com>

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

      reply	other threads:[~2008-02-20 14:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-18 12:53 [ECOS] " Zavi
2008-02-20 14:14 ` Zavi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e499980f0802200614y5b019c91h85de633d20657ce7@mail.gmail.com \
    --to=zavi05@gmail.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).