To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.legosOpen lugnet.robotics.rcx.legos in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / legOS / 2866
2865  |  2867
Subject: 
Instructions for building DJGPP H8300 cross compiler
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sun, 29 Sep 2002 14:06:53 GMT
Viewed: 
2372 times
  
The following are instructions I am using for building the Hitachi H8300
cross compiler for the DJGPP environment.  Please read through the entire
message before proceeding.

Download the following DJGPP/GNU packages from www.delorie.com or one of its
mirror sites.  A complete listing of ftp sites can be found at
http://www.delorie.com/djgpp/zip-picker.html. I use
ftp://ftp.bu.edu/pub/mirrors/simtelnet/gnu/djgpp/.

unzip32.exe
v2\djdev203.zip
v2\faq230b.zip
v2\djcrx203.zip
v2gnu\bnu2121b.zip
v2gnu\gcc31b.zip
v2gnu\mak3791b.zip
v2gnu\txi42b.zip
v2gnu\fil316b.zip
v2gnu\shl2011b.zip
v2gnu\tar112ab.zip
v2gnu\gzip13b.zip
v2gnu\sed203b.zip
v2gnu\pat253b.zip
v2gnu\grep24b.zip
v2gnu\txt20b.zip
v2gnu\dif28b.zip
v2gnu\gtxt040b.zip
v2gnu\gpp31b.zip
v2gnu\bnu2121s.zip
v2gnu\gcc2952s.zip
v2gnu\gcc2952s2.zip

At the DOS prompt type the following

C:\> mkdir djgpp
C:\> cd djgpp
C:\DJGPP> unzip32 c:\temp\djdev203.zip
C:\DJGPP> unzip32 c:\temp\faq230b.zip
C:\DJGPP> unzip32 c:\temp\bnu2121b.zip
C:\DJGPP> unzip32 c:\temp\gcc31b.zip
C:\DJGPP> unzip32 c:\temp\mak3791b.zip
C:\DJGPP> unzip32 c:\temp\txi42b.zip
C:\DJGPP> unzip32 c:\temp\djcrx203.zip
C:\DJGPP> unzip32 c:\temp\fil316b.zip
C:\DJGPP> unzip32 c:\temp\shl2011b.zip
C:\DJGPP> unzip32 c:\temp\tar112ab.zip
C:\DJGPP> unzip32 c:\temp\gzip13b.zip
C:\DJGPP> unzip32 c:\temp\sed203b.zip
C:\DJGPP> unzip32 c:\temp\pat253b.zip
C:\DJGPP> unzip32 c:\temp\grep24b.zip
C:\DJGPP> unzip32 c:\temp\txt20b.zip
C:\DJGPP> unzip32 c:\temp\dif28b.zip
C:\DJGPP> unzip32 c:\temp\gtxt040b.zip
C:\DJGPP> unzip32 c:\temp\gpp31b.zip
C:\DJGPP> unzip32 c:\temp\bnu2121s.zip
C:\DJGPP> unzip32 c:\temp\gcc2952s.zip
C:\DJGPP> unzip32 c:\temp\gcc2952s2.zip

DJGPP port of GCC 3.1 has a know bug in it.  To correct for this problem
create file c:\DJGPP\gnu\gcc-3.1\djtypes.patch which contains the following
lines. NOTE: This patch is included at the end of the file
C:\DJGPP\gnu\gcc-3.1\readme.DJGPP.

--- include/sys/djtypes.h~1 Tue Dec 14 06:56:16 1999
+++ include/sys/djtypes.h Mon Feb  4 16:20:40 2002
@@ -12,7 +12,12 @@
#define __DJ_ssize_t typedef int ssize_t;
#define __DJ_time_t typedef unsigned int time_t;
#define __DJ_uid_t typedef int uid_t;
+
+#if __GNUC__>=3
+#define __DJ_va_list    typedef __builtin_va_list va_list;
+#else
#define __DJ_va_list typedef void *va_list;
+#endif

#if defined(__cplusplus) && ( (__GNUC_MINOR__ >= 8 && __GNUC__ == 2 ) ||
__GNUC__ >= 3 )
/* wchar_t is now a keyword in C++ */

To apply the patch type the following at the DOS prompt

C:\DJGPP> djgpp
C:\DJGPP> patch -p0 -i c:\DJGPP\gnu\gcc-3.1\djtypes.patch

To configure and build the binutils for the hitachi H8300 type the following
at the dos prompt

C:\DJGPP> cd gnu\binutl-2.121\build.djg
C:\DJGPP\gnu\binutl-2.121\build.djg> sh
djconfig.sh --target=h8300-hitachi-hms
C:\DJGPP\gnu\binutl-2.121\build.djg> make
C:\DJGPP\gnu\binutl-2.121\build.djg> make

FOR REASONS UNKOWN AT THIS POINT ONE MUST RESTART A NEW MS-DOS WINDOW OR
REINIATE make TO PROPERLY make THE MAKEFILE CREATED BY THE CONFIGURE STEP.
OTHERWISE THE FOLLOWING ERROR MIGHT APPEAR.

ERROR: (SHOWN AS FOLLOWS)
gcc -c -DCROSS_COMPILE -DIN_GCC    -O2 -g  -W -Wall  -DSTANDARD_INCLUDE_DIR=
\"\$
DJDIR/include\" -DSTANDARD_INCLUDE_COMPONENT=\"\"  -I. -I.. -I../../../gcc/f
-I.
./../../gcc/f/.. -I../../../gcc/f/../config -I../../../gcc/f/../../include
../..
/../gcc/f/com.c
In file included from ../../../gcc/f/com.c:198:
../../../gcc/f/com.h:145:4: #error Cannot find a suitable type for
FFECOM_f2cLON
GINT
../../../gcc/f/com.c: In function `ffecom_possible_partial_overlap_':
../../../gcc/f/com.c:1599: warning: unused parameter `expr2'
../../../gcc/f/com.c: In function `ffecom_init_0':
../../../gcc/f/com.c:12293: `FFECOM_f2cLONGINT' undeclared (first use in
this fu
nction)
../../../gcc/f/com.c:12293: (Each undeclared identifier is reported only
once
../../../gcc/f/com.c:12293: for each function it appears in.)
make.exe[2]: *** [com.o] Error 1
make.exe[2]: Leaving directory `c:/djgpp/gnu/gcc-2.952/build.djg/gcc/f'
make.exe[1]: *** [f771.exe] Error 2
make.exe[1]: Leaving directory `c:/djgpp/gnu/gcc-2.952/build.djg/gcc'
make.exe: *** [all-gcc] Error 2


To configure gcc I use the following script.  This script,
C:\DJGPP\gnu\gcc-2.952\build.djg\h8config.sh, is the djconfig.sh script from
bintutils-2.121 with a few minor modifications.  I had difficulty using the
djconfig.sh script for gcc-2.952.

#!/bin/sh
#
# This shell script is a wrapper to the main configure script when
# configuring GDB for DJGPP.  99% of it can also be used when
# configuring other GNU programs for DJGPP.
#
#=====================================================================
# Copyright 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
#
# Originally written by Robert Hoehne, revised by Eli Zaretskii.
#  This file is part of GDB.
#  Adapted for binutils by Andris Pavenis
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.  */
#=====================================================================
#
# Call this script like the main configure script with one exception.  If
you
# want to pass parameters to configure, you have to pass as the first
# argument the srcdir, even when it is `.' !!!!!
#
# First, undo any CDPATH settings; they will get in our way when we
# chdir to directories.
unset CDPATH

# Where are the sources? If you are used to having the sources
# in a separate directory and the objects in another, then set
# here the full path to the source directory and run this script
# in the directory where you want to build gdb!!
# You might give the source directory on commandline, but use
# then only forward slashes (/) in the directories. It should be
# an absolute path.

srcdir=..

# Now set the config shell. It is really needed, that the shell
# points to a shell with full path and also it must conatain the
# .exe suffix. I assume here, that bash is installed. If not,
# install it. Additionally, the pathname must not contain a
# drive letter, so use the /dev/x/foo format supported by versions
# of Bash 2.03 and later, and by all DJGPP programs compiled with
# v2.03 (or later) library.
export CONFIG_SHELL=/dev/env/DJDIR/bin/sh.exe

# force to have the ltmain.sh script to be in DOS text format,
# otherwise the resulting ltconfig script will have mixed
# (UNIX/DOS) format and is unusable with Bash ports before v2.03.
utod $srcdir/ltmain.sh

# Give the configure script some hints:
#export AS=as
export LD=ld
export NM=nm
export CC=gcc
export CXX=gpp
export CFLAGS="-O2 -g"
export RANLIB=ranlib
export DEFAULT_YACC="bison -y"
export YACC="bison -y"
export DEFAULT_LEX=flex
# Define explicitly the .exe extension because on W95 with LFN=y
# the check might fail
export am_cv_exeext=.exe
# ltconfig wants to compute the maximum command-line length, but
# Bash 2.04 doesn't like that (it doesn't have any limit ;-), and
# reboots the system.  We know our limit in advance, so we don't
# need all that crap.  Assuming that the environment size is less
# than 4KB, we can afford 12KB of command-line arguments.
export lt_cv_sys_max_cmd_len=12288

# The configure script needs to see the `install-sh' script, otherwise
# it decides the source installation is broken.  But "make install" will
# fail on 8+3 filesystems if it finds a file `install-', since there
# are numerous "install-foo" targets in Makefile's.  So we rename the
# offending file after the configure step is done.
if test ! -f ${srcdir}/install-sh ; then
  if test -f ${srcdir}/install-.sh ; then
    mv ${srcdir}/install-.sh ${srcdir}/install-sh
  fi
fi

# Now run the configure script while disabling some things like the NLS
# support, which is nearly impossible to be supported in the current way,
# since it relies on file names which will never work on DOS.
echo "Running the configure script..."
$srcdir/configure --srcdir="$srcdir" --prefix='${DJDIR}' \
  --disable-bfd-assembler \
  --disable-shared --disable-nls --verbose --enable-build-warnings=\
-Wimplicit,-Wcomment,-Wformat,-Wparentheses,-Wpointer-arith \
--enable-target-optspace --with-newlib --enable-languages=c,c++ $*

if test -f ${srcdir}/install- ; then
  mv ${srcdir}/install- ${srcdir}/install-.sh
fi
# -- EOF  h8config.sh ------------------------------------------------


To configure gcc type at the dos prompt

C:\DJGPP\gnu\gcc-2.952\build.djg> sh h8config.sh --target=h8300-hitachi-hms

then to build the script type

C:\DJGPP\gnu\gcc-2.952\build.djg> make


At this point I get the following error which I am trying to resolve.


for name in _cmpsi2 _ucmpsi2 _divhi3 _divsi3 _mulhi3 _mulsi3; \
do \
  echo ${name}; \


c:/djgpp/gnu/gcc-2.952/build.djg/gcc/xgcc -Bc:/djgpp/gnu/gcc-2.952/build.djg
/gcc/ -Bc:/djgpp/h8300-hitachi-hms/bin/ -Ic:/djgpp/h8300-hitachi-hms/include
-O2  -DCROSS_COMPILE -DIN_GCC     -O2 -g -I./include  -DDF=SF -DDI=SI -g1
-DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc  -I. -I../../gcc -I../.
./gcc/config -I../../gcc/../include -c -DL${name} libgcc1.S; \
  if [ $? -eq 0 ] ; then true; else exit 1; fi; \
  mv libgcc1.o ${name}.o; \
  h8300-hitachi-hms-ar rc tmplibgcc1.a ${name}.o; \
  rm -f ${name}.o; \
done
_cmpsi2
make.exe[1]: Leaving directory `c:/djgpp/gnu/gcc-2.952/build.djg/gcc'
SYSCALLS.c:341: warning: conflicting types for built-in function `alloca'
SYSCALLS.c:935: warning: conflicting types for built-in function `memcmp'
SYSCALLS.c:936: warning: conflicting types for built-in function `memcpy'
SYSCALLS.c:940: warning: conflicting types for built-in function `memset'
SYSCALLS.c:1334: warning: conflicting types for built-in function `strlen'
c:\djgpp\tmp\cc3wwOKe.s: Assembler messages:
c:\djgpp\tmp\cc3wwOKe.s:2: Error: no such instruction: `libgcc1 routines for
the Hitachi h8/300 cpu.'
c:\djgpp\tmp\cc3wwOKe.s:3: Error: no such instruction: `contributed by Steve
Chamberlain.'
c:\djgpp\tmp\cc3wwOKe.s:4: Error: invalid character '@' in mnemonic
c:\djgpp\tmp\cc3wwOKe.s:93: Error: invalid character '.' in mnemonic
c:\djgpp\tmp\cc3wwOKe.s:94: Error: no such instruction: `bne .L2'
c:\djgpp\tmp\cc3wwOKe.s:95: Error: invalid character '.' in mnemonic
c:\djgpp\tmp\cc3wwOKe.s:96: Error: no such instruction: `bne .L2'
c:\djgpp\tmp\cc3wwOKe.s:97: Error: invalid character '.' in mnemonic
c:\djgpp\tmp\cc3wwOKe.s:98: Error: no such instruction: `rts'
c:\djgpp\tmp\cc3wwOKe.s:100: Error: invalid character '.' in mnemonic
c:\djgpp\tmp\cc3wwOKe.s:101: Error: no such instruction: `bgt .L4'
c:\djgpp\tmp\cc3wwOKe.s:102: Error: no such instruction: `bne .L3'
c:\djgpp\tmp\cc3wwOKe.s:103: Error: invalid character '.' in mnemonic
c:\djgpp\tmp\cc3wwOKe.s:104: Error: no such instruction: `bls .L3'
c:\djgpp\tmp\cc3wwOKe.s:106: Error: invalid character '.' in mnemonic
c:\djgpp\tmp\cc3wwOKe.s:107: Error: no such instruction: `rts'
c:\djgpp\tmp\cc3wwOKe.s:109: Error: invalid character '.' in mnemonic
c:\djgpp\tmp\cc3wwOKe.s:111: Error: no such instruction: `rts'
make.exe[1]: *** [libgcc1-asm.a] Error 1
make.exe: *** [all-gcc] Error 2



Message is in Reply To:
  Update for DJGPP version
 
Here is an update for my (slow) progress for creating a DJGPP compatible or port of brickOS. At this time I am solely focused on getting a cross compiler built and putting off other issues (such as tty comms, see (URL) I have tried three methods to (...) (22 years ago, 27-Sep-02, to lugnet.robotics.rcx.legos)

3 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR