This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: building cross-compiler for m68hc11/m68hc12


28.2.2012 17:38, Mihai Daniel OPREA kirjoitti:

I am trying to build gcc-4.3.2 as a cross compiler for the
Motorola m68hc11 target on a standard, clean installation
of Ubuntu 11.10 32-bit. I also want to build binutils (2.19)
so I included the binutils-2.19 directory (without stripping
the version from the name) inside the gcc-4.3.2 directory.

The aim in the FSF binutils and GCC sources is them being separate projects. Although having common subdirs like libiberty these aren't in-sync during some time period... So both should be built/bootstraped separately and later built/updated separately during the life-span of the cross toolchain. GDB is the third separately maintained component in a cross toolchain...

Of course one however uses a common '--prefix=$prefix' value
with all three, binutils, GCC and GDB, when configuring and
building and installing...

I have downloaded the source code for the MPFR, MPC and GMP
libs from gcc/gnu/org/pub/gcc/infrastructure and
included it in the gcc-4.3.2 directory in corresponding
directories (stripping the version number) so they are
built together with GCC and binutils.

This then is possible, excluding the binutils... With the "embedded targets" (no "native tools" for them) using the 'newlib' as the target C library is common. (The "native tools" use the "native C library" and crosstoolchains for these "system targets" use the C library taken from the target system.) So when also the target C library must be produced - GCC neither binutils will provide it - its sources can also be combined with the GCC sources and be built and installed during the GCC build.

../gcc-4.3.2/configure --prefix=/home/mihai/licenta \
--enable-languages=c --target=m68hc11

If you are going to produce also the target C library, you will need the newlib-<something> sources and copy or symlink the 'newlib' and 'libgloss' subdirs from them into the main GCC directory (like 'gcc-4.3.2/'. And need to add '--with-newlib' into your GCC configure.

I am not sure if the configure parameters are enough,
nor am I sure whether the name for the target is m68hc11
or some other variation: m68hc11-elf, m68hc11-linux
or m68hc1x.

If you search for 'm68hc11' in the 'gcc/config.gcc', you will see that there is only one target template catering 'm68hc11-*-*'. So your bare 'm68hc11' would be ok just as 'm68hc11-elf'. But the 'm68hc11-linux' would sound really absurd, do you really believe Linux some day being ported for the 8-bit m68hc11 ? Or at least for some 16-bit CPU :-)


Building the compiler with make fails with the infamous error:
"configure: error: cannot compute suffix of object files: cannot compile"
while in directory hcs12x/m68hc11/libgcc

The 'libgcc' is the GCC-helper library which includes all kind of conversion routines between integers and floats, basic soft-float arithmetic functions etc. Compiling it may use the target C headers if the '--with-newlib' isn't used in GCC configure. Generally the target headers should always be available during the GCC build, if not for any other purpose then at least for the 'fixinc' phase - fixing them to be suitable with the produced GCC...

Here is a fragment of the respective config.log:

configure:2376: /home/mihai/licenta/hcs12x/./gcc/xgcc \
-B/home/mihai/licenta/hcs12x/./gcc/

This is for the target binutils in $prefix/$target/bin :
-B/home/mihai/licenta/m68hc11/bin/

This is for the target libraries in $prefix/$target/lib :
-B/home/mihai/licenta/m68hc11/lib/

These are for the target headers in $prefix/$target/*include :
-isystem /home/mihai/licenta/m68hc11/include
-isystem /home/mihai/licenta/m68hc11/sys-include

Please ask someone else why there are two! My answer would be "because it is a 'feature' been always there!" Ok, old GCC docs will tell about "STANDARD_INCLUDE" and "SYSTEM_INCLUDE" directories in a native GCC, these are their equivalents in a cross GCC...

Any help is greatly appreciated, both with the issue at hand
(permission denied) as well as with potential omissions
/ mistakes I've surely made.

Please forget combining binutils and GCC sources but consider combining newlib sources with the GCC sources! Your $target is supported there :

[root@localhost src]# ls newlib-1.19.0/libgloss/m68hc11
aclocal.m4  configure.in  Makefile.in  sim-valid-m68hc11.ld  syscalls.c
configure   crt0.S        sci-inout.S  sim-valid-m68hc12.ld

And remember to add '--with-newlib' into your GCC configure
command...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]