How to set up hardware and software
Note: This HowTo is intended for students at the IAIK who have
access to the actual SPARC/Ethernet MAC soft-core.
Setting up the necessary tools
First, get the LEOX toolbox from www.leox.org,
page about Development Tools, section: "Development Tools: LEOX Cross Development
Kit (CDK)". Follow the instructions for setup.
You will need the following tools from this toolbox:
- GCC: The GNU C compiler.
- GDB: The GNU debugger.
- Insight: A graphical user interface for GDB which allows
easy debugging of the linux kernel on the simulator and
on real hardware.
- binutils: Several utilities to manage object files.
- genromfs: Creates a ROM file system image.
- TSIM: The LEON-sparc simulator.
Additionally you will need:
- DSUMON: A tool for interfacing the hardware debug support
unit on the processor. It allows debugging on real hardware
either by command line or with GUI (insight).
Download at: www.gaisler.com.
- XSTOOLS: Tools to configure and to program the XSV-board.
Download at: www.xess.com.
Under Linux, the xstools must be executed with root privileges. To make things
easier, type:
chown root <program>
chmod u+s <program>
for each executable that comes with the xstools.
- Minicom: A terminal for Linux, comparable to hyperterminal.
Minicom needs root privileges to save its settings.
For running a compiled version of uClinux on the XSV800 board, you will just need
the XSTOOLS and a terminal program. In this case, continue to read at chapter
Connecting and configuring the XSV-board.
Compiling the uClinux port for LEON
Follow the instructions from www.leox.org,
page about Software IPs, section: "Software IP: uClinux port".
Compile the original uClinux as described.
If you are doing this for the first time, you might want to skip the rest of
this section.
Then, apply the patches you need, run
"make xconfig" again.
Kernel configuration:
- In "Platform dependant setup", choose "Kernel executes from RAM".
- In "Networking options", enable "TCP/IP networking".
- In "Network device support", enable "Network device support".
Here you can also enable the option "Open Ethernet MAC support" and set
its base address, IRQ, and MAC-address.
Application configuration:
- In "Network configuration", enable the following programs: ifconfig,
route, ping, inetd, telnetd
Don't forget to "make dep" after changing kernel settings.
Simulation
Note that it is not possible to simulate uClinux with the
Ethernet MAC driver. This will result in an access violation
when trying to access the Ethernet MAC's IO-ports.
For command line debugging:
tsim-leon -nfp -freq 25 -nov8 images/image.elf
For debugging with GUI:
sparc-elf-gdb images/image.elf &
tsim-leon -nfp -freq 25 -nov8 -gdb
For further information refer to:
www.leox.org,
page about Software IPs,
section: "Software IP: uClinux port" (second part)
If you use the board for the first time, follow the instructions
of the chapter "Installation" in the XSV-board manual to test your
board and to set the clock frequency to 25MHz.
To configure the programmable logic, you need to download the following
three files in this sequence (necessary every time after power-up):
- dwnldpar.svf to CPLD: configures the CPLD to allow programming
of the FPGA. This file is included with xstools.
- leon-bitfile to FPGA (final_leon.bit).
- CPLD configuration to CPLD (leon_mac_eth.svf).
Windows: "gxsload"; Drag the files into CPLD/FPGA sections and press "load".
Linux: "xsload [-cpld|-fpga] <filename>"
The processor has two serial ports, one for UART A and one for
the integrated debug support unit (DSU). Both ports are joined in the
single serial connector on the XSV-board. Therefore you will need
a split serial cable. Connect DSUMON output to ttyS0 (COM1) and UART A
output to ttyS1 (COM2).
Pin assignment of the serial connector:
Description | Pin on XSV-board | Pin on COM1 | Pin on COM2 |
RXD1 | 2 | 2 | - |
TXD1 | 3 | 3 | - |
GND | 5 | 5 | 5 |
TXD2 | 7 | - | 2 |
RXD2 | 8 | - | 3 |
Use the following settings for minicom or hyperterminal:
- Choose /dev/ttyS1 (COM2)
- Comm-settings: 38400 baud, 8 data bits, no parity, 1 stop bit.
- Terminal-settings: VT102, backspace is DEL.
- Disable hardware- and software-flow-control.
To verify the FPGA and CPLD configuration and the terminal settings,
press the reset button (SW1). The following prompt should appear:
LEON-1: 1*2048K 32-bit memory, rmw
>
Downloading and debugging Linux
There are several ways to download programs to the board:
Using DSUMON:
You can use DSUMON either with or without GDB.
DSUMON without GBD:
dsumon images/image.elf
This starts the download automatically. When it is complete, type "go"
to run the program.
DSUMON with GDB:
sparc-elf-gdb images/image.elf &
dsumon -gdb
Insight needs the same Target Settings as for simulation with TSIM, except
for the port number:
- Target: Remote/TCP
- Hostname: localhost
- Port: 1235
- More Options: only select "Attach to Target", run method: "Run Program".
From the Run menu execute in this order:
- Connect to target
- Download
- Run
Download will take one or two minutes.
Debugging works the same way as with TSIM, but it is slower.
Without DSUMON (no debugging):
You need the kernel image in srec-format. To convert from elf to srec
format, type:
sparc-elf-objcopy -O srec images/image.elf images/image.srec
Press reset (SW1) to get the prompt in your terminal window. Now simply
download the image.srec file to the board in raw ASCII mode. After the
download has finished, Linux boots automatically.
The disadvantage of this method is, that it is very slow, because the
srec-file has a size of about 2 megabytes (when downloading with DSUMON,
only 700k are transferred and the baud rate is higher).