NetBSD
for
Motorola MPC821, MPC823, MPC860
History
Real-Time Systems has always used fairly sophisticated software techniques,
such as multitasking and TCP/IP, even on low-end hardware such as the
Motorola 68HC11. Recently, however, the definition of "low-end" has moved
upscale far enough to consider embedding even complex OS's like Unix.
Our experience with the relatively high quality of Linux (which we use on
most of our desktop systems) has led us to consider open-source Unix-like
OS's for embedded control. In examining the various free Unix's, NetBSD
stands out to us as a good choice for embedded work:
- No other OS runs on as many platforms. This is important for us,
since we don't always have a free choice of CPU in our work.
- The I/O model seems especially portable, to the extent that a given
I/O driver can work on multiple platforms, or simultaneously on multiple
different busses on a single platform.
- The support for emerging technologies, such as IPv6 and USB, seems
quite up-to-date
- The kernel and standard userland utilities build from a single
source-code tree, which is kept under a single revision-control system.
- The BSD license on the kernel and core utilities is probably a better
fit for embedded work than the GNU licenses used by, say, Linux.
- The code base has 30 years of development behind it.
It is for these reasons that we've decided to make NetBSD one of our
standard technologies. As a warm-up project, we are porting NetBSD to the
Motorola MPC8xx series of embedded PowerPC devices. These devices combine a
PowerPC CPU core with a truly mind-boggling package of on-chip I/O devices,
including on-chip Ethernet.
Our initial platform is the Motorola MBX821 evaluation board, which
comes with a 40 MHz MPC821, 16 Mbyte of RAM, 8 Mbyte of Flash ROM, a full
set of PC-clone-style external peripherals, a PCMCIA socket, PCI and ISA
busses, PC-104-plus capability, and a 10-base-T Ethernet port.
Porting tasks
So far, we have identified the following major porting tasks:
- Cross-building. We need to learn to cross-build NetBSD on our
i386 desktop. We also need to choose a similar port as a starting point.
- Floating-point. The designers of the MPC8xx series threw the FPU
overboard to make room for all of those great peripherals. This is unlike
the existing PowerPC devices supported by NetBSD, so we need to set up
floating-point emulation.
- System startup. The MBX821 evaluation board comes with a very
nice hex monitor in ROM which will do BOOTP to get us on the network. It
will then fetch an ELF file into memory via the Ethernet using TFTP and
run it. Our task here is to get loaded properly, then to ensure that the
kernel's boot-up messages go out through the monitor's serial port driver.
- MMU driver. The MPC8xx MMU differs significantly from the MMU
used in the other PowerPC chips supported by NetBSD. While the designers
have incorporated a little support for software emulation of the mainline
PowerPC MMU design, there would probably be large performance hit to do
so. Since the i386 MMU design is well-commented and seems similar to the
MPC8xx design, we will probably start there.
- I/O drivers. While we should be able to get basic functionality
from the MBX board by plugging in ISA and PCI cards, we will eventually
want to discard these in favor of the on-chip devices.
Progress
So far, we've accomplished the following:
- We've added a new port, "mpc8xx" to the appropriate points in the
source tree. The mpc8xx port starts as just a copy of the prep port.
- We have created a set of scripts which allow us to track
NetBSD-current, and to cross-build any given port on our i386-NetBSD
desktop. We have a local CVS repository set up to keep track of the
changes to -current, and of course our additions.
When checked out from our repository (or created on your system using
our patch file, see our ftp site), there is a 'bin' directory at the same level
as the 'src' directory. This directory contains the scripts we use to
make, test-build, tag, and import changes:
-
mpc8xx-make obj release, when executed from within the
src directory, will make an object tree to build in, a destination tree
to install in, and a release tree to put the tarballs in. It will then
build the entire mpc8xx port from source.
-
mpc8xx-build will check out the NetBSD source, build
it, and if successful, 'cvs tag' it with a tag 'build_'.
-
mpc8xx-update will do a 'cvs update' of NetBSD-current
from netbsd.org, import into our archive, then check it out in
preparation for merging with our local changes. After this, it does a
diff against the previous version, then does a trial make.
- We have incorporated the softfloat library in
src/lib/libc/softfloat into the powerpc and mpc8xx ports. We, of course,
default to hardware floating-point for the existing ports. The
mpc8xx-make script sets the required switches to bring it in for the
mpc8xx port.
(...see
mpc8xx-current-20000711-build-20000713.patch)
- We've written a stand-alone loader for the Motorola MBX821 board
(which should also work fine on the MBX860 board). This loader is brought
in by the EPPC-Bug hex monitor supplied with the board. After the
stand-alone loader is resident, it uses utility routines supplied by the
hex monitor to bring the kernel into memory via TFTP. It then builds a
board info structure and passes it as an argument to the kernel.
To use this stand-alone loader, you'll need to enable the tftp daemon.
Add the following to your /etc/inetd.conf:
tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /tftpboot
It's also handy if you have a working DHCP server. If not, just
hard-wire the IP address and boot file name with the EPPC-Bug
niot command. See the doc directory for a dump
of the board configuration that we use.
Now make a symlink from /tftpboot to the
dst.mpc8xx directory created when you ran mpc8xx-make
obj release. This directory will eventually become the NFS-root
for a diskless system. For now we use only the stand-alone loader
(/tftpboot/usr/mdec/boot_eppcbug) and the kernel
(/tftpboot/netbsd).
To boot the kernel, connect to the MBX console port with a terminal
emulator, such as tip(1), then give the command:
EPPC-Bug>pl 20 0
EPPC-Bug should load and run the stand-alone loader, which should, in
turn, load and run the kernel.
- We have the kernel loading and doing some minimal
initialization, and we can print "Hello, NetBSD!" using the kernel's own
non-interrupt-driven "com" console driver. This shows that the kernel is
linked and loaded properly.
(...see
mpc8xx-current-20000913-build-20000928.patch)
Feedback
We offer this project in the hopes that someone will find it useful. We
welcome any comments, questions, requests, or bug reports you may have
regarding this project. We would also be pleased to collaborate with anyone
else who would find this port useful. Please feel free to contact us via email.
Copyright © Real-Time Systems Inc.
$Id: netbsd-mpc8xx.html,v 1.6 2002/08/20 22:49:23 jiang Exp $