Re: Help with RTEMS C User’s Guide

Joel Sherrill joel at
Tue Jan 24 13:43:40 UTC 2017

On Jan 24, 2017 12:55 AM, "Tanu Hari Dixit" <tokencolour at> wrote:

Hello Devs,

I have been trying to setup a makefile so as to execute the various code
snippets given in the C User's guide for RTEMS (
index.html#SEC_Contents) and have failed miserably. Can you please help me
with this?

I have made a file with the first example of printing object names (
Key-Concepts-Object-Names.html#Key-Concepts-Object-Names) and i use the
following command to use sparc-rtems4.12-gcc to compile this program

sparc-rtems4.12-gcc --pipe -B/home/thd/development/rtems/
src/builds/erc32_1/sparc-rtems4.12/erc32/lib -specs bsp_specs -qrtems -Wall
-g -O2 -o rtems_object_try rtems_object_try.c

but when i do ./rtems_object_try I get:

./rtems_object_try: Invalid argument

The error is correct if the I'd passed into the method doesn't correspond
to an object that has been created. This is an example of a helper function
and would normally be part of a larger application.

If you called it during the initialization of ticker and passed in a task
ID, it should work.

I narrowed in on the above compiler command by reading the makefile as
given here(

What is it that I am missing?

Also is it necessary to use sparc-rtems4.12-gcc and not the gcc available
to me normally on my machine. When I use gcc,
I get the following error:

thd at thd-Inspiron-5537:~/development/rtems/src/programs/rtems_object$ gcc
--pipe -B/home/thd/development/rtems/src/builds/erc32_1/sparc-rtems4.12/erc32/lib
-specs bsp_specs -qrtems -Wall -g -O2 -o rtems_object_try
In file included from /home/thd/development/rtems/sr
                 from /home/thd/development/rtems/sr
                 from /home/thd/development/rtems/sr
                 from /home/thd/development/rtems/sr
                 from /home/thd/development/rtems/sr
                 from rtems_object_try.c:1:
12/erc32/lib/include/rtems/score/rbtree.h:21:22: fatal error: sys/tree.h:
No such file or directory
 #include <sys/tree.h>
compilation terminated.

You can't use the native compiler on RTEMS examples except for some POSIX
API examples and tests which are constructed to run both on RTEMS and the
native host. But they aren't tested often. In the native mode.

I am not able to understand what is wrong. It would be great if you could
point that out.
Thank you,
Tanu Hari Dixit.

devel mailing list
devel at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the devel mailing list