OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [sim/] [ppc/] [RUN] - Diff between revs 827 and 840

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 827 Rev 840
                PSIM - model the PowerPC environment
                PSIM - model the PowerPC environment
    Copyright (C) 1994-1996, Andrew Cagney .
    Copyright (C) 1994-1996, Andrew Cagney .
    ----------------------------------------------------------------------
    ----------------------------------------------------------------------
                        Running PSIM
                        Running PSIM
        This file describes how to run the program PSIM.
        This file describes how to run the program PSIM.
        o       Walk through a number of examples from the
        o       Walk through a number of examples from the
                pre-built tar archive psim-test.
                pre-built tar archive psim-test.
        o       Looks at the device tree used by PSIM.
        o       Looks at the device tree used by PSIM.
        o       Notes on building a programmer environment to
        o       Notes on building a programmer environment to
                use with PSIM (BSD/UEA and BUG/OEA)
                use with PSIM (BSD/UEA and BUG/OEA)
    ----------------------------------------------------------------------
    ----------------------------------------------------------------------
RUNNING PSIM:
RUNNING PSIM:
The compressed tar archive psim-test available from:
The compressed tar archive psim-test available from:
        ftp://ftp.ci.com.au/pub/psim/psim-test-1.0.1.tar.gz
        ftp://ftp.ci.com.au/pub/psim/psim-test-1.0.1.tar.gz
or      ftp://cambridge.cygnus.com/pub/psim/psim-test-1.0.1.tar.gz
or      ftp://cambridge.cygnus.com/pub/psim/psim-test-1.0.1.tar.gz
contains a number of pre-built programs for running under PSIM.  Each
contains a number of pre-built programs for running under PSIM.  Each
pre-built binary is built both big and little endian.  The suffixes
pre-built binary is built both big and little endian.  The suffixes
.be/.le (executables) .bo/.lo (object files) and .ba/.la (libraries)
.be/.le (executables) .bo/.lo (object files) and .ba/.la (libraries)
are used.
are used.
To run one of these programs, use:
To run one of these programs, use:
        powerpc-unknown-eabi-run 
        powerpc-unknown-eabi-run 
for instance:
for instance:
        powerpc-unknown-eabi-run psim-test/uea/envp
        powerpc-unknown-eabi-run psim-test/uea/envp
The program envp prints out your shells environment - very useful!
The program envp prints out your shells environment - very useful!
More generally psim is run as (this is part of the output from the -h
More generally psim is run as (this is part of the output from the -h
option):
option):
        psim [  ... ]  [  ... ]
        psim [  ... ]  [  ... ]
Where
Where
               Name of the PowerPC program to run.
               Name of the PowerPC program to run.
                      This can either be a PowerPC binary or
                      This can either be a PowerPC binary or
                      a text file containing a device tree
                      a text file containing a device tree
                      specification.
                      specification.
                      PSIM will attempt to determine from the
                      PSIM will attempt to determine from the
                      specified  the intended emulation
                      specified  the intended emulation
                      environment.
                      environment.
                      If PSIM gets it wrong, the emulation
                      If PSIM gets it wrong, the emulation
                      environment can be specified using the
                      environment can be specified using the
                      `-e' option (described below).
                      `-e' option (described below).
           Argument to be passed to 
           Argument to be passed to 
                      These arguments will be passed to
                      These arguments will be passed to
                       (as standard C argv, argc)
                       (as standard C argv, argc)
                      when  is started.
                      when  is started.
         See below
         See below
The following are valid s:
The following are valid s:
        -m     Specify the processor to model (604)
        -m     Specify the processor to model (604)
                      Selects the processor to use when
                      Selects the processor to use when
                      modeling execution units.  Includes:
                      modeling execution units.  Includes:
                      604, 603 and 603e
                      604, 603 and 603e
        -e   specify an OS or platform to model
        -e   specify an OS or platform to model
                      Can be any of the following:
                      Can be any of the following:
                      bug - OEA + MOTO BUG ROM calls
                      bug - OEA + MOTO BUG ROM calls
                      netbsd - UEA + NetBSD system calls
                      netbsd - UEA + NetBSD system calls
                      chirp - OEA + a few OpenBoot calls
                      chirp - OEA + a few OpenBoot calls
        -i            Print instruction counting statistics
        -i            Print instruction counting statistics
        -I            Print execution unit statistics
        -I            Print execution unit statistics
        -r      Set RAM size in bytes (OEA environments)
        -r      Set RAM size in bytes (OEA environments)
        -t [!] Enable (disable)  option
        -t [!] Enable (disable)  option
        -o      add device  to the device tree
        -o      add device  to the device tree
        -h -? -H      give more detailed usage
        -h -? -H      give more detailed usage
The `-H' option gives a long usage output.  This includes a complete
The `-H' option gives a long usage output.  This includes a complete
list of all the pre-configured devices.
list of all the pre-configured devices.
    ----------------------------------------------------------------------
    ----------------------------------------------------------------------
RUNNING GDB:
RUNNING GDB:
If you built PSIM with gdb then the following is a quick start
If you built PSIM with gdb then the following is a quick start
tutorial.
tutorial.
At present GDB, if configured big-endian (say) unlike PSIM, does not
At present GDB, if configured big-endian (say) unlike PSIM, does not
support the debugging of little endian binaries.  If you find that
support the debugging of little endian binaries.  If you find that
your program won't run at all, make certain that GDB and your
your program won't run at all, make certain that GDB and your
program's endianness match.
program's endianness match.
The most important thing is that before you can run the simulator you
The most important thing is that before you can run the simulator you
must enable it.  For the simulator, gdb is started like any program:
must enable it.  For the simulator, gdb is started like any program:
        $ powerpc-unknown-eabi-gdb psim-test/uea/envp.be
        $ powerpc-unknown-eabi-gdb psim-test/uea/envp.be
Next the simulator is enabled.  The command `target sim' accepts the
Next the simulator is enabled.  The command `target sim' accepts the
same options as can be specified on the PSIM command line.
same options as can be specified on the PSIM command line.
        (gdb) target sim
        (gdb) target sim
To trace the communication between psim and gdb specify `target sim -t
To trace the communication between psim and gdb specify `target sim -t
gdb'.  Once enabled, the binary needs to be loaded, any breakpoints of
gdb'.  Once enabled, the binary needs to be loaded, any breakpoints of
interest set, and the program run:
interest set, and the program run:
        (gdb) load
        (gdb) load
        (gdb) break main
        (gdb) break main
        (gdb) run
        (gdb) run
        .
        .
        .
        .
        .
        .
In addition, if you are wanting to run a program described by a device
In addition, if you are wanting to run a program described by a device
tree you can `attach' to the simulation using (I assume that you have
tree you can `attach' to the simulation using (I assume that you have
applied the attach patch):
applied the attach patch):
        $ cd psim-test/tree
        $ cd psim-test/tree
        $ powerpc-unknown-eabi-gdb
        $ powerpc-unknown-eabi-gdb
        (gdb) target sim
        (gdb) target sim
        (gdb) attach device-tree
        (gdb) attach device-tree
        (gdb) run
        (gdb) run
Here GDB takes the programs initial state from the attached
Here GDB takes the programs initial state from the attached
device-tree instead of forcing initialisation.
device-tree instead of forcing initialisation.
    ----------------------------------------------------------------------
    ----------------------------------------------------------------------
PROFILING:
PROFILING:
PSIM includes a number of performance monitoring (profiling)
PSIM includes a number of performance monitoring (profiling)
facilities:
facilities:
        o       instruction frequency counting
        o       instruction frequency counting
        o       execution unit modeling (records
        o       execution unit modeling (records
                effective usage of units).
                effective usage of units).
        o       instruction cache performance
        o       instruction cache performance
As discussed in the file INSTALL, each can be configured to individual
As discussed in the file INSTALL, each can be configured to individual
requirements.
requirements.
        -i      Enable instruction counting.
        -i      Enable instruction counting.
                The frequency of all instructions is tabulated.  In
                The frequency of all instructions is tabulated.  In
                addition (f configured) the hit/miss rate of the
                addition (f configured) the hit/miss rate of the
                instruction cache is output.
                instruction cache is output.
        -I      Enable execution unit analysis.
        -I      Enable execution unit analysis.
                In addition to counting basic instructions also model
                In addition to counting basic instructions also model
                the performance of the processors execution units
                the performance of the processors execution units
        -m 
        -m 
                Select the processor to be modelled.
                Select the processor to be modelled.
                For execution unit analysis specify the processor that
                For execution unit analysis specify the processor that
                is to be analysed.  By default the 604 is modelled
                is to be analysed.  By default the 604 is modelled
                however, support for other processors such as the
                however, support for other processors such as the
                603 and 603e is included.
                603 and 603e is included.
The output from a performance run (on a P90) for the program
The output from a performance run (on a P90) for the program
psim-test/profile/bench is below.  In this run psim was fairly
psim-test/profile/bench is below.  In this run psim was fairly
agressively configured (see the file INSTALL for compile time
agressively configured (see the file INSTALL for compile time
configuration).
configuration).
        CPU #1 executed     41,994 AND instructions.
        CPU #1 executed     41,994 AND instructions.
        CPU #1 executed    519,785 AND Immediate instructions.
        CPU #1 executed    519,785 AND Immediate instructions.
        CPU #1 executed    680,058 Add instructions.
        CPU #1 executed    680,058 Add instructions.
        CPU #1 executed     41,994 Add Extended instructions.
        CPU #1 executed     41,994 Add Extended instructions.
        CPU #1 executed    921,916 Add Immediate instructions.
        CPU #1 executed    921,916 Add Immediate instructions.
        CPU #1 executed    221,199 Add Immediate Carrying instructions.
        CPU #1 executed    221,199 Add Immediate Carrying instructions.
        CPU #1 executed    943,823 Add Immediate Shifted instructions.
        CPU #1 executed    943,823 Add Immediate Shifted instructions.
        CPU #1 executed    471,909 Add to Zero Extended instructions.
        CPU #1 executed    471,909 Add to Zero Extended instructions.
        CPU #1 executed    571,915 Branch instructions.
        CPU #1 executed    571,915 Branch instructions.
        CPU #1 executed  1,992,403 Branch Conditional instructions.
        CPU #1 executed  1,992,403 Branch Conditional instructions.
        CPU #1 executed    571,910 Branch Conditional to Link Register instructions.
        CPU #1 executed    571,910 Branch Conditional to Link Register instructions.
        CPU #1 executed    320,431 Compare instructions.
        CPU #1 executed    320,431 Compare instructions.
        CPU #1 executed    471,911 Compare Immediate instructions.
        CPU #1 executed    471,911 Compare Immediate instructions.
        CPU #1 executed    145,867 Compare Logical instructions.
        CPU #1 executed    145,867 Compare Logical instructions.
        CPU #1 executed    442,414 Compare Logical Immediate instructions.
        CPU #1 executed    442,414 Compare Logical Immediate instructions.
        CPU #1 executed          1 Condition Register XOR instruction.
        CPU #1 executed          1 Condition Register XOR instruction.
        CPU #1 executed    103,873 Divide Word instructions.
        CPU #1 executed    103,873 Divide Word instructions.
        CPU #1 executed    104,275 Divide Word Unsigned instructions.
        CPU #1 executed    104,275 Divide Word Unsigned instructions.
        CPU #1 executed    132,510 Extend Sign Byte instructions.
        CPU #1 executed    132,510 Extend Sign Byte instructions.
        CPU #1 executed    178,895 Extend Sign Half Word instructions.
        CPU #1 executed    178,895 Extend Sign Half Word instructions.
        CPU #1 executed    871,920 Load Word and Zero instructions.
        CPU #1 executed    871,920 Load Word and Zero instructions.
        CPU #1 executed     41,994 Move From Condition Register instructions.
        CPU #1 executed     41,994 Move From Condition Register instructions.
        CPU #1 executed    100,005 Move from Special Purpose Register instructions.
        CPU #1 executed    100,005 Move from Special Purpose Register instructions.
        CPU #1 executed    100,002 Move to Special Purpose Register instructions.
        CPU #1 executed    100,002 Move to Special Purpose Register instructions.
        CPU #1 executed    804,619 Multiply Low Word instructions.
        CPU #1 executed    804,619 Multiply Low Word instructions.
        CPU #1 executed    421,201 OR instructions.
        CPU #1 executed    421,201 OR instructions.
        CPU #1 executed    471,910 OR Immediate instructions.
        CPU #1 executed    471,910 OR Immediate instructions.
        CPU #1 executed  1,292,020 Rotate Left Word Immediate then AND with Mask instructions.
        CPU #1 executed  1,292,020 Rotate Left Word Immediate then AND with Mask instructions.
        CPU #1 executed    663,613 Shift Left Word instructions.
        CPU #1 executed    663,613 Shift Left Word instructions.
        CPU #1 executed  1,151,564 Shift Right Algebraic Word Immediate instructions.
        CPU #1 executed  1,151,564 Shift Right Algebraic Word Immediate instructions.
        CPU #1 executed    871,922 Store Word instructions.
        CPU #1 executed    871,922 Store Word instructions.
        CPU #1 executed    100,004 Store Word with Update instructions.
        CPU #1 executed    100,004 Store Word with Update instructions.
        CPU #1 executed    887,804 Subtract From instructions.
        CPU #1 executed    887,804 Subtract From instructions.
        CPU #1 executed     83,988 Subtract From Immediate Carrying instructions.
        CPU #1 executed     83,988 Subtract From Immediate Carrying instructions.
        CPU #1 executed          1 System Call instruction.
        CPU #1 executed          1 System Call instruction.
        CPU #1 executed    207,746 XOR instructions.
        CPU #1 executed    207,746 XOR instructions.
        CPU #1 executed 23,740,856 cycles.
        CPU #1 executed 23,740,856 cycles.
        CPU #1 executed 10,242,780 stalls waiting for data.
        CPU #1 executed 10,242,780 stalls waiting for data.
        CPU #1 executed          1 stall waiting for a function unit.
        CPU #1 executed          1 stall waiting for a function unit.
        CPU #1 executed          1 stall waiting for serialization.
        CPU #1 executed          1 stall waiting for serialization.
        CPU #1 executed  1,757,900 times a write-back slot was unavailable.
        CPU #1 executed  1,757,900 times a write-back slot was unavailable.
        CPU #1 executed  1,088,135 branches.
        CPU #1 executed  1,088,135 branches.
        CPU #1 executed  2,048,093 conditional branches fell through.
        CPU #1 executed  2,048,093 conditional branches fell through.
        CPU #1 executed  1,088,135 successful branch predictions.
        CPU #1 executed  1,088,135 successful branch predictions.
        CPU #1 executed    904,268 unsuccessful branch predictions.
        CPU #1 executed    904,268 unsuccessful branch predictions.
        CPU #1 executed    742,557 branch if the condition is FALSE conditional branches.
        CPU #1 executed    742,557 branch if the condition is FALSE conditional branches.
        CPU #1 executed  1,249,846 branch if the condition is TRUE conditional branches.
        CPU #1 executed  1,249,846 branch if the condition is TRUE conditional branches.
        CPU #1 executed    571,910 branch always conditional branches.
        CPU #1 executed    571,910 branch always conditional branches.
        CPU #1 executed  9,493,653 1st single cycle integer functional unit instructions.
        CPU #1 executed  9,493,653 1st single cycle integer functional unit instructions.
        CPU #1 executed  1,220,900 2nd single cycle integer functional unit instructions.
        CPU #1 executed  1,220,900 2nd single cycle integer functional unit instructions.
        CPU #1 executed  1,254,768 multiple cycle integer functional unit instructions.
        CPU #1 executed  1,254,768 multiple cycle integer functional unit instructions.
        CPU #1 executed  1,843,846 load/store functional unit instructions.
        CPU #1 executed  1,843,846 load/store functional unit instructions.
        CPU #1 executed  3,136,229 branch functional unit instructions.
        CPU #1 executed  3,136,229 branch functional unit instructions.
        CPU #1 executed 16,949,396 instructions that were accounted for in timing info.
        CPU #1 executed 16,949,396 instructions that were accounted for in timing info.
        CPU #1 executed    871,920 data reads.
        CPU #1 executed    871,920 data reads.
        CPU #1 executed    971,926 data writes.
        CPU #1 executed    971,926 data writes.
        CPU #1 executed        221 icache misses.
        CPU #1 executed        221 icache misses.
        CPU #1 executed 16,949,396 instructions in total.
        CPU #1 executed 16,949,396 instructions in total.
        Simulator speed was 250,731 instructions/second
        Simulator speed was 250,731 instructions/second
    ----------------------------------------------------------------------
    ----------------------------------------------------------------------
PSIM CONFIGURATION - THE DEVICE TREE
PSIM CONFIGURATION - THE DEVICE TREE
Internally PSIM's configuration is controlled by a tree data
Internally PSIM's configuration is controlled by a tree data
structure.  This structure, created at run-time, intentionally
structure.  This structure, created at run-time, intentionally
resembles the device tree used by OpenBoot firmware to describe a
resembles the device tree used by OpenBoot firmware to describe a
machines hardware configuration.
machines hardware configuration.
PSIM can either create its device tree using a builtin emulation or
PSIM can either create its device tree using a builtin emulation or
from one read in from a file.
from one read in from a file.
During startup, the device tree is created using the following steps:
During startup, the device tree is created using the following steps:
        o       Initial empty tree is created
        o       Initial empty tree is created
        o       Any tree entry options specified on the
        o       Any tree entry options specified on the
                command line are merged in (the -o 
                command line are merged in (the -o 
                option is used).
                option is used).
                It should be pointed out that most of the
                It should be pointed out that most of the
                command line options (eg -r, -e, -m, -t
                command line options (eg -r, -e, -m, -t
                are all just short hand for corresponding
                are all just short hand for corresponding
                -o options).
                -o options).
        o       If the specified program is a device tree spec, that
        o       If the specified program is a device tree spec, that
                is loaded.
                is loaded.
                If the specified program is a text file it is assumed
                If the specified program is a text file it is assumed
                that that file contains a further specification of the
                that that file contains a further specification of the
                simulators device tree.  That tree is loaded and
                simulators device tree.  That tree is loaded and
                merged with the current tree options.
                merged with the current tree options.
        o       The selected emulation fills out any remaining details.
        o       The selected emulation fills out any remaining details.
                By this stage the emulation environment that the program
                By this stage the emulation environment that the program
                needs will either be specified in the device tree
                needs will either be specified in the device tree
                (through the -e option) or determined from the
                (through the -e option) or determined from the
                characteristics of the binary.
                characteristics of the binary.
                The selected emulation will then fill out any missing
                The selected emulation will then fill out any missing
                nodes in the device tree.
                nodes in the device tree.
Most importantly earlier additions to the tree are not overridden by
Most importantly earlier additions to the tree are not overridden by
later additions.  Thus, command line options override information
later additions.  Thus, command line options override information
found in the program file and both override any builtin emulation
found in the program file and both override any builtin emulation
entries.
entries.
The following is a summary of the most useful runtime configuration
The following is a summary of the most useful runtime configuration
options:
options:
        -e 
        -e 
        -o '/openprom/options/os-emul '
        -o '/openprom/options/os-emul '
                Run program using the  run-time
                Run program using the  run-time
                environment.
                environment.
        -r 
        -r 
        -o '/openprom/options/oea-memory-size '
        -o '/openprom/options/oea-memory-size '
                Set the size of the first bank of memory
                Set the size of the first bank of memory
                (RAM from address 0 up).
                (RAM from address 0 up).
        -t print-device-tree
        -t print-device-tree
        -o '/openprom/trace/print-device-tree 1'
        -o '/openprom/trace/print-device-tree 1'
        -t dump-device-tree
        -t dump-device-tree
        -o '/openprom/trace/dump-device-tree 1'
        -o '/openprom/trace/dump-device-tree 1'
                Print out the device tree once it has been fully
                Print out the device tree once it has been fully
                populated. For dump-device-tree, exit simulator after
                populated. For dump-device-tree, exit simulator after
                dumping the tree.
                dumping the tree.
                PSIM is able to reload the dumped device tree.
                PSIM is able to reload the dumped device tree.
                The format of the dumped tree is under development.
                The format of the dumped tree is under development.
        -o '/openprom/options/smp '
        -o '/openprom/options/smp '
                Enable  processors for the simulation run.
                Enable  processors for the simulation run.
                See the directory psim-test/oea for an example.
                See the directory psim-test/oea for an example.
        -o '/openprom/options/alignment '
        -o '/openprom/options/alignment '
                Where  is 1 - nonstrict or 2 - strict.
                Where  is 1 - nonstrict or 2 - strict.
                Specify if the missaligned access are allowed
                Specify if the missaligned access are allowed
                (non-strict) or result in an alignment exception
                (non-strict) or result in an alignment exception
                (strict).
                (strict).
Devices (if included in the file device_table.c) can also be specified
Devices (if included in the file device_table.c) can also be specified
in a similar way.  For instance, to add a second serial port, a
in a similar way.  For instance, to add a second serial port, a
command like:
command like:
        -o '/iobus@0x400000/console@0x000010'
        -o '/iobus@0x400000/console@0x000010'
would create a `console' device at offset 0x10 within the `iobus' at
would create a `console' device at offset 0x10 within the `iobus' at
memory address 0x400000.
memory address 0x400000.
For more detailed information on device specifiers see the notes on
For more detailed information on device specifiers see the notes on
the function dump_device_tree in the file device.c (found in the
the function dump_device_tree in the file device.c (found in the
source code).
source code).
    ----------------------------------------------------------------------
    ----------------------------------------------------------------------
BUILDING A BUG/OEA DEVELOPMENT ENVIRONMENT
BUILDING A BUG/OEA DEVELOPMENT ENVIRONMENT
Background:
Background:
Included in many PowerPC systems is Motorola's BUG monitor.  This
Included in many PowerPC systems is Motorola's BUG monitor.  This
monitor includes, for client programs, a set of services that allow
monitor includes, for client programs, a set of services that allow
that program to interact with hardware devices such as the console using
that program to interact with hardware devices such as the console using
a simple system call interface.
a simple system call interface.
PSIM is able to emulate a number of the services (including the
PSIM is able to emulate a number of the services (including the
console IO calls).  If additional services are needed they can easily
console IO calls).  If additional services are needed they can easily
be added.
be added.
Cygnus support's newlib library includes includes an interface to the
Cygnus support's newlib library includes includes an interface to the
MOTO BUG services.  The notes below discuss how I both built and run
MOTO BUG services.  The notes below discuss how I both built and run
programs compiled using this library on PSIM.
programs compiled using this library on PSIM.
The only confusing part about building a development environment based
The only confusing part about building a development environment based
around newlib/binutils/gcc is a chicken/egg problem with include
around newlib/binutils/gcc is a chicken/egg problem with include
files:
files:
        For GCC to build, a fairly complete set of include
        For GCC to build, a fairly complete set of include
        files must be installed but newlib won't install its
        files must be installed but newlib won't install its
        include files until it has been built with gcc ...
        include files until it has been built with gcc ...
I get around this by installing the problematic include files by hand.
I get around this by installing the problematic include files by hand.
Preparation:
Preparation:
The following files are needed:
The following files are needed:
From your favorite FTP site, the sources to gas/ld and gcc - mine
From your favorite FTP site, the sources to gas/ld and gcc - mine
happens to be archie.au :
happens to be archie.au :
        ftp://archie.au/gnu/binutils-2.6.tar.gz
        ftp://archie.au/gnu/binutils-2.6.tar.gz
        ftp://archie.au/gnu/gcc-2.7.2.tar.gz
        ftp://archie.au/gnu/gcc-2.7.2.tar.gz
From ftp://ftp.cygnus.com/pub/newlib the source code to a library:
From ftp://ftp.cygnus.com/pub/newlib the source code to a library:
        ftp://ftp.cygnus.com/pub/newlib/newlib-1.7.0.tar.gz
        ftp://ftp.cygnus.com/pub/newlib/newlib-1.7.0.tar.gz
From ftp://ftp.ci.com.au/pub/psim some minor patches and updates to
From ftp://ftp.ci.com.au/pub/psim some minor patches and updates to
the above library:
the above library:
        ftp://ftp.ci.com.au/pub/psim/newlib-1.7.0+float+ppc-asm.tar.gz
        ftp://ftp.ci.com.au/pub/psim/newlib-1.7.0+float+ppc-asm.tar.gz
        ftp://ftp.ci.com.au/pub/psim/newlib-1.7.0+ppc-fix.diff.gz
        ftp://ftp.ci.com.au/pub/psim/newlib-1.7.0+ppc-fix.diff.gz
        ftp://ftp.ci.com.au/pub/psim/binutils-2.6+note.diff.gz
        ftp://ftp.ci.com.au/pub/psim/binutils-2.6+note.diff.gz
In addition you'll need to decide where you will be installing the
In addition you'll need to decide where you will be installing the
development environment.  You will notice that in the below I install
development environment.  You will notice that in the below I install
things well away /usr/local instead installing everything under its
things well away /usr/local instead installing everything under its
own directory in /applications.
own directory in /applications.
Method:
Method:
These notes are based on an installation performed on a Sun-OS-4/SPARC
These notes are based on an installation performed on a Sun-OS-4/SPARC
host.  For other hosts and other configurations, the below should be
host.  For other hosts and other configurations, the below should be
considered as a guideline only.
considered as a guideline only.
        o       Sanity check
        o       Sanity check
                $ cd .../scratch        # your scratch directory
                $ cd .../scratch        # your scratch directory
                $ ls -1
                $ ls -1
                binutils-2.6.tar.gz
                binutils-2.6.tar.gz
                binutils-2.6+note.diff.gz
                binutils-2.6+note.diff.gz
                gcc-2.7.2,tar.gz
                gcc-2.7.2,tar.gz
                newlib-1.7.0+float+ppc-asm.tar.gz
                newlib-1.7.0+float+ppc-asm.tar.gz
                newlib-1.7.0+ppc-fix.diff.gz
                newlib-1.7.0+ppc-fix.diff.gz
                newlib-1.7.0.tar.gz
                newlib-1.7.0.tar.gz
        o       Unpack/build/install binutils
        o       Unpack/build/install binutils
                This is done first so that there is a gas/ld ready
                This is done first so that there is a gas/ld ready
                for the building of GCC and NEWLIB.
                for the building of GCC and NEWLIB.
                $ cd .../scratch
                $ cd .../scratch
                $ gunzip < binutils-2.6.tar.gz | tar xf -
                $ gunzip < binutils-2.6.tar.gz | tar xf -
                $ cd binutils-2.6
                $ cd binutils-2.6
                Optionally apply the note patch
                Optionally apply the note patch
                $ gunzip ../binutils-2.6+note.diff.gz | patch
                $ gunzip ../binutils-2.6+note.diff.gz | patch
                Then continue with the build
                Then continue with the build
                $ ./configure --target=powerpc-unknown-eabi \
                $ ./configure --target=powerpc-unknown-eabi \
                              --prefix=/applications/psim
                              --prefix=/applications/psim
                $ make
                $ make
                $ make install
                $ make install
                $ cd ..
                $ cd ..
                $ rm -rf binutils-2.6
                $ rm -rf binutils-2.6
                This also creates much of the installation directory
                This also creates much of the installation directory
                tree.
                tree.
        o       Unpack newlib, install the include files so that they
        o       Unpack newlib, install the include files so that they
                are ready for GCC's build.
                are ready for GCC's build.
                $ cd .../scratch
                $ cd .../scratch
                $ gunzip < newlib-1.7.0.tar.gz | tar xf -
                $ gunzip < newlib-1.7.0.tar.gz | tar xf -
                New lib-1.7.0 had a few minor bugs (fixed in current):
                New lib-1.7.0 had a few minor bugs (fixed in current):
                the header files float.h and ppc-asm.h were missing;
                the header files float.h and ppc-asm.h were missing;
                the configure and Makefile's for the rs6000 (ppc) directory
                the configure and Makefile's for the rs6000 (ppc) directory
                contained typos:
                contained typos:
                $ cd .../scratch
                $ cd .../scratch
                $ cd newlib-1.7.0
                $ cd newlib-1.7.0
                $ gunzip < ../newlib-1.7.0+float+ppc-asm.tar.gz | tar xvf -
                $ gunzip < ../newlib-1.7.0+float+ppc-asm.tar.gz | tar xvf -
                $ gunzip < ../newlib-1.7.0+ppc-fix.diff.gz | patch -p1
                $ gunzip < ../newlib-1.7.0+ppc-fix.diff.gz | patch -p1
                Finally copy the include files to where GCC will see them:
                Finally copy the include files to where GCC will see them:
                $ cd .../scratch
                $ cd .../scratch
                $ cd newlib-1.7.0/newlib/libc
                $ cd newlib-1.7.0/newlib/libc
                $ tar cf - include | \
                $ tar cf - include | \
                   ( cd /applications/psim/powerpc-unknown-eabi && tar xf - )
                   ( cd /applications/psim/powerpc-unknown-eabi && tar xf - )
        o       Unpack/build gcc
        o       Unpack/build gcc
                $ cd .../scratch
                $ cd .../scratch
                $ gunzip < gcc-2.7.2,tar.gz | tar xf -
                $ gunzip < gcc-2.7.2,tar.gz | tar xf -
                $ cd gcc-2.7.2
                $ cd gcc-2.7.2
                $ ./configure --target=powerpc-unknown-eabi \
                $ ./configure --target=powerpc-unknown-eabi \
                              --prefix=/applications/psim
                              --prefix=/applications/psim
                $ make
                $ make
                $ make install
                $ make install
                $ cd ..
                $ cd ..
                $ rm -rf gcc-2.7.2
                $ rm -rf gcc-2.7.2
                Gcc likes to install its own dummy version of float that
                Gcc likes to install its own dummy version of float that
                just returns an error.
                just returns an error.
                $ more /applications/psim/lib/gcc-lib/powerpc-unknown-eabi/2.7.2/include/float.h
                $ more /applications/psim/lib/gcc-lib/powerpc-unknown-eabi/2.7.2/include/float.h
                $ rm /applications/psim/lib/gcc-lib/powerpc-unknown-eabi/2.7.2/include/float.h
                $ rm /applications/psim/lib/gcc-lib/powerpc-unknown-eabi/2.7.2/include/float.h
        o       Finish building/installing newlib
        o       Finish building/installing newlib
                $ cd .../scratch
                $ cd .../scratch
                $ cd newlib-1.7.0
                $ cd newlib-1.7.0
                $ ./configure --target=powerpc-unknown-eabi \
                $ ./configure --target=powerpc-unknown-eabi \
                              --prefix=/applications/psim
                              --prefix=/applications/psim
                Your path will need to include the recently installed
                Your path will need to include the recently installed
                gas/gcc when building.  Either add it to your path or
                gas/gcc when building.  Either add it to your path or
                use:
                use:
                $ PATH=/applications/psim/bin:$PATH make
                $ PATH=/applications/psim/bin:$PATH make
                $ PATH=/applications/psim/bin:$PATH make install
                $ PATH=/applications/psim/bin:$PATH make install
        o       Finally, test out the build
        o       Finally, test out the build
                $ cat hello.c
                $ cat hello.c
                main()
                main()
                {
                {
                  printf("hello world\n");
                  printf("hello world\n");
                }
                }
                The binary is linked with an entry point less than 0x100000
                The binary is linked with an entry point less than 0x100000
                (1mb) so that psim will recognize the binary as needing
                (1mb) so that psim will recognize the binary as needing
                the BUG/OEA instead of the BSD/UEA runtime environment.
                the BUG/OEA instead of the BSD/UEA runtime environment.
                $ powerpc-unknown-eabi-gcc -v -o hello \
                $ powerpc-unknown-eabi-gcc -v -o hello \
                    -Wl,-Ttext,0x4000,-Tdata,0x10000 \
                    -Wl,-Ttext,0x4000,-Tdata,0x10000 \
                    /applications/psim/powerpc-unknown-eabi/lib/mvme-crt0.o \
                    /applications/psim/powerpc-unknown-eabi/lib/mvme-crt0.o \
                    hello.c \
                    hello.c \
                    -lc -lmvme
                    -lc -lmvme
                $ powerpc-unknown-eabi-objdump -h hello
                $ powerpc-unknown-eabi-objdump -h hello
                $ powerpc-unknown-eabi-run hello
                $ powerpc-unknown-eabi-run hello
                It is also possible to force psim to use a specific
                It is also possible to force psim to use a specific
                run-time environment using the -e option vis:
                run-time environment using the -e option vis:
                $ powerpc-unknown-eabi-run -e bug hello
                $ powerpc-unknown-eabi-run -e bug hello
    ----------------------------------------------------------------------
    ----------------------------------------------------------------------
BUILDING A BSD/UEA DEVELOPMENT ENVIRONMENT
BUILDING A BSD/UEA DEVELOPMENT ENVIRONMENT
Background:
Background:
For a UEA to be useful it needs a supporting run-time environment.
For a UEA to be useful it needs a supporting run-time environment.
PSIM implements a runtime environment based on the NetBSD system call
PSIM implements a runtime environment based on the NetBSD system call
interface.
interface.
More than any thing, this user level emulation was the first
More than any thing, this user level emulation was the first
implemented because I happened to have the NetBSD source code lying
implemented because I happened to have the NetBSD source code lying
around.
around.
Preparation:
Preparation:
This requires the NetBSD-1.1 source tree online.  It can either be
This requires the NetBSD-1.1 source tree online.  It can either be
obtained vi ftp:
obtained vi ftp:
        try http://www.netbsd.org  or  ftp://ftp.netbsd.org
        try http://www.netbsd.org  or  ftp://ftp.netbsd.org
Alternatively obtain one of the NetBSD cdrom's.  Patches to this source
Alternatively obtain one of the NetBSD cdrom's.  Patches to this source
tree that fill out much of the PowerPC code are available in:
tree that fill out much of the PowerPC code are available in:
        ftp://ftp.ci.com.au/pub/clayton
        ftp://ftp.ci.com.au/pub/clayton
Fetch everything in that directory - diffs, tar archives and scripts.
Fetch everything in that directory - diffs, tar archives and scripts.
In addition patches to the bintuils and gcc are in:
In addition patches to the bintuils and gcc are in:
        ftp://ftp.ci.com.au/pub/psim/binutils-2.6+note.diff.gz
        ftp://ftp.ci.com.au/pub/psim/binutils-2.6+note.diff.gz
        ftp://ftp.ci.com.au/pub/psim/gcc-2.7.2+sys-types.diff.gz
        ftp://ftp.ci.com.au/pub/psim/gcc-2.7.2+sys-types.diff.gz
while the compiler (gcc) and assember (binutils) can be found at your
while the compiler (gcc) and assember (binutils) can be found at your
favorite gnu ftp site.  I used versions:
favorite gnu ftp site.  I used versions:
        gcc-2.7.2.tar.gz
        gcc-2.7.2.tar.gz
        binutils-2.6.tar.gz
        binutils-2.6.tar.gz
Method:
Method:
These notes are based on an installation performed on a Solaris2/x86
These notes are based on an installation performed on a Solaris2/x86
host.  For other hosts and other configurations, the below should be
host.  For other hosts and other configurations, the below should be
considered as a guideline only.
considered as a guideline only.
        o       Sanity check
        o       Sanity check
                I assume that you have already obtained the NetBSD-1.1 source
                I assume that you have already obtained the NetBSD-1.1 source
                code and unpacked it into the directory bsd-src.  While the
                code and unpacked it into the directory bsd-src.  While the
                full NetBSD source tree may not be needed, things are easier
                full NetBSD source tree may not be needed, things are easier
                if it is all online.
                if it is all online.
                $ cd .../scratch
                $ cd .../scratch
                $ ls -1
                $ ls -1
                binutils-2.6.tar.gz
                binutils-2.6.tar.gz
                binutils-2.6+note.diff.gz
                binutils-2.6+note.diff.gz
                clayton-include-960203.diff.gz
                clayton-include-960203.diff.gz
                clayton-lib-960203.diff.gz
                clayton-lib-960203.diff.gz
                clayton-lib-960203.tar.gz
                clayton-lib-960203.tar.gz
                clayton-sys-960203.diff.gz
                clayton-sys-960203.diff.gz
                clayton-sys-960203.tar.gz
                clayton-sys-960203.tar.gz
                clayton.chown.sh
                clayton.chown.sh
                clayton.install.sh
                clayton.install.sh
                clayton.lorder.sh
                clayton.lorder.sh
                clayton.make.sh
                clayton.make.sh
                gcc-2.7.2.tar.gz
                gcc-2.7.2.tar.gz
                gcc-2.7.2+sys-types.diff.gz
                gcc-2.7.2+sys-types.diff.gz
                make.tar.gz
                make.tar.gz
                make.diff.gz
                make.diff.gz
        o       Prepare the destination directory ready for installation.
        o       Prepare the destination directory ready for installation.
                Firstly create many of the needed directories (some are
                Firstly create many of the needed directories (some are
                created automatically later):
                created automatically later):
                $ for d in \
                $ for d in \
                    /applications/psim \
                    /applications/psim \
                    /applications/psim/bsd-root \
                    /applications/psim/bsd-root \
                    /applications/psim/bsd-root/usr \
                    /applications/psim/bsd-root/usr \
                    /applications/psim/bsd-root/usr/share \
                    /applications/psim/bsd-root/usr/share \
                    /applications/psim/bsd-root/usr/share/doc \
                    /applications/psim/bsd-root/usr/share/doc \
                    /applications/psim/bsd-root/usr/share/doc/psd \
                    /applications/psim/bsd-root/usr/share/doc/psd \
                    /applications/psim/bsd-root/usr/share/doc/psd/19.curses \
                    /applications/psim/bsd-root/usr/share/doc/psd/19.curses \
                    /applications/psim/bsd-root/usr/include \
                    /applications/psim/bsd-root/usr/include \
                    /applications/psim/bsd-root/usr/lib \
                    /applications/psim/bsd-root/usr/lib \
                    /applications/psim/powerpc-unknown-eabi \
                    /applications/psim/powerpc-unknown-eabi \
                    /applications/psim/powerpc-unknown-eabi/bin \
                    /applications/psim/powerpc-unknown-eabi/bin \
                    ; \
                    ; \
                  do test -d $d || mkdir $d ; done
                  do test -d $d || mkdir $d ; done
                Next, link the BSD and GNU include directories together.
                Next, link the BSD and GNU include directories together.
                GCC expects include files to be in one location while the
                GCC expects include files to be in one location while the
                bsd install expects them in a second.  The link is in
                bsd install expects them in a second.  The link is in
                the direction below because bsd's install also insists on
                the direction below because bsd's install also insists on
                a directory (not a link) for its install destination.
                a directory (not a link) for its install destination.
                $ rm -rf /applications/psim/powerpc-unknown-eabi/include
                $ rm -rf /applications/psim/powerpc-unknown-eabi/include
                $ ln -s /applications/psim/bsd-root/usr/include \
                $ ln -s /applications/psim/bsd-root/usr/include \
                    /applications/psim/powerpc-unknown-eabi/include
                    /applications/psim/powerpc-unknown-eabi/include
                $ ls -l /applications/psim/powerpc-unknown-eabi/include
                $ ls -l /applications/psim/powerpc-unknown-eabi/include
                lrwxr-xr-x  1 cagney  wheel  39 Mar 21 18:09
                lrwxr-xr-x  1 cagney  wheel  39 Mar 21 18:09
                /applications/psim/powerpc-unknown-eabi/include
                /applications/psim/powerpc-unknown-eabi/include
                -> /applications/psim/bsd-root/usr/include
                -> /applications/psim/bsd-root/usr/include
        o       Build/install Berkeley make
        o       Build/install Berkeley make
                The tar archive make.tar.gz contains a recent snapshot
                The tar archive make.tar.gz contains a recent snapshot
                of bmake from the NetBSD source tree.  The notes below
                of bmake from the NetBSD source tree.  The notes below
                describe how to build/install it.  If you have access
                describe how to build/install it.  If you have access
                to an even more recent version of bmake, use that.
                to an even more recent version of bmake, use that.
                Unpack the source code:
                Unpack the source code:
                $ cd .../scratch
                $ cd .../scratch
                $ gunzip < make.tar.gz | tar xf -
                $ gunzip < make.tar.gz | tar xf -
                $ cd make
                $ cd make
                Apply the patch in make.diff.gz that fixes a minor
                Apply the patch in make.diff.gz that fixes a minor
                problem with a build under Solaris (by now it should
                problem with a build under Solaris (by now it should
                be fixed in the NetBSD-current source tree).
                be fixed in the NetBSD-current source tree).
                $ gunzip < ../make.diff.gz | more
                $ gunzip < ../make.diff.gz | more
                $ gunzip < ../make.diff.gz | patch
                $ gunzip < ../make.diff.gz | patch
                Build it
                Build it
                $ make -f Makefile.boot 'CC=gcc -g -DPOSIX'
                $ make -f Makefile.boot 'CC=gcc -g -DPOSIX'
                With bmake built, install it into the target specific bin
                With bmake built, install it into the target specific bin
                directory:
                directory:
                $ cp bmake /applications/psim/powerpc-unknown-eabi/bin/make
                $ cp bmake /applications/psim/powerpc-unknown-eabi/bin/make
                $ cd ..
                $ cd ..
                $ rm -rf make
                $ rm -rf make
        o       Set up a number of wrapper scripts for bmake so that it works.
        o       Set up a number of wrapper scripts for bmake so that it works.
                In addition to needing BSD make the build process assumes
                In addition to needing BSD make the build process assumes
                a number of BSD specific commands.  To get around this
                a number of BSD specific commands.  To get around this
                several wrapper scripts are available.
                several wrapper scripts are available.
                powerpc-unknown-eabi-make (clayton.make.sh)
                powerpc-unknown-eabi-make (clayton.make.sh)
                        Front end to Berkeley make setting it up for a
                        Front end to Berkeley make setting it up for a
                        cross compilation
                        cross compilation
                        $ cp clayton.make.sh \
                        $ cp clayton.make.sh \
                          /applications/psim/bin/powerpc-unknown-eabi-make
                          /applications/psim/bin/powerpc-unknown-eabi-make
                        $ chmod a+x \
                        $ chmod a+x \
                          /applications/psim/bin/powerpc-unknown-eabi-make
                          /applications/psim/bin/powerpc-unknown-eabi-make
                chown (clayton.chown.sh)
                chown (clayton.chown.sh)
                        Wrapper that does not do any thing.
                        Wrapper that does not do any thing.
                        Avoids the need to be root when installing.
                        Avoids the need to be root when installing.
                        $ cp clayton.chown.sh \
                        $ cp clayton.chown.sh \
                          /applications/psim/powerpc-unknown-eabi/bin/chown
                          /applications/psim/powerpc-unknown-eabi/bin/chown
                        $ chmod a+x \
                        $ chmod a+x \
                          /applications/psim/powerpc-unknown-eabi/bin/chown
                          /applications/psim/powerpc-unknown-eabi/bin/chown
                install (clayton.install.sh)
                install (clayton.install.sh)
                        Wrapper to strip away a number of bsd specific install
                        Wrapper to strip away a number of bsd specific install
                        arguments.
                        arguments.
                        $ cp clayton.install.sh \
                        $ cp clayton.install.sh \
                          /applications/psim/powerpc-unknown-eabi/bin/install
                          /applications/psim/powerpc-unknown-eabi/bin/install
                        $ chmod a+x \
                        $ chmod a+x \
                          /applications/psim/powerpc-unknown-eabi/bin/install
                          /applications/psim/powerpc-unknown-eabi/bin/install
                lorder (clayton.lorder.sh)
                lorder (clayton.lorder.sh)
                        Tweaked lorder script that will use nm etc from
                        Tweaked lorder script that will use nm etc from
                        binutils.
                        binutils.
                        $ cp clayton.lorder.sh \
                        $ cp clayton.lorder.sh \
                          /applications/psim/powerpc-unknown-eabi/bin/lorder
                          /applications/psim/powerpc-unknown-eabi/bin/lorder
                        $ chmod a+x \
                        $ chmod a+x \
                          /applications/psim/powerpc-unknown-eabi/bin/lorder
                          /applications/psim/powerpc-unknown-eabi/bin/lorder
                printf (?)
                printf (?)
                        Some operating systems don't include the program
                        Some operating systems don't include the program
                        printf.  If you host doesn't have one, then a
                        printf.  If you host doesn't have one, then a
                        good source is the gnu sh-utils version.
                        good source is the gnu sh-utils version.
                        Again, if that program is missing, then I suggest
                        Again, if that program is missing, then I suggest
                        installing it onto the powerpc specific program
                        installing it onto the powerpc specific program
                        directory:
                        directory:
                        /applications/psim/powerpc-unknown-eabi/bin
                        /applications/psim/powerpc-unknown-eabi/bin
        o       Unpack the bsd source code (if you haven't already)
        o       Unpack the bsd source code (if you haven't already)
                If you're short on disk space (like me) just unpack:
                If you're short on disk space (like me) just unpack:
                        sys, lib, share/mk, include, usr.sbin/config,
                        sys, lib, share/mk, include, usr.sbin/config,
                        usr.sbin/dbsym, gnu/lib/libg++/g++-include,
                        usr.sbin/dbsym, gnu/lib/libg++/g++-include,
                        usr.bin/lex
                        usr.bin/lex
                Otherwize, assuming you have a CD-DRIVE:
                Otherwize, assuming you have a CD-DRIVE:
                $ cd .../scratch
                $ cd .../scratch
                $ mkdir bsd-src
                $ mkdir bsd-src
                $ cd bsd-src
                $ cd bsd-src
                $ for d in /cdrom/bsdisc_12_95_disc2/NetBSD-1.1/source/*11
                $ for d in /cdrom/bsdisc_12_95_disc2/NetBSD-1.1/source/*11
                  do
                  do
                    echo $d
                    echo $d
                    cat $d/*.?? | gunzip | tar xf -
                    cat $d/*.?? | gunzip | tar xf -
                  done
                  done
                Flatten the directory structure a little.
                Flatten the directory structure a little.
                $ mv usr/src/* .
                $ mv usr/src/* .
                $ rmdir usr/src usr
                $ rmdir usr/src usr
                $ cd ..
                $ cd ..
        o       Apply the clayton (PowerPC) patches to your constructed
        o       Apply the clayton (PowerPC) patches to your constructed
                tree.
                tree.
                $ cd .../scratch
                $ cd .../scratch
                $ cd bsd-src
                $ cd bsd-src
                Diffs are applied using something like:
                Diffs are applied using something like:
                $ gunzip < ../clayton-include-960312.diff.gz | patch -p1
                $ gunzip < ../clayton-include-960312.diff.gz | patch -p1
                $ gunzip < ../clayton-lib-960203.diff.gz | patch -p1
                $ gunzip < ../clayton-lib-960203.diff.gz | patch -p1
                $ gunzip < ../clayton-sys-960203.diff.gz | patch -p1
                $ gunzip < ../clayton-sys-960203.diff.gz | patch -p1
                The patch to sys/dev/pci/ncr.c.rej might fail.
                The patch to sys/dev/pci/ncr.c.rej might fail.
                The tar archives have a different problem, you need
                The tar archives have a different problem, you need
                to remove the `src' prefix.  I used
                to remove the `src' prefix.  I used
                $ ln -s . src
                $ ln -s . src
                $ gunzip < ../clayton-lib-960203.tar.gz | tar xvf -
                $ gunzip < ../clayton-lib-960203.tar.gz | tar xvf -
                $ gunzip < ../clayton-sys-960203.tar.gz | tar xvf -
                $ gunzip < ../clayton-sys-960203.tar.gz | tar xvf -
                So that src/xxx unpacked into ./xxx
                So that src/xxx unpacked into ./xxx
                $ cd ..
                $ cd ..
        o       install Berkeley make's include (mk) files.
        o       install Berkeley make's include (mk) files.
                $ cd .../scrath
                $ cd .../scrath
                $ cd bsd-src/share
                $ cd bsd-src/share
                $ tar cf - mk | ( cd /applications/psim/bsd-root/usr/share \
                $ tar cf - mk | ( cd /applications/psim/bsd-root/usr/share \
                     && tar xvf - )
                     && tar xvf - )
                $ cd ../..
                $ cd ../..
        o       Install the include files
        o       Install the include files
                $ cd .../scratch
                $ cd .../scratch
                $ cd bsd-src/include
                $ cd bsd-src/include
                $ powerpc-unknown-eabi-make install
                $ powerpc-unknown-eabi-make install
                $ cd ../..
                $ cd ../..
        o       Install a few other include files.
        o       Install a few other include files.
                As discussed above in the section on building libnew,
                As discussed above in the section on building libnew,
                the build process can have chicken/egg problems.  In the
                the build process can have chicken/egg problems.  In the
                case of BSD's libc, it wants to use several include files
                case of BSD's libc, it wants to use several include files
                (from the installed include directory) before they are
                (from the installed include directory) before they are
                installed.  Just copy them in as seen below:
                installed.  Just copy them in as seen below:
                $ cd .../scratch
                $ cd .../scratch
                $ cd bsd-src
                $ cd bsd-src
                $ cp gnu/lib/libg++/g++-include/values.h \
                $ cp gnu/lib/libg++/g++-include/values.h \
                    /applications/psim/powerpc-unknown-eabi/include
                    /applications/psim/powerpc-unknown-eabi/include
                $ cp lib/libcurses/curses.h \
                $ cp lib/libcurses/curses.h \
                    /applications/psim/powerpc-unknown-eabi/include
                    /applications/psim/powerpc-unknown-eabi/include
                $ cd ..
                $ cd ..
        o       Unpack/patch/build/install BINUTILS
        o       Unpack/patch/build/install BINUTILS
                $ cd .../scratch
                $ cd .../scratch
                $ gunzip < binutils-2.6.tar.gz | tar xf -
                $ gunzip < binutils-2.6.tar.gz | tar xf -
                gas (bfd) 2.6 didn't support the reading and writing of
                gas (bfd) 2.6 didn't support the reading and writing of
                note sections.  The patch binutils-2.6+note.diff.gz
                note sections.  The patch binutils-2.6+note.diff.gz
                adds support for this.  PowerPC/ELF boot files being loaded
                adds support for this.  PowerPC/ELF boot files being loaded
                by OpenBoot ROM's should contain a PowerPC note section.
                by OpenBoot ROM's should contain a PowerPC note section.
                $ cd .../scratch
                $ cd .../scratch
                $ cd binutils-2.6/bfd
                $ cd binutils-2.6/bfd
                $ gunzip < ../../binutils-2.6+note.diff.gz | more
                $ gunzip < ../../binutils-2.6+note.diff.gz | more
                $ gunzip < ../../binutils-2.6+note.diff.gz | patch
                $ gunzip < ../../binutils-2.6+note.diff.gz | patch
                $ cd ../..
                $ cd ../..
                Then continue with the build
                Then continue with the build
                $ cd .../scratch
                $ cd .../scratch
                $ cd binutils-2.6
                $ cd binutils-2.6
                $ ./configure --target=powerpc-unknown-eabi \
                $ ./configure --target=powerpc-unknown-eabi \
                              --prefix=/applications/psim
                              --prefix=/applications/psim
                $ make
                $ make
                $ make install
                $ make install
                $ cd ..
                $ cd ..
                $ rm -rf binutils-2.6
                $ rm -rf binutils-2.6
                This has the intended side effect of partially populating
                This has the intended side effect of partially populating
                the psim directory tree which makes follow on steps easier.
                the psim directory tree which makes follow on steps easier.
        o       Unpack/patch/build/install GCC
        o       Unpack/patch/build/install GCC
                $ cd .../scratch
                $ cd .../scratch
                $ gunzip < gcc-2.7.2.tar.gz | tar xf -
                $ gunzip < gcc-2.7.2.tar.gz | tar xf -
                $ cd gcc-2.7.2
                $ cd gcc-2.7.2
                GCC-2.7.2 and the BSD include files have a conflicting type
                GCC-2.7.2 and the BSD include files have a conflicting type
                declaration.  The patch below gets around this problem
                declaration.  The patch below gets around this problem
                (it may still be applicable to more recent versions of
                (it may still be applicable to more recent versions of
                GCC):
                GCC):
                $ gunzip < ../gcc-2.7.2+sys-types.diff.gz | more
                $ gunzip < ../gcc-2.7.2+sys-types.diff.gz | more
                $ gunzip < ../gcc-2.7.2+sys-types.diff.gz | patch
                $ gunzip < ../gcc-2.7.2+sys-types.diff.gz | patch
                If your version of GCC includes the file ginclude/ppc-asm.h
                If your version of GCC includes the file ginclude/ppc-asm.h
                then you should install that header file into the directory:
                then you should install that header file into the directory:
                /applications/psim/powerpc-unknown-eabi/include.  More
                /applications/psim/powerpc-unknown-eabi/include.  More
                recent versions of GCC expect this file to be installed:
                recent versions of GCC expect this file to be installed:
                $ test -r ginclude/ppc-asm.h \
                $ test -r ginclude/ppc-asm.h \
                  && cp ginclude/ppc-asm.h \
                  && cp ginclude/ppc-asm.h \
                     /applications/psim/powerpc-unknown-eabi/include
                     /applications/psim/powerpc-unknown-eabi/include
                Other than that, assuming the include files installed
                Other than that, assuming the include files installed
                okay, the rest should be fine ....
                okay, the rest should be fine ....
                $ ./configure --target=powerpc-unknown-eabi \
                $ ./configure --target=powerpc-unknown-eabi \
                              --prefix=/applications/psim
                              --prefix=/applications/psim
                $ make CC=gcc
                $ make CC=gcc
                $ make CC=gcc install
                $ make CC=gcc install
                $ cd ..
                $ cd ..
                $ rm -rf gcc-2.7.2
                $ rm -rf gcc-2.7.2
        o       Build/install the Berkeley library:
        o       Build/install the Berkeley library:
                $ cd .../scratch
                $ cd .../scratch
                $ cd bsd-src/lib
                $ cd bsd-src/lib
                $ powerpc-unknown-eabi-make
                $ powerpc-unknown-eabi-make
                $ powerpc-unknown-eabi-make install
                $ powerpc-unknown-eabi-make install
                $ cd ../..
                $ cd ../..
                If you encounter problems check the following (each
                If you encounter problems check the following (each
                discussed above):
                discussed above):
                        o       GCC and BSD have a common include
                        o       GCC and BSD have a common include
                                directory
                                directory
                        o       all the missing include files installed
                        o       all the missing include files installed
                        o       all the wrapper programs installed
                        o       all the wrapper programs installed
        o       Build/run a simple BSD program
        o       Build/run a simple BSD program
                $ cd .../scratch
                $ cd .../scratch
                $ cd bsd-src/usr.bin/printenv
                $ cd bsd-src/usr.bin/printenv
                $ powerpc-unknown-eabi-make
                $ powerpc-unknown-eabi-make
                $ powerpc-unknown-eabi-run printenv
                $ powerpc-unknown-eabi-run printenv
                .
                .
                .
                .
                .
                .
    ----------------------------------------------------------------------
    ----------------------------------------------------------------------
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.