public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: taiyun@sunnorth.com.cn
To: ecos-discuss@ecos.sourceware.org
Subject: [ECOS] A problem about constructor sequence
Date: Mon, 10 Sep 2007 09:14:00 -0000	[thread overview]
Message-ID: <OFAE4F14C8.27D51BC9-ON48257352.0032BD6A-48257352.0032BD79@sunnorth.com.cn> (raw)


Dear all:

I want to discuss something about eCos kernel, BUT I am not sure whether my
opinion is correct or someone has reported this problem before.
I think there is a problem with global constructor sequence. There are two
global instances, not only they have the same initialized priority but also
they have some relationship between each other. They are:

Cyg_Thread cyg_libc_main_thread CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_LIBC) = ...
AND
static cyg_libc_startup_dummy_constructor_class cyg_libc_startup_obj
                                  CYGBLD_ATTRIB_INIT_PRI(CYG_INIT_LIBC);

constructor of instance cyg_libc_startup_obj will call a function named
cyg_iso_c_start, and cyg_iso_c_start function will call
cyg_libc_main_thread.resume(). NOTE: cyg_libc_main_thread is the fisrt
instance I referred to.

So a nature thought comes to my mind, the first instance
cyg_libc_main_thread must be constructed before the second instance
cyg_libc_startup_obj. Otherwise, if cyg_libc_startup_obj was constructed
first and cyg_libc_main_thread's not initializing yet, then there must be
some problem.


HOWEVER, these two instances have the same priority, I think same priority
means that any of them constructs first will not affect the final result,
no matter who. BUT these two do matter, aren't they?
Which first may depend on compiler, and now we are using gcc4.2 compiler
from
http://www.codesourcery.com/gnu_toolchains/arm/download.html
that is arm-eabi gcc compiler, and I found that this compiler does
construct the second instance first, and eCos kernel can't start. Instance
of mainthread(i.e. the first instance) is not initialized and its method is
called, this is the reason of the problem, right?

Thanks for your answering in advance, and sorry for my bad expression.



***********************************************
Beijing Sunnorth eCos Maintainer Group

Maintainers:
liqin@sunnorth.com.cn
wanghui@sunnorth.com.cn
taiyun@sunnorth.com.cn
yxinghua@sunnorth.com.cn

Bejing Sunnorth Electronic Technology Co.,LTD
***********************************************


-- 
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:[~2007-09-10  9:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-10  9:14 taiyun [this message]
2007-09-10  9:35 ` Andrew Lunn
2007-09-10  9:54   ` Jonathan Larmour
     [not found]   ` <OFD56A862C.7D2739A1-ON48257352.003F8CFF-48257352.003FE916@sunnorth.com.cn>
2007-09-10 12:58     ` [ECOS] Re: ????: " Andrew Lunn
2007-09-11 16:48 ` Andrew Lunn
2007-09-10 11:47 taiyun

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=OFAE4F14C8.27D51BC9-ON48257352.0032BD6A-48257352.0032BD79@sunnorth.com.cn \
    --to=taiyun@sunnorth.com.cn \
    --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).