Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Nov 2006 09:36:38 -0700 (MST)
From:      "M. Warner Losh" <imp@bsdimp.com>
To:        zaitsevbros@mail.ru
Cc:        freebsd-arm@freebsd.org
Subject:   Re: At91rm9200 how to start with FreeBSD
Message-ID:  <20061116.093638.63053940.imp@bsdimp.com>
In-Reply-To: <7380637.post@talk.nabble.com>
References:  <7380637.post@talk.nabble.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In message: <7380637.post@talk.nabble.com>
            Zuy <zaitsevbros@mail.ru> writes:
: How I'm soldering board based on AT91RM9200 with 16mb SDRAM and othe
: standartpPeripherals(USB, SD, UART ...). I'm going to run FreeBSD on this
: board, but unfortunately I do not know how to start.
: I havn't found any files connected with AT91RM9200 in FreeBSD6.0 Stable
: source files directory.
: I found from this board that freebsd works on at91rm9200.

Yes.  It does.  FreeBSD-current has the most up to date tested code
for this platform.  FreeBSD 6.2 will contain the tools you need to
build it, as well as a slightly less advanced version (the freeze date
for 6.2 was a while ago).  6.3 is likely to have even more advanced
support.

: I will deeply appreciate if someone could give me any information how to
: start working with freebsd on this controller. May any type of tutorial is
: available.
: I also interesting in main spets I have to do to get freeBSD working on
: at91rm9200.

At this point there's no "how to" tutorial.  Each of the different
boards based on the at91rm9200 seem to have different boot processes.
This makes it hard to write something that's generic, but I may try.

Here's the broad outlines.

First, your board will need to have some kind of bootstrap media.
The atmel part supports parallel flash, iic flash, and spi flash.
Once you have the basic bootstrap loaded, you will need to load a
kernel and file system from somewhere.

Given that your board is small, and that you have only 16MB of SDRAM,
I'd recommend using the SD card for your main storage.  If you do
this, then all you need in your bootstrap is enough storage to load
from the SD card, as well as storing the MAC address.  The bootloader
is responsible for progarmming the NIC's MAC address.  The 'boot2'
program allows for one to customize how things are done with it and
load off of an SD card.  It takes about 9kB of space right now.  The
Kwikbyte KB9202 board that I used has a 16kB IIC EEPROM that this
loader will fit into.  I use the upper part (last 256bytes) of the IIC
to store the MAC address.  This program should be fairly easy to
modify and adapt to your needs.  I've tried to make it as generic
possible, but some custom work might be needed.

There's some bootstrap tools called boot0, boot0iic and boot0spi that
will load and run a program, load and burn to iic an image and load
and burn to spi flash respectively.  The AT91RM9200 goes into 'baby
bird' mode if none of its boot images are good.  This is nothing more
than xmodem.  When I bring a board up, I usually load boot0iic and
boot2 using xmodem.  It turns out to be quiet simple.  Each board has
some low-level init that is the hardest part to get right since you
have to know the base clock frequency as well as the organization of
the SDRAM.

Once you have 'boot2' loading from some media, then you need to get it
loading a kernel from an SD card.  Today, you have to load a kernel
linked to be loaded at a physical address (cognet sent me patches to
allow virtual too, but my KB9202's iic eeprom is dead).  There's a
special kernel target call 'trampoline' or 'kernel.tramp' that will
create a compressed image suitable for booting (use kernel.gz.tramp).

An alternative is to use bootiic or bootspi to load a kernel image
from somewhere and jump to it.

To make the bootable SD card, I've been using some custom scripts that
I've had laying around forever for some semi-embedded FreeBSD/i386
work that my company has been doing for the past 10 or so years.  Most
other people I know do some variation on:

	# plug in the SD card to a usb whatsit and load umass
	% fdisk -I da0
	% disklabel -w -r da0s1 auto
	% newfs /dev/da0s1a
	% mount /dev/da0s1a /mnt
	% cd /usr/src
	% setenv TARGET arm
	% setenv TARGET_ARCH arm
	% make buildworld
	% make distribution DESTDIR=/mnt
	% make installworld DESTDIR=/mnt
	# hack /etc/rc.conf, /etc/fstab and /etc/ttys
	% umount /mnt

But others have also used NanoBSD to automate things somewhat.
Freesbie also has some basic cross compilation support.  FreeBSD
-current will give you the most support, but 6.2-release will have
most of the basics, including the build tools.  After the RELENG_6
branch is unfrozen, I'll be doing another merge of all the goodies
that I've done.

One caveat.  The usb support is minimal at this stage.  There's some
issues that we're trying to track down that keep it from working.  My
company doesn't need usb (but that may change after the latest
hardware review), so I've spent no energy there.

Feel free to ask questions.  the more people that ask, the bigger my
collection of email on the topic gets, and the easier it will be for
me to synthesize a tutorial.  Also, if there are areas that I've been
vague, please don't hesitate to let me know.

Warner



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061116.093638.63053940.imp>