From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 775 invoked by alias); 16 May 2007 18:17:07 -0000 Received: (qmail 754 invoked by uid 22791); 16 May 2007 18:17:06 -0000 X-Spam-Check-By: sourceware.org Received: from stelecom.gomel.by (HELO stelecom.gomel.by) (82.209.213.61) by sourceware.org (qpsmtpd/0.31) with ESMTP; Wed, 16 May 2007 18:16:59 +0000 Received: from localhost (localhost [127.0.0.1]) by stelecom.gomel.by (Postfix) with ESMTP id A6F31B000F2A; Wed, 16 May 2007 21:16:55 +0300 (EEST) Received: from stelecom.gomel.by ([127.0.0.1]) by localhost (stelecom.gomel.by [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 23604-20; Wed, 16 May 2007 21:16:54 +0300 (EEST) Received: from localhost (unknown [82.209.208.190]) by stelecom.gomel.by (Postfix) with ESMTP id DEEC8B000F4A; Wed, 16 May 2007 21:16:53 +0300 (EEST) Date: Wed, 16 May 2007 18:36:00 -0000 From: Sergei Gavrikov To: John Mills Cc: ecos-discuss@ecos.sourceware.org Message-ID: <20070516181613.GA32666@ubuntu> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes 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: Re: [ECOS] Newbie-Q: Clean exits from tests and examples X-SW-Source: 2007-05/txt/msg00083.txt.bz2 On Wed, May 16, 2007 at 09:58:53AM -0500, John Mills wrote: > Hello - > > I'm getting started with the eCos-2.0 'synthetic' target and have a couple > of beginner's questions. > > I used the command line setup: > > $ ecosconfig new linux default > > [edited 'ecos.ecc' tools prefix to match my installation] > > $ ecosconfig tree > $ make > $ make tests > > All this went fine. > > I copied the 'ecos-2.0/examples' directory into my scratch directory > and can built the executables, which also went fine: > > $ cd examples > $ make INSTALL_DIR= > > The 'install/.../tests' like 'wallclock' run and exit fine. The 'examples' > run fine, > but don't exit (i.e., 'hello' prints its output then sits until I kill it > with '^C'). > > $ ~/sandbox/ecos/examples> ./hello > Hello, eCos world! > [and here we stay until I issue a '^C'] > > Question: How should 'examples/hello.c' be structured to run and exit, > returning cleanly to the parent Linux shell, or how should I invoke it? > Answer: main(){printf("hello, world!\n");cyg_hal_sys_exit(0);} That's normal. The _tests_ for the synthetic target usually is finished by the CYGHWR_TEST_PROGRAM_EXIT (include/cyg/hal/hal_intr.h). So, there is the cyg_hal_sys_exit(0) in those wallclock* tests. And you can see that examples/hello.c exits from main with return 0. That's UNIX way. But eCos != UNIX. Where has to return the application? You can easy see the difference using GDB, set a breakpoint either to the 'cyg_test_exit' call (for the tests) or to the 'exit' call (for the POSIX sources). And more, try to run the synthetic executables from shell as 'appname --io'. Sergei > Thanks. > > - John Mills > john.m.mills@alum.mit.edu > > > > -- > Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos > and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss