[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [microblaze-uclinux] C++/STLport



Hi Chris,

Chris Madill wrote:

> I've noticed a few people on the list over the past year or so talking 
> about attempts to get C++/STLport running. Just wondering if anyone has 
> yet been able to do it.

I think c++ support on microblaze generally is still pretty limited, and 
under mb-uclinux effectively non-existent.  It's just a question of 
demand - obviously Xilinx haven't seen enough demand for microblaze 
support to really nail it down hard.  Certainly on the uClinux side I 
haven't seen enough interest to justify spending serious time on it.

Perhaps you are the right person for the job? :)

> Also, there was mention of a build_toolchain script. Is it still in 
> existance?

See the attached - it's experimental, but should be reasonably 
self-explanatory.

Regards,

John

#!/bin/sh

# Routine to handle building GNU newlib

build_libs() {
    echo -n $"Building libs"
    cd ${EDKSRC}/newlib/microblaze
    
         # first we build libc and libm.
         # there are 4 combinations for various combos of hard and soft
         # multipliers and barrel shifters
         # Make the soft-mult, soft-shift versions
    make clean
    make EXTRA_CFLAGS="-mxl-soft-mul" MULT=_soft
    
         # Make the soft-mult, hard-shift versions
    make clean
    make EXTRA_CFLAGS="-mxl-soft-mul -mxl-barrel-shift" MULT=_soft SHIFT=_shift
    
         # Make the hard-mult, hard-shift versions
    make clean
    make EXTRA_CFLAGS="-mno-xl-soft-mul" MULT=_hard
    
         # Make the hard-mult, hard-shift versions
    make clean
    make EXTRA_CFLAGS="-mno-xl-soft-mul -mxl-barrel-shift" MULT=_hard SHIFT=_shift
         # copy the libc_XX.a and libm_XX.a to where they belong
    cp libc_*.a libm_*.a ${RELDIR}/microblaze/lib
    cp libc_soft.a ${RELDIR}/microblaze/lib/libc.a
    cp libm_soft.a ${RELDIR}/microblaze/lib/libm.a
    
         # copy the C runtime startup libraries
    cp libgloss/microblaze/crt*.o ${RELDIR}/microblaze/lib
}

# set up directories
setup_directories() {
	# where is the source
	export EDKSRC=`pwd`

	# release (target) directory
	if [ ! $RELDIR ] 
	then
		export RELDIR=${EDKSRC}/reldir
	fi

	# where can we copy existing header files from?
	if [ ! $HEADERDIR ] 
	then
		export HEADERDIR=${EDKSRC}/mb-gcc-headers
	fi

	# make release directory
	mkdir -p ${RELDIR}
}

# first build binutils:
build_binutils() {
	cd ${EDKSRC}/binutils/microblaze
	# build in a different directory than the sources 
	# - easy to make clean distribution
	mkdir build
	cd build
	../configure --target=microblaze --prefix=${RELDIR}
	make all CFLAGS="-O2 -g -DMICROBLAZE -DEDK" CXXFLAGS="-O2 -g -DMICROBLAZE -DEDK"
	make install

	# rename microblaze-as to mb-as
	#mv ${RELDIR}/bin/microblaze-as ${RELDIR}/bin/mb-as 
	#mv ${RELDIR}/bin/microblaze-ld ${RELDIR}/bin/mb-ld 
	#mv ${RELDIR}/bin/microblaze-ar ${RELDIR}/bin/mb-ar 
	#mv ${RELDIR}/bin/microblaze-ranlib ${RELDIR}/bin/mb-ranlib 
	#mv ${RELDIR}/bin/microblaze-nm ${RELDIR}/bin/mb-nm

	# add newly created binutils to the path
	# put it first, to preceded any older tools
	export PATH=${RELDIR}/bin/:${PATH}
}

# copy header files from install directory into new release directory
copy_headers() {
	if [ ! -d ${RELDIR}/microblaze/include/ ]
	then
    		mkdir -p ${RELDIR}/microblaze/include/
	fi
	cp -R ${HEADERDIR}/* ${RELDIR}/microblaze/include/

}

# build gcc
build_gcc () {
	echo "Building gcc"
	cd ${EDKSRC}/gcc
	# keep object files in differnt directory to avoid strange errors
	mkdir build
	cd build
	../configure --prefix=${RELDIR} --target=microblaze \
		--nfp -v --enable-languages="c++" --with-newlib
	make all CFLAGS="-O2 -g -DMICROBLAZE -DEDK" CXXFLAGS="-O2 -g -DMICROBLAZE -DEDK"
	make install
}

build_gdb() {
        echo "Building gdb"
        cd ${EDKSRC}/gdb/microblaze
	mkdir build
	cd build
        ../configure --target=microblaze --prefix=${RELDIR}
        make all CFLAGS="-O2 -g -DMICROBLAZE -DEDK" CXXFLAGS="-O2 -g -DMICROBLAZE -DEDK"
        make install
}


build_elf2flt() {
        echo -n $"Buildling elf2flt"
	cd ${EDKSRC}
	if [ -e elf2flt ]; then
		cd elf2flt
		if [ -e CVS ]; then
			cvs update
		fi
	else
		cvs -d:pserver:anonymous@cvs.uclinux.org:/var/cvs co elf2flt
	fi;
        cd ${EDKSRC}/elf2flt
	mkdir build
	cd build
	if [ -e Makefile ]; then
		make clean;
	fi
	# Get the bfd.h into somewhere we can find it
	# otherwise we pick up an old version in /usr/include - bad
	cp ${EDKSRC}/binutils/microblaze/build/bfd/bfd.h \
		${EDKSRC}/binutils/microblaze/include
        ../configure --target=microblaze --prefix=${RELDIR} \
		--with-libbfd=${RELDIR}/lib/libbfd.a \
		--with-libiberty=${RELDIR}/lib/libiberty.a \
		--with-bfd-include-dir=${EDKSRC}/binutils/microblaze/include
		#--with-bfd-include-dir=${RELDIR}/include
        make all 
        make install
}

build_genromfs() {
        echo -n $"Buildling genromfs"
        cd ${EDKSRC}
	if [ -e genromfs ]; then
		cd genromfs
		if [ -e CVS ]; then
			cvs update
		fi
	else
		cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/romfs co genromfs
	fi

	cd ${EDKSRC}/genromfs

        make
	cp ${EDKSRC}/genromfs/genromfs ${RELDIR}/bin
}

# need to rename these all as mb- for compatibility
# note we do cp, rather than mv, because, well, it's not as clean
# as it should be.  We come through leater and delete the 
# unneeded microblaze- files
rename_binaries() {
        cd ${RELDIR}/bin
        
        for f in microblaze-* ;
        do      
                ff="mb-`echo $f | cut -d '-' -f 2`";
                cp $f $ff;
        done
}

# remove microblaze- binaries (all have been renamed to mb-)
remove_long_binaries() {
        cd ${RELDIR}/bin
        
	rm microblaze-*
}

# turn on debugging
# set -x

ORIG_DIR=`pwd`

setup_directories
build_binutils
build_gcc
rename_binaries
#build_gdb
build_elf2flt
rename_binaries
build_genromfs
rename_binaries
remove_long_binaries
build_libs

cd ${ORIG_DIR}