uClinux for Sparc-MMUless with EthernetMAC: Patches
Introduction
I did the following changes to the latest uClinux sparc-port to get it running on
an XSV800-board. I used the LEON-1 core (from
http://www.gaisler.com) without mul and div instructions, with the
open Ethernet MAC (from
http://www.opencores.org).
A demonstration of the boot sequence, the invocation of user programs and the telnet
connection from PC to the board can be found here.
Applying the patches
These patches can be applied to the uClinux distrubution
uClinux-dist-20030305; see
http://www.leox.org.
Be careful: Some patches contain changes that are specific to my target, that is
clock frequency (25MHz), baud rate (38400) and memory layout. I didn't remove them,
because I wanted to test the patches on my system. I didn't and I counldn't test all
possible combinations of these patches.
Apply the patches in the top-level directory (the directory containing
the uClinux-dist directory) and type:
patch -p1 <fixes.diff
General fixes
Download: fixes.diff
This patch contains general fixes for this uClinux port. It allows you to start
user applications from the shell.
At least the following applications will compile and run: sash, ifconfig, route, ping,
inetd, telnetd.
Changes:
- A fix for system calls in general. They used to return a positive number for
errors with carry-flag set. But this version of libc awaits negative error
codes (I think they changed this in version 2.4).
- fork did not return the right value (0) for the forked task, but the
pid of the parent. Additionally the stack_offset of the new task was
initialized with a wrong value.
- Concerning signals, the stack frame was not set up correctly, so that execution
could not continue after the signal handler.
- There was a bug in LEONserial.c, setting the wrong divisor for the
baud-rate.
- The timers were initialized with the wrong divisors (now there are three
places in the source where the clock frequency is defined; needs cleanup).
Memory layout for kernel in RAM
Download: ram_kernel.diff
This patch includes the memory layout to be used when the kernel should be located
in RAM area. Note that you will have to change this in the configuration, too.
Locating the kernel in ROM will still work after this patch.
Changes:
- New files crt0_ram.S and ram.ld.
- A slight modification of rom.ld to make things consistent.
- A modification to blkmem.c, such that it still finds the romfs.
- Some modifications of platform dependend code, especially setup.c.
Incorporation of the Ethernet MAC
Download: open_eth.c, open_eth.h,
open_eth.diff
Place the open_eth-files in the drivers/net dirctory before applying the
patch. Those are the same files which can be found at
http://www.opencores.org/cvsweb.shtml/or1k/uclinux/uClinux-2.0.x/drivers/net.
The patch adds some options to the graphical configuration, allowing to set the
MAC-address, IRQ and base-address of the Ethernet MAC.
Note that you will get a memory access violation if you enable the Ethernet MAC and
run it on TSIM. Enabling networking and the loopback device will work also on the
simulator.
Changes:
- Adds new options to the configuration.
- Patches the file open_eth.c to solve a memory alignment problem.
Support for LEON without mul and div instructions
Download: sparcv7.diff
This patch allows running the uClinux port on processors without mul and div
instructions. If you use a processor without the mulscc instruction, also download
umul.S and place it in the arch/sparcnommu/lib
directory.
Changes:
- Replaces the compiler option -mv8 with -mcpu=v7 in some
makefiles.
- Changes makefiles to include the library in arch/sparcnommu/lib. This
is a substitute of the libgcc1 library which is included in the cross compiler,
used to emulate some special instructions, like mul and div. This change has
effects only if you replace the emulation code, like with my umul.S.
Network configuration
Download: romfs.etc.tar.gz
This is an example for the network configuration files in the romfs/etc
directory.