Need a hint on GNAT/RTEMS

Joel Sherrill joel.sherrill at OARcorp.com
Wed Jan 29 14:09:16 UTC 2003



Steve wrote:
> 
> ----- Original Message -----
> From: "Angelo Fraietta" <angelo_f at bigpond.com>
> To: "Steve" <steved94 at attbi.com>
> Cc: "RTEMS List" <rtems-users at OARcorp.com>
> Sent: Tuesday, January 28, 2003 6:51 PM
> Subject: Re: Need a hint on GNAT/RTEMS
> 
> > Are there any examples in your RTEMS source?
> >
> 
> I've been looking for an example in the RTEMS source but haven't been able
> to find one.  Maybe it's there but I am just missing it?

You aren't but I am. :(  I just cut a new tarball with very modest
updates to the README's.  It has a hello world ada and Makefiles
for the following targets:

  + i386/pc386
  + powerpc/psim
  + sparc/erc32
  + mips/jmr3904

The READMEs still reflect old tools but the Makefiles are up to date.

Any patches to READMEs or new ones would be welcomed.

ANd FWIW the merger of gnat into the main gcc means that the Getting
Started with GNAT/RTEMS manual needs to be folded into the main
Getting Started manual.  So any help there is greatly appreciated.
There was a lot of detail in there that no longer applies.

> Here is the source file I'm attempting to compile:
> 
> with Ada.Text_Io;
> 
> procedure hello is
> 
>   package Text_io renames Ada.Text_io;
> 
> begin
>   Text_Io.Put_Line( "*** WELCOME TO RTEMS ***" );
>   Text_Io.Put_Line( "From GNAT/RTEMS" );
>   Text_Io.Put_Line( "***" );
>   delay 5.0;
> end hello;
> 
> When I try using i386-rtems-gnatmake hello I get a bunch of error messages:
> 
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/adalib/libgnat.a(cstreams.o): In
> function `__gnat_full_name':
> /opt/usr2/usr_src_redhat_BUILD/i386-rtems-gcc-newlib/build/gcc/ada/rts/cstre
> ams.c:228: undefined reference to `getcwd'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/adalib/libgnat.a(sysdep.o): In
> function `__gnat_ttyname':
> /opt/usr2/usr_src_redhat_BUILD/i386-rtems-gcc-newlib/build/gcc/ada/rts/sysde
> p.c:284: undefined reference to `ttyname'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/adalib/libgnat.a(init.o): In
> function `__gnat_initialize':
> /opt/usr2/usr_src_redhat_BUILD/i386-rtems-gcc-newlib/build/gcc/ada/rts/init.
> c:1656: undefined reference to `__gnat_install_handler'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(ex
> it.o): In function `exit':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> lib/../../../../../gcc-3.2.1/newlib/libc/stdlib/exit.c:70: undefined
> reference to `_exit'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(fc
> lose.o): In function `fclose':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/fclose.c:77: undefined
> reference to `_free_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/fclose.c:79: undefined
> reference to `_free_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/fclose.c:75: undefined
> reference to `_free_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(fi
> ndfp.o): In function `__sfmoreglue':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/findfp.c:63: undefined
> reference to `_malloc_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(fo
> pen.o): In function `_fopen_r':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/fopen.c:138: undefined
> reference to `_open_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(fr
> eopen.o): In function `freopen':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/freopen.c:111: undefined
> reference to `_open_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/freopen.c:130: undefined
> reference to `_free_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/freopen.c:133: undefined
> reference to `_free_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/freopen.c:122: undefined
> reference to `_free_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(fs
> eek.o): In function `fseek':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/fseek.c:305: undefined
> reference to `_free_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/fseek.c:310: undefined
> reference to `_fstat_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/fseek.c:263: undefined
> reference to `_free_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/fseek.c:283: undefined
> reference to `_free_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/fseek.c:207: undefined
> reference to `_fstat_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(ma
> kebuf.o): In function `__smakebuf':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/makebuf.c:50: undefined
> reference to `_fstat_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/makebuf.c:81: undefined
> reference to `_malloc_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/makebuf.c:96: undefined
> reference to `isatty'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(mk
> temp.o): In function `_gettemp':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/mktemp.c:114: undefined
> reference to `_getpid_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/mktemp.c:135: undefined
> reference to `_stat_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/mktemp.c:151: undefined
> reference to `_open_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/mktemp.c:161: undefined
> reference to `_stat_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(pu
> tenv_r.o): In function `_putenv_r':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> lib/../../../../../gcc-3.2.1/newlib/libc/stdlib/putenv_r.c:54: undefined
> reference to `_free_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> lib/../../../../../gcc-3.2.1/newlib/libc/stdlib/putenv_r.c:48: undefined
> reference to `_free_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(re
> fill.o): In function `__srefill':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/refill.c:78: undefined
> reference to `_free_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(se
> tenv_r.o): In function `_setenv_r':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> lib/../../../../../gcc-3.2.1/newlib/libc/stdlib/setenv_r.c:109: undefined
> reference to `_malloc_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> lib/../../../../../gcc-3.2.1/newlib/libc/stdlib/setenv_r.c:85: undefined
> reference to `_realloc_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> lib/../../../../../gcc-3.2.1/newlib/libc/stdlib/setenv_r.c:96: undefined
> reference to `_malloc_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(se
> tvbuf.o): In function `setvbuf':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/setvbuf.c:127: undefined
> reference to `_free_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(st
> dio.o): In function `__sread':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/stdio.c:46: undefined
> reference to `_read_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(st
> dio.o): In function `__swrite':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/stdio.c:83: undefined
> reference to `_write_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/stdio.c:75: undefined
> reference to `_lseek_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(st
> dio.o): In function `__sseek':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/stdio.c:102: undefined
> reference to `_lseek_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(st
> dio.o): In function `__sclose':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/stdio.c:119: undefined
> reference to `_close_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(st
> rdup_r.o): In function `_strdup_r':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> lib/../../../../../gcc-3.2.1/newlib/libc/stdlib/strdup_r.c:11: undefined
> reference to `_malloc_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(ti
> me.o): In function `time':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/tim
> e/../../../../../gcc-3.2.1/newlib/libc/time/time.c:50: undefined reference
> to `_gettimeofday_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(tm
> pnam.o): In function `worker':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/tmpnam.c:123: undefined
> reference to `_open_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/tmpnam.c:133: undefined
> reference to `_close_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(tm
> pnam.o): In function `_tmpnam_r':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/tmpnam.c:155: undefined
> reference to `_getpid_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(tm
> pnam.o): In function `_tempnam_r':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/tmpnam.c:181: undefined
> reference to `_malloc_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/tmpnam.c:184: undefined
> reference to `_getpid_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(un
> getc.o): In function `__submore':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/ungetc.c:58: undefined
> reference to `_realloc_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/ungetc.c:47: undefined
> reference to `_malloc_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(ws
> etup.o): In function `__swsetup':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> io/../../../../../gcc-3.2.1/newlib/libc/stdio/wsetup.c:50: undefined
> reference to `_free_r'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/lib/libc.a(mp
> rec.o): In function `_Balloc':
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> lib/../../../../../gcc-3.2.1/newlib/libc/stdlib/mprec.c:118: undefined
> reference to `_calloc_r'
> /usr/src/redhat/BUILD/i386-rtems-gcc-newlib/build/i386-rtems/newlib/libc/std
> lib/../../../../../gcc-3.2.1/newlib/libc/stdlib/mprec.c:101: undefined
> reference to `_calloc_r'
> collect2: ld returned 1 exit status
> i386-rtems-gnatmake: *** link failed.
> [steved at localhost hello_world_ada]$ cat makelog.txt | more
> i386-rtems-gnatbind -x hello.ali
> i386-rtems-gnatlink hello.ali
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/../../../../i386-rtems/bin/ld:
> warning:
> cannot find entry symbol _start; defaulting to 08048080
> b~hello.o: In function `adainit':
> b~hello.o(.text+0x41): undefined reference to `__gnat_install_handler'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/adalib/libgnat.a(s-fileio.o): In
> functio
> n `system__file_io__delete':
> /opt/usr2/usr_src_redhat_BUILD/i386-rtems-gcc-newlib/build/gcc/ada/rts/s-fil
> eio.
> adb:296: undefined reference to `unlink'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/adalib/libgnat.a(s-fileio.o): In
> functio
> n `system__file_io__finalize__2':
> /opt/usr2/usr_src_redhat_BUILD/i386-rtems-gcc-newlib/build/gcc/ada/rts/s-fil
> eio.
> adb:354: undefined reference to `unlink'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/adalib/libgnat.a(s-osprim.o): In
> functio
> n `system__os_primitives__clock':
> /opt/usr2/usr_src_redhat_BUILD/i386-rtems-gcc-newlib/build/gcc/ada/rts/s-osp
> rim.
> adb:83: undefined reference to `gettimeofday'
> /opt/rtems/lib/gcc-lib/i386-rtems/3.2.1/adalib/libgnat.a(s-osprim.o): In
> functio
> n `system__os_primitives__timed_delay':
> /opt/usr2/usr_src_redhat_BUILD/i386-rtems-gcc-newlib/build/gcc/ada/rts/s-osp
> rim.
> adb:145: undefined reference to `nanosleep'
> .
> .
> .
> I may just need to add some arguments to my gnatmake command.  An example
> would be great.
> 
> Steve

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list