From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7948 invoked by alias); 10 Sep 2007 09:14:48 -0000 Received: (qmail 7900 invoked by uid 22791); 10 Sep 2007 09:14:47 -0000 X-Spam-Check-By: sourceware.org Received: from mail.sunnorth.com.cn (HELO bjmsw01.sunnorth.com.cn) (124.42.0.200) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 10 Sep 2007 09:14:43 +0000 Received: from maillog.sunnorth.com.cn (unverified [172.20.10.250]) by bjmsw01.sunnorth.com.cn (Clearswift SMTPRS 5.2.9) with ESMTP id for ; Mon, 10 Sep 2007 17:14:33 +0800 Received: from ntns1cn.sunnorth.com.cn (ntns1cn.sunnorth.com.cn [172.20.10.252]) by maillog.sunnorth.com.cn (8.12.10/8.12.10) with ESMTP id l8A9g6TY026033 for ; Mon, 10 Sep 2007 17:42:06 +0800 MIME-Version: 1.0 To: ecos-discuss@ecos.sourceware.org From: taiyun@sunnorth.com.cn Sensitivity: Date: Mon, 10 Sep 2007 09:14:00 -0000 Message-ID: X-Mailer: Lotus Domino Web Server Release 6.5.5 November 30, 2005 Content-type: text/plain; charset=US-ASCII Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: [ECOS] A problem about constructor sequence X-SW-Source: 2007-09/txt/msg00046.txt.bz2 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