public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Entry point
@ 2007-04-25 13:21 LONY David
  2007-04-25 14:14 ` [ECOS] " Grant Edwards
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: LONY David @ 2007-04-25 13:21 UTC (permalink / raw)
  To: ecos-discuss

Hi all,

I'm new to eCos and I wanted to know if it possible to define an entry 
point when eCos start?
For instance, I have this kind of code :

#include <stdio.h>

main()
{

    printf("Hello\n");
    return;
}

In Linux Synthetic Target template it would work great... but if I 
change my code to this :

#include <stdio.h>

void test()
{
    printf("Hello\n");
    return;
}

How I can specified to eCos kernel to execute this function? I see in 
gdb (when I debug eCos) that the function cyg_user_start is called so I 
change my code to this:

#include <stdio.h>

void cyg_user_start(void)
{
    printf("Hello\n");
}

And It work too... But I don't know if it's the good method to do this...
Could someone help me please?
PS : I'm using the uitron profile... (sorry for my english, I'm French 
and I know that my english it's bad...)

Thanks
Best regards

David LONY


-- 
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] 4+ messages in thread

* [ECOS]  Re: Entry point
  2007-04-25 13:21 [ECOS] Entry point LONY David
@ 2007-04-25 14:14 ` Grant Edwards
  2007-04-25 14:18 ` [ECOS] " Andrew Lunn
  2007-04-25 16:11 ` [ECOS] " Grant Edwards
  2 siblings, 0 replies; 4+ messages in thread
From: Grant Edwards @ 2007-04-25 14:14 UTC (permalink / raw)
  To: ecos-discuss

On 2007-04-25, LONY David <david.lony@pragmadev.com> wrote:

> I'm new to eCos and I wanted to know if it possible to define an entry 
> point when eCos start?

eCos will call cyg_user_start() (if it exists in your program)
_before_ the scheduler is started.  The scheduler will start
after cyg_user_start() returns.   If there is no
cyg_user_start() in your program, the default one will create a
thread and call main() from within that thread.

> For instance, I have this kind of code :
>
> #include <stdio.h>
>
> main()
> {
>
>     printf("Hello\n");
>     return;
> }
>
> In Linux Synthetic Target template it would work great... but if I 
> change my code to this :
>
> #include <stdio.h>
>
> void test()
> {
>     printf("Hello\n");
>     return;
> }
>
> How I can specified to eCos kernel to execute this function?

Call it "main" instead of test.

> I see in gdb (when I debug eCos) that the function
> cyg_user_start is called so I change my code to this:
>
> #include <stdio.h>
>
> void cyg_user_start(void)
> {
>     printf("Hello\n");
> }
>
> And It work too...

It works differently, though.  The scheduler isn't running yet.


> But I don't know if it's the good method to do this...

That depends on what you want to do.  If you need to do
initialization before the scheduler starts, do it in
cyg_user_start().   If you just want to start running your code
code in a thread (after the scheduler is started), then provide
a main() instead of a cyg_user_start().

> Could someone help me please? PS : I'm using the uitron
> profile... (sorry for my english, I'm French and I know that
> my english it's bad...)

Why don't you want to call your entry-point function "main"?

-- 
Grant Edwards                   grante             Yow! I represent a
                                  at               sardine!!
                               visi.com            


-- 
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] 4+ messages in thread

* Re: [ECOS] Entry point
  2007-04-25 13:21 [ECOS] Entry point LONY David
  2007-04-25 14:14 ` [ECOS] " Grant Edwards
@ 2007-04-25 14:18 ` Andrew Lunn
  2007-04-25 16:11 ` [ECOS] " Grant Edwards
  2 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2007-04-25 14:18 UTC (permalink / raw)
  To: LONY David; +Cc: ecos-discuss

On Wed, Apr 25, 2007 at 03:22:50PM +0200, LONY David wrote:
> Hi all,
> 
> I'm new to eCos and I wanted to know if it possible to define an entry 
> point when eCos start?
> For instance, I have this kind of code :
> 
> #include <stdio.h>
> 
> main()
> {
> 
>    printf("Hello\n");
>    return;
> }
> 
> In Linux Synthetic Target template it would work great... but if I 
> change my code to this :
> 
> #include <stdio.h>
> 
> void test()
> {
>    printf("Hello\n");
>    return;
> }
> 
> How I can specified to eCos kernel to execute this function? I see in 
> gdb (when I debug eCos) that the function cyg_user_start is called so I 
> change my code to this:
> 
> #include <stdio.h>
> 
> void cyg_user_start(void)
> {
>    printf("Hello\n");
> }
> 
> And It work too... But I don't know if it's the good method to do this...
> Could someone help me please?

http://ecos.sourceware.org/docs-latest/ref/kernel-overview.html

Section Calling Contexts

        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] 4+ messages in thread

* [ECOS]  Re: Entry point
  2007-04-25 13:21 [ECOS] Entry point LONY David
  2007-04-25 14:14 ` [ECOS] " Grant Edwards
  2007-04-25 14:18 ` [ECOS] " Andrew Lunn
@ 2007-04-25 16:11 ` Grant Edwards
  2 siblings, 0 replies; 4+ messages in thread
From: Grant Edwards @ 2007-04-25 16:11 UTC (permalink / raw)
  To: ecos-discuss

On 2007-04-25, LONY David <david.lony@pragmadev.com> wrote:

> And It work too... But I don't know if it's the good method to do this...
> Could someone help me please?
> PS : I'm using the uitron profile... (sorry for my english, I'm French 
> and I know that my english it's bad...)
>
> Thanks
> Best regards
>
> David LONY

There's no need to apologize for your English.  It's fine.
However, I can't resist asking why your surname is always
uppercase.  On Usenet and mailing lists, all uppercase is
usually perceived as shouting.

Oh, you may want to have that sticky "." key looked into. ;)

-- 
Grant Edwards                   grante             Yow! Why is everything made
                                  at               of Lycra Spandex?
                               visi.com            


-- 
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] 4+ messages in thread

end of thread, other threads:[~2007-04-25 16:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-25 13:21 [ECOS] Entry point LONY David
2007-04-25 14:14 ` [ECOS] " Grant Edwards
2007-04-25 14:18 ` [ECOS] " Andrew Lunn
2007-04-25 16:11 ` [ECOS] " Grant Edwards

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