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 (https://docs.rtems.org/doc-
current/share/rtems/html/c_user/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 (
https://docs.rtems.org/doc-current/share/rtems/html/c_
user/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

I narrowed in on the above compiler command by reading the makefile as
given here(https://github.com/alanc98/rki/blob/master/Makefile).

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@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
rtems_object_try.c
In file included from /home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.12/erc32/lib/include/rtems/score/object.h:26:0,
                 from /home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.12/erc32/lib/include/rtems/score/thread.h:30,
                 from /home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.12/erc32/lib/include/rtems/score/heap.h:22,
                 from /home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.12/erc32/lib/include/rtems/rtems/types.h:26,
                 from /home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.12/erc32/lib/include/rtems.h:31,
                 from rtems_object_try.c:1:
/home/thd/development/rtems/src/builds/erc32_1/sparc-
rtems4.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.



I am not able to understand what is wrong. It would be great if you could
point that out.
Thank you,
Tanu Hari Dixit.
#include <rtems.h>
#include <rtems/bspIo.h>

void print_main(rtems_id id)
{
    char buffer[10];
    char *result;
    result = rtems_object_get_name( id, sizeof(buffer), buffer);
    printk( "ID=0x%08lx name=%s\n", id, ((result)? result: "no name"));
}

int main()
{
print_main(1);
}
_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to