public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Simple compile
@ 2009-04-08  8:33 grahamlab
  2009-04-08  8:57 ` Sergei Gavrikov
  0 siblings, 1 reply; 5+ messages in thread
From: grahamlab @ 2009-04-08  8:33 UTC (permalink / raw)
  To: ecos-discuss


Hello everyone
I am new to ecos and am trying to compile a simple program that uses the
sleep function
My code include <unistd.h> but when I compile i get this error

hello.cpp:34: error: ‘sleep’ was not declared in this scope

I am compiling using the following command

arm-eabi-g++ -c -I ../DevBoardFast_install/include/ -I
/opt/ecos/ecos-3.0/packages/isoinfra/v3_0/include/  -Wall -Wpointer-arith
-Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings
-mcpu=cortex-m3 -mthumb -g -O2 -ffunction-sections -fdata-sections -fno-rtti
-fno-exceptions  hello.cpp

The code looks like this

#include <unistd.h>
#include <stdio.h>

int main(int argc, char** argv)
{
    sleep(10);
    printf("Hello main\n");
}

Please tell me why this does not compile

Thanks

Graham
-- 
View this message in context: http://www.nabble.com/Simple-compile-tp22944738p22944738.html
Sent from the Sourceware - ecos-discuss mailing list archive at Nabble.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] 5+ messages in thread

* Re: [ECOS] Simple compile
  2009-04-08  8:33 [ECOS] Simple compile grahamlab
@ 2009-04-08  8:57 ` Sergei Gavrikov
  2009-04-08 11:34   ` grahamlab
  0 siblings, 1 reply; 5+ messages in thread
From: Sergei Gavrikov @ 2009-04-08  8:57 UTC (permalink / raw)
  To: grahamlab; +Cc: ecos-discuss

On Wed, Apr 08, 2009 at 12:21:27AM -0700, grahamlab wrote:
> 
> Hello everyone
> I am new to ecos and am trying to compile a simple program that uses the
> sleep function
> My code include <unistd.h> but when I compile i get this error
> 
> hello.cpp:34: error: ‘sleep’ was not declared in this scope
> 
> I am compiling using the following command
> 
> arm-eabi-g++ -c -I ../DevBoardFast_install/include/ -I
> /opt/ecos/ecos-3.0/packages/isoinfra/v3_0/include/  -Wall -Wpointer-arith
> -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings
> -mcpu=cortex-m3 -mthumb -g -O2 -ffunction-sections -fdata-sections -fno-rtti
> -fno-exceptions  hello.cpp
> 
> The code looks like this
> 
> #include <unistd.h>
> #include <stdio.h>
> 
> int main(int argc, char** argv)
> {
>     sleep(10);
>     printf("Hello main\n");
> }
> 
> Please tell me why this does not compile
> 
> Thanks
> 
> Graham

Graham,

To have sleep() you have to add posix package to default template. Do
you really need in the bloat posix stuff? The eCos has own "sleep" --
cyg_thread_delay(). Please, start to read eCos documentation. So, a
solution is

ecosconfig add posix

IMHO, you have to prepare a good Makefile to play with eCos. Why do you
use C++ ?!. There are good examples under eCos `examples' directory. Try
the examples, first. Those build_Makefile, build_Make.params are nice
script-helpers to get a test farm. build_Make.params is most important
then. It rebuilds actual GCC flags for project. Every time when you
rebuild eCos, run build_Make.params (U.T.S.L.) in a project directory.

Just a demo about that eCos can do all for you

i. build eCos

ecosconfig new stm3210e
ecosconfig add posix
ecosconfig tree
make -s

ii. Stand up a test farm

mkdir test
cd test
cp $ECOS_REPOSITORY/../examples/build_Make.params .
DST=test SRCS=test.c $ECOS_REPOSITORY/../examples/build_Makefile ..
echo -ne 'clean:\n\trm -f test.o test\n' >> Makefile

cat >test.c<<EOF
#include <stdio.h>
#include <unistd.h>

int
main(void)
{
    sleep(10);
    printf("Test done\n");
    return 0;
}
EOF

make -s

I've got

ls
Makefile  Make.params  test  test.c  test.o

And there is sleep there

arm-eabi-nm test | grep sleep
68009d98 T _ZN10Cyg_Thread5sleepEv
6800c2a4 T nanosleep
6800c358 T sleep

But, eCos source can look as (no need posix package to compile it)

#include <stdio.h>
#include <cyg/kernel/kapi.h>

int
main(void)
{
    while (true) {
	cyg_thread_delay(100);
	printf("I'm still alive\n");
    }
    return 0;
}


This week read these manuals:
http://ecos.sourceware.org/docs.html


Sergei

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

* Re: [ECOS] Simple compile
  2009-04-08  8:57 ` Sergei Gavrikov
@ 2009-04-08 11:34   ` grahamlab
  2009-04-08 11:36     ` Gary Thomas
  2009-04-08 12:03     ` Sergei Gavrikov
  0 siblings, 2 replies; 5+ messages in thread
From: grahamlab @ 2009-04-08 11:34 UTC (permalink / raw)
  To: ecos-discuss




Sergei Gavrikov-4 wrote:
> 
> On Wed, Apr 08, 2009 at 12:21:27AM -0700, grahamlab wrote:
>> 
>> Hello everyone
>> I am new to ecos and am trying to compile a simple program that uses the
>> sleep function
>> My code include <unistd.h> but when I compile i get this error
>> 
>> hello.cpp:34: error: ‘sleep’ was not declared in this scope
>> 
>> I am compiling using the following command
>> 
>> arm-eabi-g++ -c -I ../DevBoardFast_install/include/ -I
>> /opt/ecos/ecos-3.0/packages/isoinfra/v3_0/include/  -Wall -Wpointer-arith
>> -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings
>> -mcpu=cortex-m3 -mthumb -g -O2 -ffunction-sections -fdata-sections
>> -fno-rtti
>> -fno-exceptions  hello.cpp
>> 
>> The code looks like this
>> 
>> #include <unistd.h>
>> #include <stdio.h>
>> 
>> int main(int argc, char** argv)
>> {
>>     sleep(10);
>>     printf("Hello main\n");
>> }
>> 
>> Please tell me why this does not compile
>> 
>> Thanks
>> 
>> Graham
> 
> Graham,
> 
> To have sleep() you have to add posix package to default template. Do
> you really need in the bloat posix stuff? The eCos has own "sleep" --
> cyg_thread_delay(). Please, start to read eCos documentation. So, a
> solution is
> 
> ecosconfig add posix
> 
> IMHO, you have to prepare a good Makefile to play with eCos. Why do you
> use C++ ?!. There are good examples under eCos `examples' directory. Try
> the examples, first. Those build_Makefile, build_Make.params are nice
> script-helpers to get a test farm. build_Make.params is most important
> then. It rebuilds actual GCC flags for project. Every time when you
> rebuild eCos, run build_Make.params (U.T.S.L.) in a project directory.
> 
> Just a demo about that eCos can do all for you
> 
> i. build eCos
> 
> ecosconfig new stm3210e
> ecosconfig add posix
> ecosconfig tree
> make -s
> 
> ii. Stand up a test farm
> 
> mkdir test
> cd test
> cp $ECOS_REPOSITORY/../examples/build_Make.params .
> DST=test SRCS=test.c $ECOS_REPOSITORY/../examples/build_Makefile ..
> echo -ne 'clean:\n\trm -f test.o test\n' >> Makefile
> 
> cat >test.c<<EOF
> #include <stdio.h>
> #include <unistd.h>
> 
> int
> main(void)
> {
>     sleep(10);
>     printf("Test done\n");
>     return 0;
> }
> EOF
> 
> make -s
> 
> I've got
> 
> ls
> Makefile  Make.params  test  test.c  test.o
> 
> And there is sleep there
> 
> arm-eabi-nm test | grep sleep
> 68009d98 T _ZN10Cyg_Thread5sleepEv
> 6800c2a4 T nanosleep
> 6800c358 T sleep
> 
> But, eCos source can look as (no need posix package to compile it)
> 
> #include <stdio.h>
> #include <cyg/kernel/kapi.h>
> 
> int
> main(void)
> {
>     while (true) {
> 	cyg_thread_delay(100);
> 	printf("I'm still alive\n");
>     }
>     return 0;
> }
> 
> 
> This week read these manuals:
> http://ecos.sourceware.org/docs.html
> 
> 
> Sergei
> 
> -- 
> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
> 
> 
> 
Hi Sergei
Thanks for the advice and for taking the time
I have build the test environment as you said and it all works perfectly.
I was wondering if I can do somethin similar using the config tool, but it
appears not as the filenames do no match up to those expected by
build_make.params and build_makefile. The config tool does not produce a
makefile either.

Graham
-- 
View this message in context: http://www.nabble.com/Simple-compile-tp22944738p22948006.html
Sent from the Sourceware - ecos-discuss mailing list archive at Nabble.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] 5+ messages in thread

* Re: [ECOS] Simple compile
  2009-04-08 11:34   ` grahamlab
@ 2009-04-08 11:36     ` Gary Thomas
  2009-04-08 12:03     ` Sergei Gavrikov
  1 sibling, 0 replies; 5+ messages in thread
From: Gary Thomas @ 2009-04-08 11:36 UTC (permalink / raw)
  To: grahamlab; +Cc: ecos-discuss

grahamlab wrote:
> 
> 
> Sergei Gavrikov-4 wrote:
>> On Wed, Apr 08, 2009 at 12:21:27AM -0700, grahamlab wrote:
>>> Hello everyone
>>> I am new to ecos and am trying to compile a simple program that uses the
>>> sleep function
>>> My code include <unistd.h> but when I compile i get this error
>>>
>>> hello.cpp:34: error: ‘sleep’ was not declared in this scope
>>>
>>> I am compiling using the following command
>>>
>>> arm-eabi-g++ -c -I ../DevBoardFast_install/include/ -I
>>> /opt/ecos/ecos-3.0/packages/isoinfra/v3_0/include/  -Wall -Wpointer-arith
>>> -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings
>>> -mcpu=cortex-m3 -mthumb -g -O2 -ffunction-sections -fdata-sections
>>> -fno-rtti
>>> -fno-exceptions  hello.cpp
>>>
>>> The code looks like this
>>>
>>> #include <unistd.h>
>>> #include <stdio.h>
>>>
>>> int main(int argc, char** argv)
>>> {
>>>     sleep(10);
>>>     printf("Hello main\n");
>>> }
>>>
>>> Please tell me why this does not compile
>>>
>>> Thanks
>>>
>>> Graham
>> Graham,
>>
>> To have sleep() you have to add posix package to default template. Do
>> you really need in the bloat posix stuff? The eCos has own "sleep" --
>> cyg_thread_delay(). Please, start to read eCos documentation. So, a
>> solution is
>>
>> ecosconfig add posix
>>
>> IMHO, you have to prepare a good Makefile to play with eCos. Why do you
>> use C++ ?!. There are good examples under eCos `examples' directory. Try
>> the examples, first. Those build_Makefile, build_Make.params are nice
>> script-helpers to get a test farm. build_Make.params is most important
>> then. It rebuilds actual GCC flags for project. Every time when you
>> rebuild eCos, run build_Make.params (U.T.S.L.) in a project directory.
>>
>> Just a demo about that eCos can do all for you
>>
>> i. build eCos
>>
>> ecosconfig new stm3210e
>> ecosconfig add posix
>> ecosconfig tree
>> make -s
>>
>> ii. Stand up a test farm
>>
>> mkdir test
>> cd test
>> cp $ECOS_REPOSITORY/../examples/build_Make.params .
>> DST=test SRCS=test.c $ECOS_REPOSITORY/../examples/build_Makefile ..
>> echo -ne 'clean:\n\trm -f test.o test\n' >> Makefile
>>
>> cat >test.c<<EOF
>> #include <stdio.h>
>> #include <unistd.h>
>>
>> int
>> main(void)
>> {
>>     sleep(10);
>>     printf("Test done\n");
>>     return 0;
>> }
>> EOF
>>
>> make -s
>>
>> I've got
>>
>> ls
>> Makefile  Make.params  test  test.c  test.o
>>
>> And there is sleep there
>>
>> arm-eabi-nm test | grep sleep
>> 68009d98 T _ZN10Cyg_Thread5sleepEv
>> 6800c2a4 T nanosleep
>> 6800c358 T sleep
>>
>> But, eCos source can look as (no need posix package to compile it)
>>
>> #include <stdio.h>
>> #include <cyg/kernel/kapi.h>
>>
>> int
>> main(void)
>> {
>>     while (true) {
>> 	cyg_thread_delay(100);
>> 	printf("I'm still alive\n");
>>     }
>>     return 0;
>> }
>>
>>
>> This week read these manuals:
>> http://ecos.sourceware.org/docs.html
>>
>>
>> Sergei
>>
>> -- 
>> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
>> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>>
>>
>>
> Hi Sergei
> Thanks for the advice and for taking the time
> I have build the test environment as you said and it all works perfectly.
> I was wondering if I can do somethin similar using the config tool, but it
> appears not as the filenames do no match up to those expected by
> build_make.params and build_makefile. The config tool does not produce a
> makefile either.

The ConfigTool (and ecosconfig) are for configuring the eCos kernel.
You're on your own for how to build your actual application.  There
are tools to help; the build_make* scripts you've obviously seen,
as well as things like Eclipse which can be configured as an eCos
development environment.


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

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

* Re: [ECOS] Simple compile
  2009-04-08 11:34   ` grahamlab
  2009-04-08 11:36     ` Gary Thomas
@ 2009-04-08 12:03     ` Sergei Gavrikov
  1 sibling, 0 replies; 5+ messages in thread
From: Sergei Gavrikov @ 2009-04-08 12:03 UTC (permalink / raw)
  To: grahamlab; +Cc: ecos-discuss

On Wed, Apr 08, 2009 at 04:03:55AM -0700, grahamlab wrote:
> 
> 
> 
> Sergei Gavrikov-4 wrote:
> > 
> > On Wed, Apr 08, 2009 at 12:21:27AM -0700, grahamlab wrote:
> >> 
> >> Hello everyone
> >> I am new to ecos and am trying to compile a simple program that uses the
> >> sleep function
> >> My code include <unistd.h> but when I compile i get this error
> >> 
> >> hello.cpp:34: error: ‘sleep’ was not declared in this scope
> >> 
> >> I am compiling using the following command
> >> 
> >> arm-eabi-g++ -c -I ../DevBoardFast_install/include/ -I
> >> /opt/ecos/ecos-3.0/packages/isoinfra/v3_0/include/  -Wall -Wpointer-arith
> >> -Wstrict-prototypes -Wundef -Woverloaded-virtual -Wno-write-strings
> >> -mcpu=cortex-m3 -mthumb -g -O2 -ffunction-sections -fdata-sections
> >> -fno-rtti
> >> -fno-exceptions  hello.cpp
> >> 
> >> The code looks like this
> >> 
> >> #include <unistd.h>
> >> #include <stdio.h>
> >> 
> >> int main(int argc, char** argv)
> >> {
> >>     sleep(10);
> >>     printf("Hello main\n");
> >> }
> >> 
> >> Please tell me why this does not compile
> >> 
> >> Thanks
> >> 
> >> Graham
> > 
> > Graham,
> > 
> > To have sleep() you have to add posix package to default template. Do
> > you really need in the bloat posix stuff? The eCos has own "sleep" --
> > cyg_thread_delay(). Please, start to read eCos documentation. So, a
> > solution is
> > 
> > ecosconfig add posix
> > 
> > IMHO, you have to prepare a good Makefile to play with eCos. Why do you
> > use C++ ?!. There are good examples under eCos `examples' directory. Try
> > the examples, first. Those build_Makefile, build_Make.params are nice
> > script-helpers to get a test farm. build_Make.params is most important
> > then. It rebuilds actual GCC flags for project. Every time when you
> > rebuild eCos, run build_Make.params (U.T.S.L.) in a project directory.
> > 
> > Just a demo about that eCos can do all for you
> > 
> > i. build eCos
> > 
> > ecosconfig new stm3210e
> > ecosconfig add posix
> > ecosconfig tree
> > make -s
> > 
> > ii. Stand up a test farm
> > 
> > mkdir test
> > cd test
> > cp $ECOS_REPOSITORY/../examples/build_Make.params .
> > DST=test SRCS=test.c $ECOS_REPOSITORY/../examples/build_Makefile ..
> > echo -ne 'clean:\n\trm -f test.o test\n' >> Makefile
> > 
> > cat >test.c<<EOF
> > #include <stdio.h>
> > #include <unistd.h>
> > 
> > int
> > main(void)
> > {
> >     sleep(10);
> >     printf("Test done\n");
> >     return 0;
> > }
> > EOF
> > 
> > make -s
> > 
> > I've got
> > 
> > ls
> > Makefile  Make.params  test  test.c  test.o
> > 
> > And there is sleep there
> > 
> > arm-eabi-nm test | grep sleep
> > 68009d98 T _ZN10Cyg_Thread5sleepEv
> > 6800c2a4 T nanosleep
> > 6800c358 T sleep
> > 
> > But, eCos source can look as (no need posix package to compile it)
> > 
> > #include <stdio.h>
> > #include <cyg/kernel/kapi.h>
> > 
> > int
> > main(void)
> > {
> >     while (true) {
> > 	cyg_thread_delay(100);
> > 	printf("I'm still alive\n");
> >     }
> >     return 0;
> > }
> > 
> > 
> > This week read these manuals:
> > http://ecos.sourceware.org/docs.html
> > 
> > 
> > Sergei
> > 
> > -- 
> > Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
> > and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
> > 
> > 
> > 
> Hi Sergei
> Thanks for the advice and for taking the time
> I have build the test environment as you said and it all works perfectly.
> I was wondering if I can do somethin similar using the config tool, but it
> appears not as the filenames do no match up to those expected by
> build_make.params and build_makefile. The config tool does not produce a
> makefile either.
> 
> Graham

Like `ecosconfig', `configtool' does not generate Makefile for a user (a
project). The eCos configtool is not IDE like eclipse, and others. It's
a tool to generate and build eCos itself. It generates a lot of the
makefiles to bootstrap eCos itself. Look on eCos tools how on the tools
which helps you to configure an stand up a delelopment tree:

.
|-- include
`-- lib

Then you MUST investigate some efforts (if you have not IDE) to organize
new tree

.
|-- include
|-- lib
`-- src

Where `src' is yours ;-) Is it terrible for you? Then you have to spend
a time (perhaps and money) to get IDE. My tools is Linux + GNU, my IDE
is gnome-terminal + vim.

I never exchange my IDE on something like XXX-STUDIO-XXX-WORKS-INSTEAD-YOU.

But seriosly speaking, some guys use IDE (most of them use the different
eclipse clones). I'm sorry, I'm not expert here.


Sergei


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

end of thread, other threads:[~2009-04-08 11:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-08  8:33 [ECOS] Simple compile grahamlab
2009-04-08  8:57 ` Sergei Gavrikov
2009-04-08 11:34   ` grahamlab
2009-04-08 11:36     ` Gary Thomas
2009-04-08 12:03     ` Sergei Gavrikov

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