To build PSIM you will need the following:
gdb-4.16.tar.gz
gcc
$ cd .../scratch $ gunzip < gdb-4.16.tar.gz | tar xf -
First consult the gdb documentation
$ cd .../scratch $ cd gdb-4.16 $ more README $ more gdb/README
then something like (I assume SH):
$ CC=gcc ./configure \ --enable-sim-powerpc \ --target=powerpc-unknown-eabi \ --prefix=/applications/psim
$ make CC=gcc
alternatively, if you are short on disk space or only want to build the simulator:
$ ( cd libiberty && make CC=gcc ) $ ( cd bfd && make CC=gcc ) $ ( cd sim/ppc && make CC=gcc )
$ make CC=gcc install
or just
$ cp gdb/gdb ~/bin/powerpc-unknown-eabisim-gdb $ cp sim/ppc/run ~/bin/powerpc-unknown-eabisim-run
A PSIM is an ongoing development. Occasional snapshots which both contain new features and fix old bugs are made available. See the ftp directory:
ftp://ftp.ci.com.au/pub/psim or ftp://cambridge.cygnus.com/pub/psim
for the latest version. To build/install one of these snapshots, you replace the sim/ppc found in the gdb archive with with one from the snapshot. Then just re-configure and rebuild/install.
$ cd gdb-4.16
$ mv sim/ppc sim/old.ppc
$ gunzip < ../psim-NNNNNN-src.tar.gz | tar tf - | more $ gunzip < ../psim-NNNNNN-src.tar.gz | tar xf -
$ CC=gcc ./configure \ --enable-sim-powerpc \ --target=powerpc-unknown-eabi \ --prefix=/applications/psim $ make CC=gcc
From time to time, problems involving the integration of PSIM into gdb are found. While eventually each of these problems is resolved there can be periouds during which a local hack may be needed.
At the time of writing the following were outstanding:
ftp://ftp.ci.com.au/pub/psim/gdb-4.15+attach.diff.gz or ftp://cambridge.cygnus.com/pub/psim/gdb-4.15+attach.diff.gzPSIM, unlike the other simulators included with GDB, is able to load the description of a target machine (including the initial state of all processor registers) from a file. Unfortunatly GDB does not yet have a standard command that facilitates the use of this feature. Until such a command is added, the above patch (hack?) can be used to extend GDB's attach command so that it can be used to initialize the simulators configuration from a file.
ftp://ftp.ci.com.au/pub/psim/gdb-4.16+count.diff.gz or ftp://cambridge.cygnus.com/pub/psim/gdb-4.16+count.diff.gzMore recent versions of PSIM include partial support for the pseudo registers
cycles
, insns
and stalls
which are used
to access profiling information. Before they can be used with gdb-4.16
(built with a more recent PSIM), the above patch should be applied.
ftp://ftp.ci.com.au/pub/psim/gdb-4.16+svr4.diff.gz or ftp://cambridge.cygnus.com/pub/psim/gdb-4.16+svr4.diff.gzThis patch to gdb's configuration files adds additional targets for which PSIM will be built.
PSIM's compile time configuration is controlled by autoconf. PSIM's configure script recognises options of the form:
--enable-sim-<option>[=<val>]
And can be specified on the configure command line (at the top level of the gdb directory tree) vis:
$ cd gdb-4.15 $ CC=gcc ./configure \ --target=powerpc-unknown-eabisim \ --prefix=/applications/psim \ --enable-sim-inline $ make CC=gcc
For a brief list of PSIM's configuration options, configure --help will list them vis:
$ cd sim/ppc $ ./configure --help
Each PSIM specific option is discussed in detail below.
Here of note are:
CC=gcc ./configure \ --prefix=/applications/psim \ --target=powerpc-unknown-eabi \ --enable-sim-powerpc \ --enable-sim-warnings \ --enable-sim-inline \ --disable-sim-smp \ --enable-sim-duplicate \ --enable-sim-endian=big \ --disable-sim-xor-endian \ --enable-sim-env=user \ --disable-sim-reserved-bits \ --disable-sim-assert \ --disable-sim-trace \ --enable-sim-cflags='-g0,-O2,-fno-strength-reduce,-fomit-frame-pointer'
The key configuration changes are:
CC=gcc ./configure \ --prefix=/applications/psim \ --target=powerpc-unknown-eabi \ --enable-sim-powerpc \ --enable-sim-inline \ --disable-sim-smp \ --enable-sim-duplicate \ --enable-sim-endian=big \ --disable-sim-xor-endian \ --enable-sim-env=operating \ --disable-sim-reserved-bits \ --disable-sim-assert \ --disable-sim-trace \ --enable-sim-opcode=ppc-opcode-flat \ --disable-sim-icache \ --enable-sim-cflags='-g0,-O3,-fno-strength-reduce,-fomit-frame-pointer'