Zapper ZP10 HOWTO
Table of contents
Building the system software
The system software is available from the downloads page. Follow the instructions below to build the software for the Zapper ZP10.
Building U-Boot
Building U-Boot requires a modern version (3 at least) of gcc set up to cross compile for ARM. After downloading a source tarball, unpack it and build by typing the following at the shell:
tar xvfz u-boot-1.3.1-tortek-r2.tar.gz cd u-boot-1.3.1-tortek-r2.tar.gz make zapper_zp10_config CROSS_COMPILE=arm-unknown-linux-gnu- make
Replace "arm-unknown-linux-gnu-" with whatever the prefix of your version of gcc is. This will build an installable flat binary image: u-boot.bin.
Building Linux
Building Linux requires a similar cross-compiler to what is required for U-Boot. Build instructions are also similar:
tar xvfz uclinux-2.6.24.2-tortek-r2.tar.gz cd uclinux-2.6.24.2-tortek-r2 make zapper_zp10_defconfig CROSS_COMPILE=arm-unknown-linux-gnu- make
This will build an installable flat binary image in arch/arm/boot/Image.
Building Busybox
Busybox, and all other userspace binaries for the Zapper, need to be built with a BFLT-generating version of gcc. One such compiler for the i386 is the version of gcc produced by Snapgear.
You can build the uClinux version of Busybox by typing the following at the prompt:
tar xvfz busybox-1.10.1-tortek-r2.tar.gz cd busybox-1.10.1-tortek-r2 make defconfig CROSS_COMPILE=arm-elf- make CROSS_COMPILE=arm-elf- make install
The last "make install" is required to build the basis for a root filesystem in the _install subdirectory. This is used in the next step.
Building a ROMFS
After building Busybox, not much else is required to assemble a working root filesystem (ROMFS) using genromfs. You can build a complete ROMFS with a script such as this one.
Assuming you have Busybox built and sitting in a subdirectory called "busybox", you can build a romfs.bin in the current directory by running the script from the prompt.
Installing the system software
Installing U-Boot via JTAG
If there is no working bootloader currently installed, you can write the U-Boot image to NOR flash using the Olimex USB JTAG adapter and OpenOCD.
Copy this configuration file and the u-boot.bin image you built earlier into the same directory. From this directory, start OpenOCD as root. If all goes well, it will not return to the prompt.
From another terminal, connect to the OpenOCD monitor using telnet:
telnet localhost 4444
At the OpenOCD prompt, erase the NOR flash and install U-Boot by issuing the following commands:
halt flash protect 0 0 26 off flash erase 0 0 26 flash write_image u-boot.bin 0 bin
After disconnecting the JTAG adapter, you should be able to boot the board. The serial console defaults to 115200 bps (8N1). Press space when the banner appears on the console to interrupt U-Boot and get to the prompt.
Installing U-Boot via TFTP
If you already have a working copy of U-Boot installed, it's simpler and easier to transfer a new U-Boot image via TFTP, rather than connecting JTAG adapters.
Assuming that u-boot.bin is stored in the TFTP root directory of a server with IP address 10.0.0.1, and 10.0.0.8 is reserved for use by the Zapper, you can write this image to NOR flash by typing the following commands at the U-Boot prompt:
setenv serverip 10.0.0.1 setenv ipaddr 10.0.0.8 tftpboot 0xa0100000 u-boot.bin protect off 0x0 0x2ffff erase 0x0 0x2ffff cp.b 0xa0100000 0x0 0x30000
Warning: if you lose power or reset the board between the "erase" and "cp.b" commands, you will be left without a working bootloader.
Issue a "reset" and you should see the banner for the newly installed version of U-Boot.
Installing Linux
You should have a linux.bin and romfs.bin sitting in the root directory of a TFTP server somewhere. In the following example, we'll assume that the TFTP server's IP address is 10.0.0.1 and that the IP address 10.0.0.8 is reserved for use by the Zapper.
To transfer the images over the network and write them to NAND flash at appropriate locations, you can use the installed U-Boot image. Ensure that your Ethernet and serial console connections are ok, then power up the board, interrupting U-Boot by pressing space. At the U-Boot prompt, type the following commands:
setenv serverip 10.0.0.1 setenv ipaddr 10.0.0.8 nand erase 0x100000 0x800000 tftpboot 0xa0100000 linux.bin nand write 0xa0100000 0x100000 0x300000 tftpboot 0xa0100000 romfs.bin nand write 0xa0100000 0x400000 0x400000
If you haven't already done so, you may want to configure U-Boot to automatically boot the installed system on startup. To do this, you need to set a few environment variables and save them to NOR flash. Type the following commands at the U-Boot prompt:
setenv do_linux nand read 0xa0008000 0x100000 0x300000\; go 0xa0008000 setenv bootcmd run do_linux setenv bootdelay 2 saveenv
If you type "reset" at this point, U-Boot should restart and then proceed to load and boot the Linux kernel. You should end up with a login prompt on the serial console.
Installing without Ethernet
If Ethernet is unavailable, data can be transferred (albeit much more slowly) via the serial port using Y-Modem. In any of the above sequences of U-Boot commands, any instance of "tftpboot addr filename" can be replaced with the following command to initiate a Y-Modem receive:
loady addr
U-Boot will not return to the prompt. At this point, you should initiate a Y-Modem send with your terminal program.
Configuring the FPGA via TFTP
If you have a synthesized bitstream ready to loading into an FPGA, you can have the Zapper download it from a TFTP server and use it to configure the FPGA.
One point about Xilinx bitstreams (.bit files) -- the first 70 bytes form a header which should not be sent to the FPGA. In the following example, we assume that you have an FPGA image for a XC3S400 called top.bit, which is 235,890 (hex 0x39972) bytes in size. Subtracting the 70 byte (hex 0x46) header gives a bitstream of 235,820 (hex 0x3992c) bytes.
Download this image and configure the FPGA using the following commands at the U-Boot prompt:
setenv serverip 10.0.0.1 setenv ipaddr 10.0.0.8 tftpboot 0xa0100000 top.bit fpgaconf 0xa0100046 0x3992c
Note that the first argument to "fpgaconf" is the address of the bitstream, skipping past the first header bytes.