public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Couple of porting questions
@ 2014-06-24 15:05 Andrew Hannam
  2014-06-24 22:34 ` [ECOS] " John Dallaway
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Hannam @ 2014-06-24 15:05 UTC (permalink / raw)
  To: 'eCos Discussion'

I am currently porting the uGFX LCD graphics library to eCos and have a few
questions.

1/ Is there any method of detecting from a thread handle whether the thread
that handle refers to is still runnable ie. hasn't exited or been killed?

2/ Is there any way of detecting if cyg_scheduler_start() has already been
called or, is it safe to call it multiple times with no side effects or, can
it be assumed that cyg_scheduler_start() has already been called when main()
is invoked (if the kernel is included)?

3/ Is there any approved method of halting the system (eg due to an
unrecoverable soft error) or is calling the C library exit() or _exit()
sufficient?

4/ Can stdout output be relied upon on all platforms? Is stdout and/or
stderr assumed to be a debug/monitor output stream?

Thanks,
Andrew.


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ECOS] Re: Couple of porting questions
  2014-06-24 15:05 [ECOS] Couple of porting questions Andrew Hannam
@ 2014-06-24 22:34 ` John Dallaway
  0 siblings, 0 replies; 2+ messages in thread
From: John Dallaway @ 2014-06-24 22:34 UTC (permalink / raw)
  To: Andrew Hannam; +Cc: eCos Discussion

Hi Andrew

On 24/06/14 16:01, Andrew Hannam wrote:

> 1/ Is there any method of detecting from a thread handle whether the thread
> that handle refers to is still runnable ie. hasn't exited or been killed?

Take a look at cyg_thread_get_info().

> 2/ Is there any way of detecting if cyg_scheduler_start() has already been
> called or, is it safe to call it multiple times with no side effects or, can
> it be assumed that cyg_scheduler_start() has already been called when main()
> is invoked (if the kernel is included)?

In general, the eCos application developer creates threads within the
cyg_user_start() function and the scheduler is started by system code
when cyg_user_start() exits. Support for main() is dependent on the
CYGPKG_LIBC_STARTUP package being included and the context in which
main() is called is configurable. It would be better to avoid reliance
on C library startup in system-level code if at all possible. If you
must use main() as an entry point for some reason, take a look at the
descriptions of the CYGSEM_LIBC_STARTUP_MAIN_INITCONTEXT and
CYGSEM_LIBC_STARTUP_MAIN_THREAD options.

> 3/ Is there any approved method of halting the system (eg due to an
> unrecoverable soft error) or is calling the C library exit() or _exit()
> sufficient?

The C library might not be present. You might simply enter a tight loop:

  for (;;) CYG_EMPTY_STATEMENT;

> 4/ Can stdout output be relied upon on all platforms? Is stdout and/or
> stderr assumed to be a debug/monitor output stream?

Again, the C library might not be present. You can use diag_printf() for
debug output or one of the configurable CYG_TRACE*() macros.

I hope this helps...

John Dallaway
eCos maintainer
http://www.dallaway.org.uk/john

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-24 22:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-24 15:05 [ECOS] Couple of porting questions Andrew Hannam
2014-06-24 22:34 ` [ECOS] " John Dallaway

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).