(cvs head) RTEMS makefiles broken

Till Straumann strauman at slac.stanford.edu
Wed Mar 26 20:47:38 UTC 2008


Joel Sherrill wrote:
> Till Straumann wrote:
>> The (legacy) RTEMS makefile system seems to be broken on the cvs head.
>>
>>  - doesnt' work with multilibbed cpukit
>>   
> Give me a configure command and I will try it.
I'm not saying that RTEMS and the samples don't build but external
applications which use the RTEMS Makefiles (no autotools) won't find
cpukit includes nor libraries:

a) configure RTEMS:

   ../configure --enable-multilib --enable-rtemsbsp=psim 
--prefix=/opt/rtems/test --target=powerpc-rtems

b) build

c)  cp testsuites/samples/hello.c  ./
    cp testsuites/samples/system.h ./
    cp /opt/rtems/test/make/Templates/Makefile.leaf ./Makefile

d) edit makefile template

e) setenv RTEMS_MAKEFILE_PATH /opt/rtems/test/powerpc-rtems/psim

e) make

   tcsh> powerpc-rtems-gcc --pipe 
-B/opt/rtems/test/powerpc-rtems/psim/lib/ -specs bsp_specs -qrtems   -g 
-Wall  -O2 -g -fno-keep-inline-functions -g     -mcpu=603e  
-Dppc603e      -c   -o o-optimize/init.o init.c
In file included from init.c:24:
system.h:16:19: error: rtems.h: No such file or directory
In file included from init.c:24:


==> <rtems.h> not found because multilibbed cpukit headers live in 
/opt/rtems/test/powerpc-rtems/include

f) make XCFLAGS=-B/opt/rtems/test/powerpc-rtems

 make RTEMS_MAKEFILE_PATH=/opt/rtems/test/powerpc-rtems/psim -f 
Makefile.leaf XCFLAGS=-B/opt/rtems/test/powerpc-rtems powerpc-rtems-gcc 
--pipe -B/opt/rtems/test/powerpc-rtems/psim/lib/ -specs bsp_specs 
-qrtems   -g -Wall -B/opt/rtems/test/powerpc-rtems -O2 -g 
-fno-keep-inline-functions -g     -mcpu=603e  -Dppc603e      -c   -o 
o-optimize/init.o init.c
make: *** No rule to make target 
`/opt/rtems/test/powerpc-rtems/psim/lib/librtemscpu.a', needed by 
`o-optimize/init.exe'.  Stop.

==> bad dependency in Makefile.leaf: LINK_FILES variable lists 
$(PROJECT_RELEASE)/lib/librtemscpu$(LIBSUFFIX_VA)
    which expands to /opt/rtems/test/powerpc-rtems/psim/lib/librtemscpu.a

g) remove dependency on $(LINK_FILES) from Makefile.leaf (hack to be 
able to proceed)

   make XCFLAGS=-B/opt/rtems/test/powerpc-rtems


   test -d o-optimize || mkdir o-optimize
powerpc-rtems-gcc --pipe -B/opt/rtems/test/powerpc-rtems/psim/lib/ 
-specs bsp_specs -qrtems   -g -Wall -B/opt/rtems/test/powerpc-rtems -O2 
-g -fno-keep-inline-functions -g     -mcpu=603e  -Dppc603e      -c   -o 
o-optimize/init.o init.c
powerpc-rtems-gcc --pipe -B/opt/rtems/test/powerpc-rtems/psim/lib/ 
-specs bsp_specs -qrtems   -g -Wall -B/opt/rtems/test/powerpc-rtems -O2 
-g -fno-keep-inline-functions -g     -mcpu=603e  -Dppc603e      
-Wl,-Map,map  -mcpu=603e  -Dppc603e  -o o-optimize/init.exe  
o-optimize/init.o   
/opt/rtems/test/powerpc-rtems/psim/lib/no-barrier.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-dpmem.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-event.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-io.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-msg.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-mp.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-part.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-region.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-sem.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-signal.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-timer.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-rtmon.rel 
/opt/rtems/test/powerpc-rtems/psim/lib/no-ext.rel
/opt/rtems-head/host/i386_linux26/bin/../lib/gcc/powerpc-rtems/4.2.2/../../../../powerpc-rtems/bin/ld: 
cannot find -lrtemscpu
collect2: ld returned 1 exit status
make: *** [o-optimize/init.exe] Error 1


==> librtemscpu.a not found because multilibbed cpukit libraries live in 
/opt/rtems/test/powerpc-rtems/lib

 h) make XCFLAGS='-B/opt/rtems/test/powerpc-rtems 
-B/opt/rtems/test/powerpc-rtems/lib

==> Finally works. NOTE: library path MUST be given with -B -- otherwise 
the multilib subdir
    is not appended by gcc and you'd always get the default variant!

>>  - new definitions of 'make-exe' & friends in 'leaf.cfg' cannot be
>>    overridden by make/custom/<bsp>.cfg because Makefile.inc
>>    includes 'leaf.cfg' after $(RTEMS_CUSTOM)
>>
>>   
> Every example use of those Makefiles in CVS works with
> every BSP.  Cases which did not build for every BSP before
> this work was done now build and link.
>>  - same applies for the DOWNEXT - all BSPs end up with '.ralf'
>>
>>   
> Yes that was the point.  We have wanted to move more to
> autoconf/automake rules and this was a step.  There is
> now a distinction between the linked program file
> produced by the linking gcc step (.exe) and the program
> you download to the target (.ralf).
That is fine -- but I thought bsps should be able
to override default commands e.g., for make-exe
or 'bsp-post-link' (or even DOWNEXT e.g., in case
some exotic firmware bootloader expects a special extension)

Because 'leaf.cfg' is included after a BSP's custom/<bsp>.cfg
file the definitions in 'leaf.cfg' always take precedence.

Take e.g., the mvme2100 BSP. It's mvme2100.cfg defines
a bsp-post-link  command (objcopy -O binary ...) but
if I build the above example (using the same hacks) I get

powerpc-rtems-gcc --pipe -B/opt/rtems/test/powerpc-rtems/mvme2100/lib/ 
-specs bsp_specs -qrtems   -g -Wall -B/opt/rtems/test/powerpc-rtems 
-B/opt/rtems/test/powerpc-rtems/lib -O2 -g -mmultiple -mstring 
-mstrict-align -g     -mcpu=603e -Dmpc603e -Dppc603e      -Wl,-Map,map  
-mcpu=603e -Dmpc603e -Dppc603e   -o o-optimize/init.exe  
o-optimize/init.o   
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-barrier.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-dpmem.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-event.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-io.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-msg.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-mp.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-part.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-region.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-sem.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-signal.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-timer.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-rtmon.rel 
/opt/rtems/test/powerpc-rtems/mvme2100/lib/no-ext.rel
powerpc-rtems-nm -g -n o-optimize/init.exe > o-optimize/init.num
powerpc-rtems-size o-optimize/init.exe
   text    data     bss     dec     hex filename
 153389    7172   46517  207078   328e6 o-optimize/init.exe
cp o-optimize/init.exe o-optimize/init.ralf


I.e., the objcopy command has been overridden by 'cp'.

IMO, the

define xxx
endef

in leaf.cfg should be

ifndef xxx
define xxx
endef
endif

(likewise for DOWNEXT)

===> I maintain my claim that the makefiles are currently broken

-- T.
> Every BSP now uses the same
>
> .ralf - RTEMS Application Loadable File.  It was our
> nod to acknowledge Ralf.
>
> You download .ralf's to the target and use .exe's with
> gdb to get the symbols.
>
> By making the linking rules common across all BSPs, this
> opens the door for letting autoconf/make deal with it
> easier.
>> The last two problems could be fixed with the 'override' directive
>> but I don't think that's a desirable solution.
>>
>>   
> That shouldn't be needed.  You need to download .ralf's.
>
> --joel
>> -- Till
>>
>>   
>
>





More information about the users mailing list