NAME

fsboot - Network and serial port bootloader for the ETRAX FS CPU.


SYNOPSIS

fsboot [--device devicename] [--file [filename|-] addr [size]] [--flash src dst size] [--memtest addr addr] [--nandflash src dst max_dst size] [--nanderase from to] [--nanddump from to] [--nanddumpoob from to] [--nanddumpoobbad from to] [--nandmarkbad from to] [--nandignorebad] [--memclear addr addr] [--memdump addr addr] [--setreg addr val] [--getreg addr] [--verify addr val] [--label label] [--loop addr label] [--5400] [--5600] [--testcard] [--devboard] [--testcardlx] [--etraxfs] [--serial] [--baudrate baudrate] [--bootfile file] [--jump addr] [--tofiles] [--cmdsonly] [--images] [--pause number] [-d debugflags] [--find str] [--exitonfind] [--listenonly]


DESCRIPTION

This boot loader facilitates loading of files over the network or a serial port to an ETRAX FS. It can also be used for fairly extensive hardware debugging as you can read and write to any memory addresses, including the ETRAX FS registers. You can also perform memory checks and dumps and copy data to the flash memories.

Debugging printout

When doing network boot the debugging printout from the CBL in ETRAX FS is transmitted back over the network and printed by fsboot. When doing serial boot that interface will be used. So in either case you will not need any other software or hardware to receive the debugging printout.

Creating binaries

The files containing code to be loaded on the ETRAX FS must be stripped using the standard GCC binutils.

How it works, things you don't want to know.

The first packet (or the first 1024 bytes in the case of serial boot) sent to ETRAX FS is loaded into the internal memory. The code in this packet is executed and loads the rest of the boot loader into the memory.

Two programs are involved in this boot loading, one is the program on your workstation that sends the packets to ETRAX FS, this is called the server boot loader or SBL. The other program is the one in ETRAX FS that receives packets from the SBL and acts upon the data therein, this is called the client boot loader or CBL.

We don't want to edit and recompile the CBL each time we want to load level two to different parts of memory. We also want to change things like the setup of external memory before we load data into it. To make the boot loading as flexible as possible and separate the CBL from level two we send a configuration packet to it. After this packet we load other files, if we want to.

The configuration packet can contain information to the CBL which lets you: initialize external memory, read and write to all ETRAX FS registers, read and write to any part of memory, load as many other files as you like to any part of memory you like, etc. The configuration packet is generated on the fly by the SBL.

Since the CBL is unaware of which product it will be loaded on, it doesn't do product specific initialization like setting up the memory. This must be done with the configuration packet.

Noteworthy is that two separate ETRAX FS binaries are created, one for network boot and one for serial boot. They actually contain exactly the same code, but linked in different order. This is because the code to load the rest of the bootloader over a specific interface must be contained in the first data sent to the ETRAX FS and it is too difficult to cram the code for both interfaces in the beginning of the same binary. Hence two files.


OPTIONS

The options are done in the order specified on the command line, so you probably want to do any memory setup before loading a file to the memory, and you probably do not want to perform a memory test after you have loaded a file to that memory.

All addresses and sizes must be in hex with optional '0x' prefix, or a ETRAX FS register name. Since the --setreg and --getreg options only can be performed on dword aligned dwords only the registers that conform to this can be named.

--baudrate baudrate
Set baudrate for files loaded after the boot loader.

--cmdsonly
Write the commands to file fsboot.cmds.

--device devicename
Which device to send packets on. For network boot the default is eth0. For serial boot it is ttyS0.

--file filename address [size]
The file to load and the address to load it to. If file is loaded on stdin, specify filename '-' followed by a size. Size need only be given in this case. You can load as many files as you want, each specified with a --file.

--flash source-address destination-address size
Programs the NOR flash with the memory contents of the specified RAM area.

--nandflash src dst max_dst size
Programs the NAND flash with the memory contents of the specified RAM area. The dst and max_dst is the offset from 0 in the NAND memory. Because of bad blocks the area needed in the flash may be bigger than the area in the source. To prevent the area in the flash from becoming too large and grow into other partitions (in Linux for example) the max_dst denotes an end-address that the programming may not exceed. Note! Does not program blocks marked as bad unless the --nandignorebad option is used, for safety reasons.

--nanderase start-address end-address
Erases all blocks in the NAND flash from start-address to end-address. Also erases the OOB area for each page in the area. Note! Does not erase blocks marked as bad unless the --nandignorebad option is used, for safety reasons.

--nanddump start-address end-address
Prints the contents of the specified memory area. Does not print blocks marked as bad unless the --nandignorebad option is used.

--nanddumpoob start-address end-address
Prints the contents of the OOB area for all pages in the specified memory area. Also prints blocks marked as bad (and adds 'BAD' to the printout) if --nandignorebad is used.

--nanddumpoobbad start-address end-address
Prints the contents of the OOB area for all pages that are marked as bad in the specified memory area.

--nandmarkbad start-address end-address
Marks page 0 and 1 as bad in all blocks in the specified memory region. Note! Only works if the --nandignorebad option is also used, for safety reasons.

--nandignorebad
Warning!

Overrides the built in safety checks that does not allow reading, writing or erasing of blocks marked as bad. If this option is used it IS possible to erase the markers inserted by the NAND manufacturer and from any file systems that use them (like Linux).

Should only be used for debugging of NAND software/hardware.

Use with extreme caution!

--getreg address
Print value of memory location. Must be uncached address.

--images
Print information about the internal boot images, then exit.

--jump address
Jump to specified address.

--loop check-address label
If the contents of check-address is nonzero it is decremented and the command parser continues parsing at the label.

If no external memory is initialized yet it can be convenient to use an address in the area occupied by the configuration packet. Run fsboot with --help to see which addresses the commands are stored at. The size of the commands are four bytes for each command plus four bytes per argument to the command.

--label label
Define a label to be used as target by the --loop command. This command is only used by the SBL to calculate the address for the --loop and does not take up any space in the configuration packet.

--memclear start-address end-address
Clears the specified memory area.

--memdump start-address end-address
Prints the contents of the specified memory area.

--memtest start-address end-address
Does a fairly extensive test of the specified memory area. Not only catches defect memories but also catches things like wrong memory setups where memory addresses are mirrored onto each other.

--network
Perform a network boot.

--noleds
When using the internal images use a version that does not toggle general port PA or PB in ETRAX FS during the boot procedure.

--pause number
How many iterations to do of an empty loop.

--serial
Do a serial boot.

--setreg address
Load dword to dword aligned memory location. Not only register but any memory location is writeable.

--verify address value
Verify that memory contains dword. If not loader will stop. This is to avoid booting the wrong unit. If you have the units ethernet address in the flash memory you can check for that.

--find str
Search for string in output from fsboot. If found, exit fsboot. For example if using --find END fsboot will exit when all boot arguments have been executed (the fsboot CBL prints an END at the end of the argument execution).

--exitonfind
If --find is used and matched a string in the output, look for an integer in the output following the matched string and exit fsboot with the exit value of that integer.

--tofiles
Write packets to files fsboot.seq[0..]. Does not transmit the data. For debugging of bootloader.

--bootfile filename
Which boot image to send to ETRAX instead of the default ones.

--5400
Sets R_WAITSTATES, R_DRAM_TIMING and R_DRAM_CONFIG for the 5400 printserver.

--5600
Sets R_WAITSTATES, R_DRAM_TIMING and R_DRAM_CONFIG for the 5600 printserver.

--etraxfs
Does some basic setup of waitstates etc for the ETRAX FS. For AXIS Communications AB internal use only.

--devboard
Sets registers for the developer board. For AXIS Communications AB internal use only.

--testcard
Configures the memories for the ETRAX 100 testcard. For AXIS Communications AB internal use only.

--testcardlx

Configures the memories for the ETRAX-100LX testcard. For AXIS
Communications AB internal use only.
-d debugflags
Enables debug printouts in fsboot. Up to four levels, 1 to 4. For example

-d 1 or -d 1234.

--listenonly
During network boot do not transmit packets, only receive. If coupled with debug option -d 1 prints any boot packets transmitted by the ETRAX.


EXAMPLES

If you have a stripped binary (file.ima) linked to 0x08000000 that you want to boot via the network, do this:

fsboot --file file.ima 88000000 --jump 08000000

Or something like this. Sets waitstates to zero and loads two files, the first from stdin:

cat file.ima | fsboot --memtest 88000000 8801ffff --memclear 88000000 8801ffff --setreg b0000000 0 --getreg b0000000 --file - 88000000 a000 --file file2.ima 88010000 --memdump 88000000 880000ff --jump 08000000

Or this, enables 16 bit parallel port and flashes the led on PA0:

fsboot --testcardlx --setreg R_PORT_PA_SET 0x00000000 --setreg R_GEN_CONFIG 0x80000004 --setreg R_PAR0_CONFIG 0x00000200 --setreg R_PORT_G_DATA 0x00000000 --pause 0x02000000 --setreg R_PORT_G_DATA 0xffffffff --pause 0x02000000 --setreg R_PORT_G_DATA 0x00000000 --loop 0x38001e0b 0x38001e60

Setup the memory, test the SRAM, print the contents of the first 256 bytes of SRAM, clear SRAM, test the DRAM, print R_DMA_CH0_CMD, load a file to SRAM, load another file to SRAM, load file to DRAM, jump to code in SRAM.

fsboot --setreg b0000000 1000 --setreg b0000008 00006543 --setreg b000000c 12966060 --memtest 88000000 80000 --memdump 88000000 880000ff --memclear 88000000 80000 --memtest c0000000 400000 --getreg b00001d0 --file file1.ima 88000000 --file file2.ima 88010000 --file file3.ima c0000000 --jump 88000000

Boot Linux on the testcard.

fsboot --setreg b0000000 1000 --setreg b0000008 6557 --setreg b000000c 1b988080 --file timage c0000500 --jump 40000500

Booting over serial port and using labels to flash the leds on port PA.

fsboot --serial --device /dev/ttyS1 --baudrate 9600 --label first --setreg 0x380020e0 00000001 --setreg R_PORT_PA_SET 0x0000ff00 --pause 0x02000000 --setreg R_PORT_PA_SET 0x0000ffff --pause 0x02000000 --loop 0x380020e0 first


BUGS

You're kidding, right? Check AUTHOR below. The only thing would be the hubris of the author, but that is considered a feature. If you find any other 'features' report them to technology@axis.com. Don't bother the author directly, he is busy windsurfing.


COPYING

Jadda, jadda. Copyright 1996-2006 Axis Communications AB. Jadda, jadda. And check the LICENSE file that came with the source.


AUTHOR

Ronny Ranerup


SEE ALSO

The fine source, which you can get at http://developer.axis.com.