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 / 3160
3159  |  3161
Subject: 
H8300 Cross Compiler for Mac OS X (a start ...)
Newsgroups: 
lugnet.robotics.rcx.legos
Date: 
Sat, 8 Feb 2003 21:18:25 GMT
Viewed: 
3056 times
  
With access to a Mac OS X 10.2 this week I have made an attempt to build the
cross compiler set under Mac OS X.  Currently I have an issue with sysinfo.c
with the binutils build.  But for those interested here are my steps so far.
I will post more as i hopefully get over these roadblocks. WARNING! WARNING!
WARNING! I have NO prior experience with the Mac or Mac OS X.  So use these
instructions AT YOUR OWN RISK.  I am NOT responsible for any damage you
might cause to your machine.

1. Registered with Apple Developer Connection, ADC.
2. From the Apple Developer Site, I downloaded the Mac OS X Developer Tools
December 2002. NOTE: This set of tools requires Mac OS X 10.2.x
3. Installed the following packages within the Development Tools: Developer
Tool software, Mac OS X SDK, Developer Documentation, Developer Example
Software, December 2002 Dev Tools extras.  I don't believe I needed all
these but installed them anyways.
4. Created a subdirectory \Developer\Projects\brickOS\build
5. Downloaded gcc-7 and binutils-200020918 from the Apple Darwin projects
site, http://www.opensource.apple.com/projects/darwin/6.0/projects.html.
NOTE: The gcc-7 package appears to be gcc-2.95.2 and not gcc-3.1 which
binaries come with the Developer Tools.  I was not sure where to find the
newer gcc3.1 and have just decided to try gcc-2.95.2 for now.
6.Copied the tar.gz packages to the dir above.
7.Modified the h8300 cross compiler build script for cygwin written by Paolo
Masetti.  I have included the modified script below. I placed it in the
\Developer\Projects\brickOS\build directory.
8. Opened a terminal and typed at the prompt
username% sh buildgcc.sh

WARNING!WARNING!WARNING! Once again this gets me so far as a error in build
binutils. Please take caution with these steps.

Ed

-- buildgcc.sh
------------------------------------------------------------------
#!/bin/bash.exe

##############################################################################
# Building a GNU C/C++ Cross Compiler [Mac OS X]
# Modified: 8 Feb 2003
# Ed Manlove
# emanlove@users.sourceforge.net
# ----------------------------------------------------------------------------
# Building a GNU C/C++ Cross Compiler [Windows NT 4.0 and Cygwin 1.1]
# Modified: 26 Jan 2001
# Paolo Masetti
# paolo.masetti@itlug.org
#
# ----------------------------------------------------------------------------
# WARNING: This script is intended for making a cross compiler exclusively
#          for use with Lego(r) RCX and the legOS Firmware.
#
# See http://legos.sourceforge.net/ for more infos.
#
# ----------------------------------------------------------------------------
#
# original by
# Christopher Bahns
# Christopher Bahns Software
# chris@bahns.com
#
# Partial comments from original version follows.
#
# This document contains complete instructions on how to create a GNU-
# based cross compiler (C and C++) for use under Windows NT 4.0 and Cygnus
# Cygwin 1.0 and later (not the older Cygwin B20.1). These instructions are
# based on information provided by David Fiddes, who has a build of an
# earlier version of the GNU cross-compiler which seems to be intended for
# Cygwin B20.1. His build is available on his website (see below).
#
# ------------------------------ Notes ------------------------------
#
# 1. These instructions and script will not work with Cygwin B20.1
# (older free version). This version of Cygwin does not have all of the
# utilities or set up certain aspects of the Unix environment that are
# required. Essentially the same things can be accomplished with B20.1
# as with the commercial version 1.0, but the instructions would be a
# bit more complicated, and the resulting environment would not be very
# usable by a typical Unix programmer.
#
# 2. The most frustrating problems I had getting this build to work had
# to do with the addition of carriage returns by various software. This
# is the first thing I'd check if something goes wrong. The two things
# that got me were WinZip (which I was using at first to extract the
# archives), which adds CR's by default, and the Cygwin file system,
# which somehow got setup in text mode, even though the "mount" command
# was showing me "binmode". I solved the former by avoiding WinZip and
# just using the "tar" command from within the Cygwin environment. When
# using WinZip you can disable the "TAR file smart CR/LF conversion"
# option in "Options/Configuration/Miscellaneous". I solved the latter
# by completely removing Cygwin and reinstalling. You should make a
# simple program that can quickly tell you if a particular file has any
# CR's. I wasted a lot of time trying to diagnose such "simple" problems.
#
# The following program is called "showcr.c", which I use to determine
# whether a given text file contains carriage returns.
#
# #include <stdio.h>
# #include <stdlib.h>
#
# int main(int argc, char *argv[])
# {
# FILE *in;
# int i;
# if (argc != 2) {
#    fputs("Usage: showcr <infile>\n", stderr);
#    exit(1);
# }
# if (!(in = fopen(*++argv, "rb"))) {
#    fprintf(stderr, "showcr: can't open %s\n", *argv);
#    exit(1);
# }
# while((i = fgetc(in)) != EOF)
# {
#    if (i == 13)
#    {
#       putchar('^');
#       i = 'M';
#    }
#    putchar(i);
# }
# fclose(in);
# return 0;
# }
#
##############################################################################

BINDIR=/usr/bin
BUILDDIR=`pwd`
LOGFILE=$BUILDDIR/buildgcc.log

#BINUTILS=binutils-2.10.1
BINUTILS=binutils-20020918
#GCC=gcc-2.95.2
GCC=gcc-7
#NEWLIB=newlib-1.8.2

#PREFIXDIR=/h8300-hitachi-hms
TARGET=h8300-hitachi-hms

#***************** DO NOT CHANGE ANYTHING BELOW THIS LINE *****************#
#********************* (unless of course you want to) *********************#

echo ":-------------------- Begin `date` --------------------:" > $LOGFILE
echo Installing source code...
echo `date` Source code installation start 2>&1 | tee --append $LOGFILE
rm -rf $BUILDDIR/binutils
rm -rf $BUILDDIR/gcc
rm -rf $BUILDDIR/$BINUTILS
rm -rf $BUILDDIR/$GCC
tar -xzvf $BUILDDIR/$BINUTILS.tar.gz
tar -xzvf $BUILDDIR/$GCC.tar.gz
cd $BUILDDIR/$GCC
echo `date` Source code installation end 2>&1 | tee --append $LOGFILE

echo Building $BINUTILS...
cd $BUILDDIR
mkdir binutils
cd binutils
echo `date` Binutils configuration start  2>&1 | tee --append $LOGFILE
$BUILDDIR/$BINUTILS/src/configure --verbose --target=$TARGET 2>&1 | tee
--append $LOGFILE
echo `date` Binutils configuration end 2>&1 | tee --append $LOGFILE
echo `date` Binutils build start 2>&1 | tee --append $LOGFILE
make 2>&1 | tee --append $LOGFILE
echo `date` Binutils build end 2>&1 | tee --append $LOGFILE
echo `date` Binutils install start 2>&1 | tee --append $LOGFILE
make install 2>&1 | tee --append $LOGFILE
echo `date` Binutils install 2>&1 | tee --append $LOGFILE

echo Building $GCC...
cd $BUILDDIR
#echo `date` GCC patch start 2>&1 | tee --append $LOGFILE
#cd $GCC
#mv gcc/config/h8300/h8300.c gcc/config/h8300/h8300.c.orig
#patch -u -i ../gcc-2.95.2-rcx-1.diff -o gcc/config/h8300/h8300.c
#mv gcc/config/h8300/h8300.h gcc/config/h8300/h8300.h.orig
#patch -u -i ../gcc-2.95.2-rcx-2.diff -o gcc/config/h8300/h8300.h
#cd ..
echo `date` GCC patch end 2>&1 | tee --append $LOGFILE
mkdir gcc
cd gcc
echo `date` GCC configuration start 2>&1 | tee --append $LOGFILE
$BUILDDIR/$GCC/configure --verbose --target=$TARGET --enable-languages=c,c++
--enable-target-optspace --with-newlib 2>&1 | tee --append $LOGFILE
echo `date` GCC configuration end 2>&1 | tee --append $LOGFILE
echo `date` GCC build start 2>&1 | tee --append $LOGFILE
make cross 2>&1 | tee --append $LOGFILE
echo `date` GCC build end 2>&1 | tee --append $LOGFILE

echo `date` GCC install start 2>&1 | tee --append $LOGFILE
make install 2>&1 | tee --append $LOGFILE
echo `date` GCC install end 2>&1 | tee --append $LOGFILE
echo Done.
echo Done. 2>&1 | tee --append $LOGFILE
echo ":-------------------- End `date` --------------------:" 2>&1 | tee
--append $LOGFILE
cd $BUILDDIR



Message has 1 Reply:
  Re: H8300 Cross Compiler for Mac OS X (a start ...)
 
Once again, WARNING! WARNING! WARNING! I have NO prior experience with the Mac or Mac OS X. So use these instructions AT YOUR OWN RISK. I am NOT responsible for any damage you might cause to your machine. Within step 5, you can download gcc ver 3.1 (...) (22 years ago, 12-Feb-03, to lugnet.robotics.rcx.legos)

2 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