Debugging software with the UNISIM Virtex 5 FXT Simulator
The goal of that tutorial is to show
how to start debugging sessions with the UNISIM Virtex 5 FXT
Simulator. The UNISIM Virtex 5 FXT simulator supports two methods
for debugging a software application: (1) a built-in console
debugger (inline-debugger); (2) the simulator is a remote target
(over TCP/IP) for the GNU GDB debugger. Below, we show step by
step, how to build a cross tool-chain, a Linux kernel and the
MiBench benchmark suite for the simulator, and then start debugging
sessions of a MiBench benchmark.
See also “UNISIM Virtex 5 FXT Simulator Manual”.
1. Build a cross tool-chain for PPC440FP
$ cd ${HOME}
$ wget http://unisim-vp.org/downloads/other/crosstool/crosstool-source-v4.tar.gz
$ tar zxvf crosstool-source-v4.tar.gz
$ mv crosstool-source-v4 cross_compiler
$ cd cross_compiler
$ ./build.sh all powerpc-440fp-linux-gnu
See also “Building a GNU
Cross tool-chain for PPC440FP”.
$ wget http://unisim-vp.org/downloads/other/crosstool/crosstool-source-v4.tar.gz
$ tar zxvf crosstool-source-v4.tar.gz
$ mv crosstool-source-v4 cross_compiler
$ cd cross_compiler
$ ./build.sh all powerpc-440fp-linux-gnu
2. Build the simulator
$ cd ${HOME}
$ wget http://unisim-vp.org/downloads/virtual-platforms/powerpc/virtex5fxt/unisim-virtex5fxt-1.0beta12.tar.gz
$ tar zxvf unisim-virtex5fxt-1.0beta12.tar.gz
$ cd unisim-virtex5fxt-1.0beta12
$ ./configure --with-systemc=${HOME}/systemc CXXFLAGS='-O3 -g3 -Wall'
$ make
See also “How to install SystemC?”.$ wget http://unisim-vp.org/downloads/virtual-platforms/powerpc/virtex5fxt/unisim-virtex5fxt-1.0beta12.tar.gz
$ tar zxvf unisim-virtex5fxt-1.0beta12.tar.gz
$ cd unisim-virtex5fxt-1.0beta12
$ ./configure --with-systemc=${HOME}/systemc CXXFLAGS='-O3 -g3 -Wall'
$ make
See also “UNISIM Virtex 5 FXT Simulator Manual”.
3. Build the Mibench benchmark suite for PPC440FP
$ cd ${HOME}
$ wget http://unisim-vp.org/downloads/other/benchmarks/mibench/mibench-v1-source-v5.tar.gz
$ tar zxvf mibench-v1-source-v5.tar.gz
$ mv mibench-v1-source-v5 mibench
$ cd mibench
$ ./build.sh --target=powerpc-440fp-linux-gnu --cross-compiler-prefix=${HOME}/cross_compiler/powerpc-440fp-linux-gnu --target-simulator="${HOME}/unisim-virtex5fxt-1.0beta12/virtex5fxt/bin/unisim-virtex5fxt-wfpu-1.0beta12 -s enable-linux-os=1" all
See also “Building the
MiBench benchmark suite for PPC440FP”.
$ wget http://unisim-vp.org/downloads/other/benchmarks/mibench/mibench-v1-source-v5.tar.gz
$ tar zxvf mibench-v1-source-v5.tar.gz
$ mv mibench-v1-source-v5 mibench
$ cd mibench
$ ./build.sh --target=powerpc-440fp-linux-gnu --cross-compiler-prefix=${HOME}/cross_compiler/powerpc-440fp-linux-gnu --target-simulator="${HOME}/unisim-virtex5fxt-1.0beta12/virtex5fxt/bin/unisim-virtex5fxt-wfpu-1.0beta12 -s enable-linux-os=1" all
4. Build a Linux distribution for the UNISIM Virtex 5 FXT Simulator
$ cd ${HOME}
$ wget http://unisim-vp.org/downloads/other/benchmarks/linux-distro/unisim-virtex5fxt-linux-distro-source-v5.tar.gz
$ tar zxvf unisim-virtex5fxt-linux-distro-source-v5.tar.gz
$ cd unisim-virtex5fxt-linux-distro-source-v5
$ ./build.sh all ${HOME}/mibench/builds/powerpc-440fp-linux-gnu ${HOME}/cross_compiler/powerpc-440fp-linux-gnu
See also “Building a Linux
distribution for the UNISIM Virtex 5 FXT Simulator”.
$ wget http://unisim-vp.org/downloads/other/benchmarks/linux-distro/unisim-virtex5fxt-linux-distro-source-v5.tar.gz
$ tar zxvf unisim-virtex5fxt-linux-distro-source-v5.tar.gz
$ cd unisim-virtex5fxt-linux-distro-source-v5
$ ./build.sh all ${HOME}/mibench/builds/powerpc-440fp-linux-gnu ${HOME}/cross_compiler/powerpc-440fp-linux-gnu
5. Start the simulator
As an example, we propose to start a debug session of MiBench CRC32 benchmark (small data set). To debug the benchmark using the built-in debugger (inline-debugger), do the following:$ cd
${HOME}/unisim-virtex5fxt-linux-distro-source-v5
$ ${HOME}/unisim-virtex5fxt-1.0beta12/virtex5fxt/bin/unisim-virtex5fxt-wfpu-1.0beta12 -c config/sim_config_telecomm_crc32_small.xml -s enable-inline-debugger=true
To debug the benchmark using an external GNU cross-GDB debugger, do
the following:
$ ${HOME}/unisim-virtex5fxt-1.0beta12/virtex5fxt/bin/unisim-virtex5fxt-wfpu-1.0beta12 -c config/sim_config_telecomm_crc32_small.xml -s enable-inline-debugger=true
$ cd
${HOME}/unisim-virtex5fxt-linux-distro-source-v5
$ ${HOME}/unisim-virtex5fxt-1.0beta12/virtex5fxt/bin/unisim-virtex5fxt-wfpu-1.0beta12 -c config/sim_config_telecomm_crc32_small.xml -s enable-gdb-server=true -s gdb-server.tcp-port=1235
See also “Booting Linux on the UNISIM
Virtex 5 FXT Simulator”.
$ ${HOME}/unisim-virtex5fxt-1.0beta12/virtex5fxt/bin/unisim-virtex5fxt-wfpu-1.0beta12 -c config/sim_config_telecomm_crc32_small.xml -s enable-gdb-server=true -s gdb-server.tcp-port=1235
6. Connect an external GNU cross-GDB debugger to the simulator
For the GNU cross-GDB debugger, do the following:$ cd
${HOME}/unisim-virtex5fxt-linux-distro-source-v5
$ ${HOME}/cross_compiler/powerpc-440fp-linux-gnu/bin/powerpc-440fp-linux-gnu-gdb -d ${HOME}/unisim-virtex5fxt-linux-distro-source-v4/linux-3.8.13 -d ${HOME}/unisim-virtex5fxt-linux-distro-source-v4/linux-3.8.13/arch/powerpc/kernel vmlinux
For the GNU DDD debugger (the graphical font-end for GDB), do the
following:
$ ${HOME}/cross_compiler/powerpc-440fp-linux-gnu/bin/powerpc-440fp-linux-gnu-gdb -d ${HOME}/unisim-virtex5fxt-linux-distro-source-v4/linux-3.8.13 -d ${HOME}/unisim-virtex5fxt-linux-distro-source-v4/linux-3.8.13/arch/powerpc/kernel vmlinux
$ cd
${HOME}/unisim-virtex5fxt-linux-distro-source-v5
$ ddd --debugger ${HOME}/cross_compiler/powerpc-440fp-linux-gnu/bin/powerpc-440fp-linux-gnu-gdb --directory=${HOME}/unisim-virtex5fxt-linux-distro-source-v4/linux-3.8.13 --directory=${HOME}/unisim-virtex5fxt-linux-distro-source-v4/linux-3.8.13/arch/powerpc/kernel vmlinux
In the debugger console, do the following to initialize a
connection with the simulator:
$ ddd --debugger ${HOME}/cross_compiler/powerpc-440fp-linux-gnu/bin/powerpc-440fp-linux-gnu-gdb --directory=${HOME}/unisim-virtex5fxt-linux-distro-source-v4/linux-3.8.13 --directory=${HOME}/unisim-virtex5fxt-linux-distro-source-v4/linux-3.8.13/arch/powerpc/kernel vmlinux
(gdb) target remote :1235
7. Connect a telnet client to the simulator
$ telnet localhost 1234
Steps 5 to 7 in a video...
Debugging a software application with the UNISIM Virtex 5 FXT Simulator and GNU DDD |