From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8009 invoked by alias); 16 May 2007 18:36:43 -0000 Received: (qmail 7936 invoked from network); 16 May 2007 18:36:20 -0000 Received: from unknown (69.17.117.7) by sourceware.org with QMTP; 16 May 2007 18:36:20 -0000 Received: (qmail 4475 invoked from network); 16 May 2007 18:36:18 -0000 Received: from dsl027-162-100.atl1.dsl.speakeasy.net (HELO otter.localdomain) ([216.27.162.100]) (envelope-sender ) by mail5.sea5.speakeasy.net (qmail-ldap-1.03) with SMTP for ; 16 May 2007 18:36:18 -0000 Received: from localhost (jmills@localhost) by otter.localdomain (8.11.6/8.11.6) with ESMTP id l4GIaJ503714; Wed, 16 May 2007 18:36:20 GMT Date: Wed, 16 May 2007 20:42:00 -0000 From: John Mills Reply-To: John Mills To: ecos-discuss@ecos.sourceware.org cc: Sergei Gavrikov In-Reply-To: <20070516181613.GA32666@ubuntu> Message-ID: MIME-Version: 1.0 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: Re: [ECOS] Newbie-Q: Clean exits from tests and examples X-SW-Source: 2007-05/txt/msg00084.txt.bz2 Sergei and Andrew - Thanks for your inputs and excellent explanation. I'm getting somewhat clearer ideas as I play with the examples. The context is that I have a moderately complex embedded eCos/MIPS (mipsisa32-elf-) application and would like to simulate parts of it multiply and concurrently in a Linux host environment. There is actually no reason for my simulators to close and exit (other than malfunction) until I kill them from Linux. In that sense it was a rhetorical question, but it reflected something basic with eCos that I hadn't thought about. I wrote a simple script to invoke one instance of the 'twothreads' example and log its output to a distinct file, which I could then watch from a dedicated xterm using 'tail -f ...': ++++++++++++++++++++++++++++++++++++++++++++++++++++ #!/bin/sh proc_no=$$ echo Starting process $proc_no (./twothreads > threads.$proc_no) & +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ On Wed, 16 May 2007, Sergei Gavrikov wrote: > 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. > > 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 - 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