[GNU M68HC11 HOME]

GCC 68HC11 & 68HC12 Sources Installation

General | From Sources | From CVS | GNU/Linux (RPM) | Windows (ZIP)


Overview
Compiler
Documentation
Examples
Misc
Help
IDE & Tools

Download
Install

Links
Projects






This section explains how you can compile the GNU Binutils, the GNU Compiler Collection, the GNU Debugger and the C library for 68HC11 & 68HC12. You should follow the steps indicated here in the same order.

The GNU development chain can work with 68HC11 and 68HC12 micro-controllers as target. You can select the target cpu with some option that you pass to GCC. A default target cpu exist and corresponds to the target you have specified during the configuration of the different packages.

The choice you make on the target cpu for the configuration has an importance only for the selection of the default target cpu. All packages must be configured with the same target cpu.

1. Compiling GNU Binutils

The 68HC1x port is available for GNU Binutils 2.11. You need to get the following files:

1.1 Installation of the Sources

Once you have the file listed in previous section, type the following command:

   gzip -d binutils-2.11.2-m68hc1x-20011014.diffs.gz
   tar xvzf binutils-2.11.2.tar.gz
   mv binutils-2.11.2 binutils-2.11.2-m68hc1x
   cd binutils-2.11.2-m68hc1x
   patch -p1 < ../binutils-2.11.2-m68hc1x-20011014.diffs
 
Note:The patch improves the documentation and fixes static C++ constructor/destructors. It is not mandatory.

1.2 Configuration and Build

When you build the GNU Binutils, you will get the support for 68HC11 and 68HC12 at the same time. The assembler and linker have a default cpu target based on the option you used during configuration. Depending on what is your preferred target, choose one of the following commands to configure the GNU Binutils:

  • For 68HC11:
      cd binutils-2.11.2-m68hc1x
      sh ./configure --target=m6811-elf \
             --program-prefix=m6811-elf-
       
  • For 68HC12:
      cd binutils-2.11.2-m68hc1x
      sh ./configure --target=m6812-elf \
    	--program-prefix=m6812-elf-
       
Then, build everything:
   make
 
This will create: ld, as, ar, ranlib and many other tools.

Typing make install will install the binutils files:

  make install
You must install the binutils before building GCC.

2. Compiling GCC

The 68HC1x port is available for GCC 2.95.3 or GCC 3.0.1. The 68HC11/68HC12 port is integrated in GCC 3.0.1 but a patch is still necessary to fix some problems.

If you want to use GCC 2.95 compiler, you need to get the following files:

And if you want to use GCC 3.0.1 compiler, check out the following:

GCC comes with a C, C++, Objective C, Chill, Fortran and Java compiler. You'll get the cross compiler for all these languages. However, only the C compiler was really ported at this time. The C++ compiler is known to work a little. Other compilers are not checked at all.

Before compiling GCC, you need to compile and install the GNU Binutils for the Motorola 68HC11 or 68HC12. Refer to Compiling GNU Binutils. The target assembler for the port is gas.

There is no requirement concerning the host.

2.1 Installation of the Patch

Once you have the files listed in previous section, type the following commands:

   gzip -d gcc-2.95.3-m68hc1x-20010922.diffs.gz
   tar xvzf gcc-2.95.3.tar.gz
   mv gcc-2.95.2 gcc-2.95.3-m68hc1x
   cd gcc-2.95.3-m68hc1x
   patch -p1 < ../gcc-2.95.3-m68hc1x-20010922.diffs
 

or

   gzip -d gcc-3.0.1-m68hc1x-20010904.diffs.gz
   tar xvzf gcc-3.0.1.tar.gz
   mv gcc-3.0.1 gcc-3.0.1-m68hc1x
   cd gcc-3.0.1-m68hc1x
   patch -p1 < ../gcc-3.0.1-m68hc1x-20010904.diffs
 

2.2 Configuration and Build

To configure GCC, you must use the same option you have used during configuration of the GNU Binutils. You can configure for a 68HC11 or for a 68HC12 target but you will always get the support for both micro-controllers at the same time.

  • For a 68HC11:
       sh ./configure --target=m6811-elf \
    	--program-prefix=m6811-elf-
     
  • For a 68HC12:
       sh ./configure --target=m6812-elf \
    	--program-prefix=m6812-elf-
     
Then, build everything with:
  make
This will create: xgcc, cpp, cc1 and libgcc.a (as well as many other stuff). It is probably important to specify the same program-prefix that you specified for the GNU binutils configuration. Otherwise, the generation of the libgcc.a library will probably fail.

Note: You must have built and installed the GNU binutils for 68HC11 or 68HC12. Otherwise, the generation of the libgcc.a support library will fail.

Move to the gcc subdirectory and type make install to install the compiler files. They are normally installed under /usr/local/bin, and /usr/local/lib/gcc-lib/m6811-elf or /usr/local/lib/gcc-lib/m6812-elf. The GNU binutils are assumed to be installed in /usr/local/m6811-elf or /usr/local/m6812-elf. Note that, these installation directories depend on the options you have specified to configure.

  cd gcc
  make install

3. Compiling GDB

The 68HC11/68HC12 port is available for GDB 5.0. You need to get the following files:

GDB sources: gdb-5.0.tar.gz on prep.ai.mit.edu.

M68HC11 port (20011014): gdb-5.0-m68hc1x-20011014.diffs.gz

3.1 Installation of the Patch

Once you have the files listed in previous section, type the following commands:

   gzip -d gdb-5.0-m68hc1x-20011014.diffs.gz
   tar xvzf gdb-5.0.tar.gz
   mv gdb-5.0 gdb-5.0-m68hc1x
   cd gdb-5.0-m68hc1x
   patch -p1 < ../gdb-5.0-m68hc1x-20011014.diffs
 

3.2 Configuration and Build

To configure and build GDB for 68HC11/68HC12, you can do:

   sh ./configure --target=m6811-elf \
	--program-prefix=m6811-elf-
   make
 
Typing make install will install everything. It's not necessary to install to check or use GDB.
  make install
This will install m6811-elf-gdb and m6811-elf-run in the /usr/local/bin directory (by default).

Note: Gdb recognizes automatically when the program is for a 68HC11 or for a 68HC12. The simulator is also configured automatically according to the program file (ELF file).

4. Compiling NewLib

The 68HC1x port is available for NEWLIB 1.9.0. You need to get the following files:

Newlib sources: newlib-1.9.0.tar.gz

M68HC1x port (20010929): newlib-1.9.0-m68hc1x-20010929.diffs.gz

Before compiling NEWLIB, you need to get and install:

4.1 Installation of the Patch

Once you have the files listed in previous section, type the following commands:

   gzip -d newlib-1.9.0-m68hc1x-20010929.diffs.gz
   tar xvzf newlib-1.9.0.tar.gz
   mv newlib-1.9.0 newlib-1.9.0-m68hc1x
   cd newlib-1.9.0-m68hc1x
   patch -p1 < ../newlib-1.9.0-m68hc1x-20010929.diffs
 

4.2 Configuration and Build

The NEWLIB 1.9.0 must be built in a separate directory from the sources. Create such directory before configuring and building NEWLIB. For example, you can type the following commands:

   cd ..
   mkdir build-newlib
   cd build-newlib
   sh ../newlib-1.9.0-m68hc1x/configure \
	--target=m6811-elf --program-prefix=m6811-elf-
   make CFLAGS="-g -Os -Wall"
 

This will create a sub-directory m68hc11-elf that will contain the libc, libm and libbcc libraries. These libraries are compiled several times so that you will get 2 sets of 4 versions of them. One set for 68HC11 and one set for 68HC12, each set being composed of libraries compiled for:

  • 32-bit integers, 64-bit double
  • 32-bit integers, 32-bit double (-fshort-double)
  • 16-bit integers, 64-bit double (-mshort)
  • 16-bit integers, 32-bit double (-mshort -fshort-double)

Note: If you don't specify the CFLAGS options at make time, the default makefile will use -g -O2 -W -Wall. You can also avoid the support for source level debugging by using: CFLAGS="-Os -Wall".

Do not pass any -mshort -m68hc11 -m68hc12 or -fshort-double option because this will break the multi-lib support.

Typing make install will install the libraries and the includes in /usr/local/m6811-elf/lib and in /usr/local/m6811-elf/include

[GNU M68HC11 HOME]
General | From Sources | From CVS | GNU/Linux (RPM) | Windows (ZIP)

    Last modified,
    Oct 14, 2001
[ Copying ]     [ Feedback to Stephane.Carrez@worldnet.fr ]