Linking application and BSP

Joel Sherrill joel.sherrill at OARcorp.com
Thu Sep 21 20:35:44 UTC 2000


I could be very wrong but I think the -qrtems HAS to be after the
"-B.../ -specs bsp_specs" since it has no meaning until the bsp_specs
is processed.

--joel

"Michael P. Collins on korat" wrote:
> 
>   I'm still having problems.
> 
>   My bsp_specs file is the one used in efi332.  The one from gen68340 is
> essentially identical, and yields the same result -- I must have "start.o"
> in my build directory or the final link fails.  My Makefile and the
> gcc output are appended.  Perhaps there's a clue in there.  Comments
> follow.
> 
> --------------------------------------------------------------------------
> 
> #
> # %M% %I%
> #
> #       Top-level Makefile for MC68331-based characterization system.
> #
> # Latest delta: %E% %U%
> #    Retrieved: %D% %T%
> #
> 
> ROM_LIBPATH = /usr/local/rtems/lz120_ROM/lib
> CPU_FAMILY = mcpu32
> AS      = m68k-rtems-as
> CC      = m68k-rtems-gcc
> ASFLAGS = -f
> 
> CFLAGS  = \
>           -qrtems \
>           -Wall \
>           -ansi \
>           -$(CPU_FAMILY) \
>           -Wno-unused
> 
> LFLAGS  = \
>           --pipe \
>           -qrtems \
>           -Wall \
>           -ansi \
>           -fasm \
>           -$(CPU_FAMILY) \
>           -Wno-unused
> 
> OBJECTS =                       \
>         cmd/adc.o               \
>         cmd/baud.o              \
>         cmd/bf.o                \
>         cmd/dac.o               \
>         cmd/go.o                \
>         cmd/help.o              \
>         cmd/led.o               \
>         cmd/load.o              \
>         cmd/md.o                \
>         cmd/mm.o                \
>         cmd/rev.o               \
>         cmd/sc.o                \
>         cmd/sine.o              \
>         init/init.o             \
>         lib/atolx.o             \
>         lib/b_hatoi.o           \
>         lib/checksum.o          \
>         lib/inpstr.o            \
>         lib/parse.o             \
>         lib/prntln.o            \
>         lib/read_record.o       \
>         lib/s_hatoi.o           \
>         lib/updcrc.o            \
>         cli/cli.o               \
>         qsm/qspi_init.o         \
>         qsm/qspi_rd.o           \
>         qsm/qspi_wr.o           \
>         sys/sys_init.o          \
>         sys/sys_sv.o
> 
> all:
>         rm -f rom.s19
>         $(MAKE) rom
> 
> rom:
>         cd cmd; $(MAKE) objects
>         cd init; $(MAKE) objects
>         cd lib; $(MAKE) objects
>         cd cli; $(MAKE) objects
>         cd qsm; $(MAKE) objects
>         cd sys; $(MAKE) objects
> 
>         $(CC) $(CFLAGS) -v --pipe -B$(ROM_LIBPATH) \
>         --specs $(ROM_LIBPATH)/bsp_specs \
>         -o rom.o \
>         $(OBJECTS) \
>         $(LFLAGS) -L $(ROM_LIBPATH) \
>         -Xlinker -Map -Xlinker lz120_ROM.map -Xlinker --cref
>         m68k-rtems-objcopy -O srec rom.o rom.s19
> 
> clean:
>         rm -f rom.s19 rom.map $(OBJECTS)
> 
> --------------------------------------------------------------------------
> 
> Makefile comments:
> 
>   The options are a combination of those I've used with this application
> under 4.0 and what are used when the sample applications are built.  I
> can't find any documentation for "--pipe" and I don't understand the
> purpose of "-B", nor do they have any effect on the result that I can
> tell.
> 
>   Something I don't understand from the sample applications build is
> the inclusion of a number of ".rel" files (i.e., <bsp>/lib/no-event.rel).
> Is there any reason I should link these into my application?  It seems to
> work just fine when references are resolved from the libraries.
> 
> --------------------------------------------------------------------------
> 
> Final link output:
> 
> m68k-rtems-gcc -qrtems -Wall -ansi -mcpu32 -Wno-unused -v --pipe -B/usr/local/rtems/lz120_ROM/lib \
>         --specs /usr/local/rtems/lz120_ROM/lib/bsp_specs \
> -o rom.o \
> cmd/adc.o cmd/baud.o cmd/bf.o cmd/dac.o cmd/go.o cmd/help.o cmd/led.o cmd/load.o cmd/md.o cmd/mm.o cmd/rev.o cmd/sc.o cmd/sine.o init/init.o lib/atolx.o lib/b_hatoi.o lib/checksum.o lib/inpstr.o lib/parse.o lib/prntln.o lib/read_record.o lib/s_hatoi.o lib/updcrc.o cli/cli.o qsm/qspi_init.o qsm/qspi_rd.o qsm/qspi_wr.o sys/sys_init.o sys/sys_sv.o \
> --pipe -qrtems -Wall -ansi -fasm -mcpu32 -Wno-unused -L /usr/local/rtems/lz120_ROM/lib \
> -Xlinker -Map -Xlinker lz120_ROM.map -Xlinker --cref
> Reading specs from /usr/local/rtems/lib/gcc-lib/m68k-rtems/2.95.2/specs
> Reading specs from /usr/local/rtems/lz120_ROM/lib/bsp_specs
> rename spec cpp to old_cpp
> rename spec lib to old_lib
> rename spec endfile to old_endfile
> rename spec startfile to old_startfile
> rename spec link to old_link
> gcc version 2.95.2 19991024 (release)
>  /usr/local/rtems/lib/gcc-lib/m68k-rtems/2.95.2/collect2 -dc -dp -N -e start -o rom.o start.o /usr/local/rtems/lib/gcc-lib/m68k-rtems/2.95.2/crti.o /usr/local/rtems/lib/gcc-lib/m68k-rtems/2.95.2/crtbegin.o -L /usr/local/rtems/lz120_ROM/lib -L/usr/local/rtems/lz120_ROM/lib -L/usr/local/rtems/lib/gcc-lib/m68k-rtems/2.95.2/mcpu32 -L/usr/local/rtems/lib/gcc-lib/m68k-rtems/2.95.2 -L/usr/local/rtems/m68k-rtems/lib/mcpu32 -L/usr/local/rtems/m68k-rtems/lib cmd/adc.o cmd/baud.o cmd/bf.o cmd/dac.o cmd/go.o cmd/help.o cmd/led.o cmd/load.o cmd/md.o cmd/mm.o cmd/rev.o cmd/sc.o cmd/sine.o init/init.o lib/atolx.o lib/b_hatoi.o lib/checksum.o lib/inpstr.o lib/parse.o lib/prntln.o lib/read_record.o lib/s_hatoi.o lib/updcrc.o cli/cli.o qsm/qspi_init.o qsm/qspi_rd.o qsm/qspi_wr.o sys/sys_init.o sys/sys_sv.o -Map lz120_ROM.map --cref -lgcc --start-group -lrtemsall -lc -lgcc --end-group -T linkcmds -lgcc /usr/local/rtems/lib/gcc-lib/m68k-rtems/2.95.2/crtend.o /usr/local/rtems/lib/gcc-lib/m68k-rtem!
> !
> s/2.95.2/crtn.o
> /usr/local/rtems/m68k-rtems/bin/ld: cannot open start.o: No such file or directory
> collect2: ld returned 1 exit status
> m68k-rtems-gcc: file path prefix `/usr/local/rtems/lz120_ROM/lib' never used
> make: *** [rom] Error 1
> 
> --------------------------------------------------------------------------
> 
>   The "file path prefix never used" warning is apparently related to
> the "-B" option, as it goes away if that option is removed.  If I put
> "start.o" in the build directory, I get a working binary.
> 
>   Any suggestions?
> 
>                                         -- MC --

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