• No results found

Building GNU for ColdFire. The GNU Cross-compiler for ColdFire 5200 Series Targets Hosted on Windows

N/A
N/A
Protected

Academic year: 2021

Share "Building GNU for ColdFire. The GNU Cross-compiler for ColdFire 5200 Series Targets Hosted on Windows"

Copied!
10
0
0

Loading.... (view fulltext now)

Full text

(1)

Building GNU for ColdFire

The GNU Cross-compiler

for

ColdFire 5200 Series Targets

Hosted on Windows

PKGCF PRO includes a pre-built set of GNU software; for advanced users, it is possible to build the same GNU software from source code. This document outlines one method for building a GNU cross compiler from source code. The method will produce a set of GNU tools that will run on a Windows host and produce code for ColdFire targets. This method utilizes the following software components running under Windows 2000:

Cygwin: UNIX environment for Windows, Cygwin DLL version 1.5.5-1 and Cygwin Setup version 2.416, which utilizes GCC 3.3.1

GCC 2.95.3: GNU C compiler GCC 3.3.1: GNU C compiler Binutils 2.10: GNU binary utilities Binutils 2.13.90: GNU binary utilities Newlib 1.9.0: Redhat C target library

Mingw Runtime 3.2: Minimalist GNU for Windows runtime library Win32 API 2.4: Minimalist GNU for Windows Win32 runtime library GCC ColdFire Patches 20010415: ColdFire 5200 patches from

(2)

Installing Cygwin

Install Cygwin prior to building the GNU tool set. Download the Cygwin installer from the website:

http://sources.redhat.com/cygwin/

This build example refers to the Cygwin DLL version 1.5.5-1 and Cygwin Setup version 2.416, which utilizes GCC 3.3.1.

If another installation of Cygwin exists on the same host, consider uninstalling the existing version. If running several installations of Cygwin, be sure to understand the implications of this before attempting setup. See the Cygwin documentation, available on the web, regarding mount points and paths.

Run the Cygwin installer. Select "Install from Internet", then select a root installation directory. For this example, the root directory is:

C:\pemicro\pkg5272C3z

When prompted, select any download site. A list of application groups should appear in a dialog box. To ensure a successful GNU build, it is crucial that all the necessary Cygwin software is downloaded. For this installation, the following software groups are selected:

Admin Archive Base Devel Interpreters Libs Shells System Text Utils

The above software groups should be set to "Install". Leave the remaining groups at "Default". Complete the installation procedure.

(3)

Configuring Cygwin

For detailed information regarding Cygwin configuration and paths, see the Cygwin manual found on the website above.

Check that the Cygwin mount points are configured correctly. In this example, the root / should point to C:\pemicro\pkg5272C3z. Use the commands "mount" and "umount" to change the Cygwin mount table, if necessary.

The Cygwin PATH environment variable should reflect the executable path search order for Cygwin. For this example, our native Cygwin applications are located in C:\pemicro\pkg5272C3z\bin, which translates to the Cygwin path /bin.

However, the ColdFire cross-compiler tools will reside at a different location. We will produce three unique sets of cross-compiling tools:

C:\pemicro\pkg5272C3z\usr\local1\bin which translates to the Cygwin path /usr/local1/bin

This directory will contain the GNU tools for a Cygwin host (i686-pc-cygwin) and Windows target (i386-mingw32).

C:\pemicro\pkg5272C3z\usr\local2\bin which translates to the Cygwin path /usr/local2/bin

This directory will contain the GNU tools for a Cywin host (i686-pc-cygwin) and ColdFire target (m68k-elf).

C:\pemicro\pkg5272C3z\usr\local3\bin which translates to the Cygwin path /usr/local3/bin

This directory will contain the GNU tools for a Windows host (i386-mingw32) host and ColdFire target (m68k-elf).

In the directory C:\pemicro\pkg5272C3z\etc, change the file named profile (or profile.default). Change the value of the PATH variable, defined at the top of the file:

(4)

This will provide Cygwin with the proper search order for the GNU executable files.

Downloading Source

Download the following source code packages from the web: Binutils version 2.10 http://sources.redhat.com/binutils/ Binutils version 2.13.90 http://sources.redhat.com/binutils/ GCC version 2.95.3 http://gcc.gnu.org/ GCC version 3.3.1

Download the following archives: gcc-core-3.3.1-20030804-1-src gcc-g++-3.3.1-20030804-1-src gcc-testsuite-3.3.1-20030804-1-src http://www.mingw.org/ Newlib version 1.9.0 http://sources.redhat.com/newlib/

GNU ColdFire Patches version 20010415

http://fiddes.net/coldfire/

Mingw32 Runtime Libraries version 3.2

http://www.mingw.org/

Win32 Runtime Libraries for Mingw32 version 2.4

http://www.mingw.org/

Extracting the Source Code

In the directory C:\pemicro\pkg5272C3z, the root / directory for Cygwin, launch cygwin.bat, which opens a UNIX bash shell. The default home directory for this

(5)

example is /home/Administrator. Place all source code archives into this directory, C:\pemicro\pkgMPC555z\home\Administrator.

Extract the source code using a utility such as gunzip. For example, if the archive files are in the format .tar.gz, use this command to extract binutils 2.10:

gunzip c binutils2.10.tar.gz | tar xvf

-This will create the directory /home/Administrator/binutils-2.10.

Using this syntax, extract the following archives into the current directory /home/Administrator:

binutils-2.13.90 gcc-2.95.3 gcc-3.3.1 newlib-1.9.0

gcc-m68k-source-r7-20010415-no-gnu-source (ColdFire patches)

Note that for gcc-3.3.1, the following archives must be extracted to the same directory:

gcc-core-3.3.1-20030804-1-src gcc-g++-3.3.1-20030804-1-src gcc-testsuite-3.3.1-20030804-1-src

Create four additional empty directories in the current directory /home/Administrator: build-binutils-2.10-A build-binutils-2.10-B build-binutils-2.13.90 build-gcc-2.95.3-A build-gcc-2.95.3-B build-gcc-3.3.1

Installing Supplemental Libraries

(6)

The directory /usr/local1 will contain the cross-compiler that will execute under Cygwin (i686-pc-cygwin) and produce target code for Windows (i386-mingw32). Install the Mingw32 Runtime Libraries and the Win32 Runtime Libraries for Mingw32 using these commands:

cd /usr/local1/i386-mingw32

gzip dc "/home/Administrator/mingwruntime3.2.tar.gz" | tar xf gzip dc "/home/Administrator/w32api2.4.tar.gz" | tar xf

-Building Binutils 2.13.90 for a Cygwin Host (i686-pc-cygwin) and a Windows (i386-mingw32) Target

Change directories to /home/Administrator/build-binutils-2.13.90. Issue these commands:

/home/Administrator/binutils-2.13.90/configure --disable-nls target=i386-mingw32 host=i686-pc-cygwin prefix=/usr/local1 with-gcc with-gnu-as --with-gnu-ld --disable-shared

make "LDFLAGS=-s" "CFLAGS=-O2 -g0" make install

Building GCC 3.3.1 for a Cygwin Host (i686-pc-cygwin) and a Windows Target (i386-mingw32)

Change directories to /home/Administrator/build-gcc-3.3.1. Issue these commands:

/home/Administrator/gcc-3.3.1/configure with-gcc with-gnu-ld with-gnu-as --target=i386-mingw32 --host=i686-pc-cygwin --prefix=/usr/local1 --enable-threads disable-nls enable-languages=c,c++ disable-win32-registry disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter

--enable-hash-synchronization --without-newlib

make "CFLAGS=-O2" "GCJFLAGS=-O2" "LDFLAGS=-s -Wl,--stack=0x00800000" DEBUG_FLAGS=-g0 2>err.log

(7)

make install

Patching the Source Code for Binutils 2.10, GCC 2.95.3, and Newlib 1.9.0

Patch the source code using the following commands: cd /home/Administrator/binutils-2.10 patch -p1 < /home/Administrator/gcc-m68k-source-r7-20010415-no-gnu-source/binutils-2.10-coldfire-cpushl.diff patch -p1 < /home/Administrator/gcc-m68k-source-r7-20010415-no-gnu-source/binutils-2.10-coldfire-fixes.diff cd /home/Administrator/gcc-2.95.3 patch -p1 < /home/Administrator/gcc-m68k-source-r7-20010415-no-gnu-source/gcc-2.95.3-coldfire-alignment.diff patch -p1 < /home/Administrator/gcc-m68k-source-r7-20010415-no-gnu-source/gcc-2.95.3-coldfire-epilogue-fix.diff patch -p1 < /home/Administrator/gcc-m68k-source-r7-20010415-no-gnu-source/gcc-2.95.3-coldfire-hwdiv.diff patch -p1 < /home/Administrator/gcc-m68k-source-r7-20010415-no-gnu-source/gcc-2.95.3-coldfire-longmul.diff patch -p1 < /home/Administrator/gcc-m68k-source-r7-20010415-no-gnu-source/gcc-2.95.3-coldfire-version-message.diff patch -p1 < /home/Administrator/gcc-m68k-source-r7-20010415-no-gnu-source/gcc-2.95.3-interrupt-attribute-20010127.diff cd /home/Administrator/newlib-1.9.0 patch -p1 <

(8)

/home/Administrator/gcc-m68k-source-r7-20010415-no-gnu-Remove the following directories with these commands: cd /home/Administrator/gcc-2.95.3 rm -Rf gcc/f rm -Rf gcc/ch rm -Rf gcc/objc rm -Rf gcc/java rm -Rf libchill rm -Rf libf2c rm -Rf libobjc

Create symlinks using these commands in the current directory, /home/Administrator/gcc-2.95.3:

ln -s /home/Administrator/newlib-1.9.0/newlib. ln -s /home/Administrator/newlib-1.9.0/libgloss.

Issue these commands in the current directory, /home/Administrator/gcc-2.95.3: mv 2.95.3/texinfo

/home/Administrator/gcc-2.95.3/old.texinfo

Building Binutils 2.10 for a Cywin Host (i686-pc-cygwin) and a ColdFire Target (m68k-elf)

Change directories to /home/Administrator/build-binutils-2.10-A. Issue these commands:

/home/Administrator/binutils-2.10/configure --target=m68k-elf --host=i686-pc-cygwin --prefix=/usr/local2

make

make install

Building GCC 2.95.3 and Newlib 1.90 for a Cywin Host (i686-pc-cygwin) and a ColdFire Target (m68k-elf)

Change directories to /home/Administrator/build-gcc-2.95.3-A. Issue these commands:

(9)

/home/Administrator/gcc-2.95.3/configure --target=m68k-elf --host=i686-pc-cygwin --prefix=/usr/local2 --with-included-gettext --with-newlib

make

make install

Building Binutils 2.10 for a Windows Host (i386-mingw32) and a ColdFire Target (m68k-elf)

Change directories to /home/Administrator/build-binutils-2.10-B. Issue these commands:

/home/Administrator/binutils-2.10/configure build=i686-pc-cygwin --target=m68k-elf --host=i386-mingw32 --prefix=/usr/local3

make

make install

Building GCC 2.95.3 and Newlib 1.90 for a Windows Host (i386-mingw32) and a ColdFire Target (m68k-elf)

Change directories to /home/Administrator/build-gcc-2.95.3-B. Issue these commands:

/home/Administrator/gcc-2.95.3/configure --build=i686-pc-cygwin --target=m68k-elf --host=i386-mingw32 --prefix=/usr/local3 included-gettext

--with-newlib

Edit the file /home/Administrator/build-gcc-2.95.3-B/gcc/Makefile. Replace the source line

USE_COLLECT2 = collect2$(exeext) with

(10)

From the directory /home/Administrator/build-gcc-2.95.3-B, issue the following commands:

make

make install

The Windows GNU tools for ColdFire now reside at /usr/local3.

Visit us on the web: www.pemicro.com

References

Related documents

these indicators were classified as: 1) process indicators (incidence of falls of the patient, incidence of pressure ulcers, incidence of phlebitis, incidence of non-compliance

It showed that economic research addresses many important and relevant aspects concerning our view of consumer behaviour, uses innovative econometric techniques to analyse

chemistry or any other discipline that incorporate all of the latent constructs to be tested herein. A priori path models were based on theoretical relationships among the

In general, if a tax-exempt entity, or tax-exempt controlled entity, is a partner in a partnership, its proportionate share of the property, equal to its highest share of

The approach used and the results gained in the CarOLO project show that au- tonomous driving is still a few years ahead, but also that efficient development of complex software

Curve fit for job performance and job satisfaction further confirms the positive linear relationship between job satisfaction and job performance of the sailors in

These key recommendations are: (1) investigation of barriers into green practices based on the findings in this thesis, and into solutions to those barriers; (2) more

Comparing with mapping heuristic, SAT solver achieved a significant improvement in hardware fan-out, target- ing larger overlay and reducing the number of re-configurations in 75%