From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21253 invoked by alias); 25 Jun 2002 22:50:30 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 21198 invoked from network); 25 Jun 2002 22:50:25 -0000 Received: from unknown (HELO siaag2ab.compuserve.com) (149.174.40.132) by sources.redhat.com with SMTP; 25 Jun 2002 22:50:25 -0000 Received: (from mailgate@localhost) by siaag2ab.compuserve.com (8.9.3/8.9.3/SUN-1.12) id SAA19226; Tue, 25 Jun 2002 18:50:23 -0400 (EDT) Date: Tue, 25 Jun 2002 15:50:00 -0000 From: Mark Butcher Subject: Tutorial 4 - Mcore script To: gcc Cc: gcc-help Message-ID: <200206251848_MC3-1-3C8-3F1C@compuserve.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: inline X-SW-Source: 2002-06/txt/msg00218.txt.bz2 # Script file to build the c and c++ compiler for the following processor: MCORE-ELF # Requirements: # Windows PC with cygwin installed (options gcc and binutils must have been installed - not default !) # Newest version of binutils (eg. binutils-2.12) # Newest version of the gcc compiler (full edition) (eg. gcc-3.1) # Newest version of Newlib (eg. newlib-1.10.0) # Where to put the things # Use the following directory structure # cygwin/usr/local/src/gnu - /src/gnu will have to be created by yourself # put the sources in cygwin/tmp (eg. gcc-3.1.tar.gz [compressed archive]) # This script doesn't expand the sources so do this before starting as follows: # Change to the directory cygwin/usr/local/src/gnu in the cygwin bash shell - this can be done by # starting the cygwin application and typing cd /usr/local/src/gnu or else by setting a path to our source # directory and using a short-cut [type "src_root=3D/usr/local/src/gnu" a= nd afterwards "cd $src_root"] # Expand the sources to our source directory using # tar zxf /tmp/gcc-3.1.tar.gz # tar zxf /tmp/binutils-2.12.tar.gz # and # tar zxf /tmp/newlib-1.10.0.tar.gz # # After the expansion and extraction has completed, the sources will appear as directories in our=20 # source root directory (cygwin/usr/local/src/gnu or $src_root) # Once the sources are in place the build of the tools, the libraries and finally the compilers can begin # In the source root directory ($src_root) the required steps can be started by running this script # Step 1: Compile the tools required for building a basic compiler for the target (newest version of binutils especially for the targt) # Step 2: Build a simple compiler for the target without any libraries # Step 3: Build C libraries (newlib). The simple compiler created in step 2 is used here # Step 4: Build the final compilers. This requires the libraries from step 3, which were build with the simple compiler which didn't # Run the build(s) with "./build-mcore.sh" from the $src_root # 0. Set up some environment variables to simplify the commands HOST=3Di686-pc-cygwin BUILD=3Di686-pc-cygwin TARGET=3Dmcore-elf PREFIX=3D/usr/local SRC_ROOT=3D/usr/local/src/gnu BINUTILS=3Dbinutils-2.12 GCCVERSION=3Dgcc-3.1 LIBVERSION=3Dnewlib-1.10.0 # 00. Create the BUILD directory with the required sub directories echo echo Creating directories: echo " ${PREFIX}/${TARGET}" echo " ${SRC_ROOT}/BUILD/binutils" echo " ${SRC_ROOT}/BUILD/gcc" echo " ${SRC_ROOT}/BUILD/newlib" mkdir -p ${PREFIX}/${TARGET} mkdir -p ${SRC_ROOT}/BUILD/binutils mkdir -p ${SRC_ROOT}/BUILD/littlegcc mkdir -p ${SRC_ROOT}/BUILD/gcc mkdir -p ${SRC_ROOT}/BUILD/newlib # 1. Build the binutils (for our target) echo Moving to directory: echo " ${SRC_ROOT}/BUILD/binutils" echo Configuring for: echo " --target=3D${TARGET} --host=3D${HOST} --build=3D${BUILD}" cd ${SRC_ROOT}/BUILD/binutils ${SRC_ROOT}/${BINUTILS}/configure \ --with-included-gettext \ --target=3D${TARGET} --host=3D${HOST} --build=3D${BUILD} \ --prefix=3D${PREFIX} -v > config.log 2>&1 echo Now making binutils: make > make.log 2>&1 echo Now Installing binutils: make install > install.log 2>&1 echo Adding path: echo " ${PREFIX}/bin:${PATH}" =20=20 export PATH=3D${PREFIX}/bin:${PATH} # A number of tools have now been prepared and have been installed for use by subsequent steps # in the directory ${PREFIX}/bin (/usr/local/bin) # These tools include assembler, linker and others - # mcore-elf-addr2line.exe # mcore-elf-ar.exe # mcore-elf-as.exe # mcore-elf-c++filt.exe # mcore-elf-dlltool.exe # mcore-elf-gasp.exe # mcore-elf-ld.exe # mcore-elf-nm.exe # mcore-elf-objcopy.exe # mcore-elf-objdump.exe # mcore-elf-ranlib.exe # mcore-elf-readelf.exe # mcore-elf-size.exe # mcore-elf-strings.exe # mcore-elf-strip.exe # 2. Build a simple c compiler (for our target) echo Moving to directory: echo " ${SRC_ROOT}/BUILD/littlegcc" echo Configuring for: echo " --target=3D${TARGET} --host=3D${HOST} --build=3D${BUILD}" cd ${SRC_ROOT}/BUILD/littlegcc ${SRC_ROOT}/${GCCVERSION}/configure \ --target=3D${TARGET} --host=3D${HOST} --prefix=3D${PREFIX} \ --enable-languages=3Dc \ --without-headers --with-newlib --disable-shared --with-local-prefix=3D${PREFIX}/${TARGET} -v \ > config.log 2>&1 echo Building simple c-compiler: make > make.log 2>&1 echo Installing simple c-compiler: make install > install.log 2>&1 # In the directory ${PREFIX}/bin (/usr/local/bin) # are now additionally the following tools # mcore-elf-cpp.exe # mcore-elf-gcc.exe # mcore-elf-gccbug # mcore-elf-gcov.exe # 3. Build the C-libraries (for our target) which will be required for building the full-blown compiler echo Moving to directory: echo " ${SRC_ROOT}/BUILD/newlib" cd ${SRC_ROOT}/BUILD/newlib echo Configuring for: echo " --target=3D${TARGET} --host=3D${HOST} --build=3D${BUILD}" ${SRC_ROOT}/${LIBVERSION}/configure \ --target=3D${TARGET} --host=3D${HOST} --build=3D${BUILD} --prefix=3D${PREFIX} -v \ > config.log 2>&1 echo Building NewLib: make > make.log 2>&1 echo Installing NewLib: make install > install.log 2>&1 # 4. Build the full-blown compiler (for our target) echo Moving to directory: echo " ${SRC_ROOT}/BUILD/gcc" cd ${SRC_ROOT}/BUILD/gcc echo Configuring for: echo " --target=3D${TARGET} --host=3D${HOST} --build=3D${BUILD}" ${SRC_ROOT}/${GCCVERSION}/configure \ --target=3D${TARGET} --host=3D${HOST} --build=3D${BUILD} --prefix=3D${PREFIX} \ --enable-languages=3Dc,c++ --with-newlib --with-local-prefix=3D${PREFIX}/${TARGET} -v \ > config.log 2>&1 echo Building Full GCC: make > make.log 2>&1 echo Installing Full GCC: make install > install.log 2>&1 exit