Name

Setup — Preparing the KB920x boards for eCos Development

Overview

In a typical development environment, the KB920x boards boot from serial EEPROM into the KwikByte bootloader, which then boots the RedBoot ROM monitor from flash. eCos applications are configured for RAM startup and then downloaded and run on the board via the debugger arm-eabi-gdb. Preparing the board therefore usually involves programming a suitable RedBoot image into flash memory.

The following RedBoot configurations are supported:

ConfigurationDescriptionUseFile
ROMRedBoot running from ROMredboot_ROM.ecmredboot_ROM.bin
ROMRAMRedBoot running from RAM, but contained in the board's flash boot sector.redboot_ROMRAM.ecmredboot_ROMRAM.bin
SRAMRedBoot running from RAM, loaded by bootloader.redboot_SRAM.ecmredboot_SRAM.bin
UBOOTRedBoot running from RAM, loaded from flash by U-Boot.redboot_UBOOT.ecmredboot_UBOOT.bin

For serial communications, all versions run with 8 bits, no parity, and 1 stop bit at 115200 baud. RedBoot also supports ethernet communication and flash management.

Generally only the ROMRAM version of RedBoot is used. The SRAM version is suitable only for RedBoot development and should not normally be used. On the KB9202C the UBOOT version is used.

Initial Installation -- KB9201, KB9202, KB9202B

The KB920x boards are shipped from KwikByte with the EEPROM bootloader installed and a version of Linux installed in the flash. The KB9202C board has a different installation method, described in the next section.

Installing RedBoot is a matter of downloading a new binary image and overwriting the existing Linux image. This is a two stage process, you must first download the KwikByte RAM Monitor, which is then used to download a RedBoot image and program it into the flash. To achieve this you will need a copy of the ramMonitor.bin image and, for Linux hosts, a copy of the KwikByte download tool. Both of these can be found on the CD-ROM that comes with the board. Note that the prebuilt version of the download tool is hardcoded to use /dev/ttyS0 for downloads.

Connect a straight-through serial cable between the KB920x board serial port and a serial port of the host computer and start a terminal emulator such as minicom or HyperTerminal. Set the communication parameters to 115200 baud, 8 data bits, no parity bit and 1 stop bit. Press the Reset button on the board and when the bootloader starts you should see something similar to this if using the KB9200 or KB9201:

KB9200(www.kwikbyte.com)
        Default system configuration complete

Checking for input

>

When you see the "Checking for input" line, hit the Return key to put the bootloader into its command interpreter, otherwise it will proceed to boot Linux.

For the KB9202 there is less output, and the delay shorter, and so you will need to press the Return key several times immediately after pressing the Reset button before the bootloader banner is displayed:

KB9202(www.kwikbyte.com)

Auto boot..

>

The next step is to install a new startup command in the command table:

>s 1 e 0x10000000


>w


>

It is now necessary to download the Kwikbyte RAM Monitor. Start the download by giving the following command to the bootloader:

>x 0x20002000
C

You may get a sequence of C characters, which indicate that the bootloader is waiting for the download to start. If using HyperTerminal, you should now send the ramMonitor.bin file from the KwikByte CD-ROM using the Xmodem protocol. If using minicom, exit minicom and download the RAM Monitor using the following command:

$ download ramMonitor.bin

The download command produces a lot of output. When the transfer is finished, restart minicom.

Having downloaded the RAM monitor, issue the following command to start it:

>e 0x20002000

Entry: RAM Monitor

>

It is now necessary to prepare the flash for the RedBoot image by erasing the first 128K bytes. The RedBoot ROM image can then be downloaded:

>f e 0x10000000 0x1001ffff
Verifying sector erase
Flash sector erase at: 0x10000000 PASS
Verifying sector erase
Flash sector erase at: 0x10010000 PASS


>x 0x20100000
C

If using HyperTerminal, you should now send the redboot_ROMRAM.bin file using the Xmodem protocol. If using minicom, exit minicom and use the download command to send the file redboot_ROMRAM.bin. When the transfer is finished, restart minicom.

Having downloaded the RedBoot image, use the following command to write it to flash:

>f p 0x10000000 0x20100000 0x20000
..
Flash program status: PASS


>

The KB920x board may now be reset. It should then display the following startup sequence. Run the fis init and fconfig -i commands to initialize the flash, as shown. Note that KB9202 users will see output similar but not identical to that below.

KB9200(www.kwikbyte.com)
        Default system configuration complete

Checking for input
0x00 : [E]
0x01 : e 0x10000000[E]
0x02 : c 0x20210000 0x10100000 0x100000[E]
0x03 : m 0 0 0 0 0 0[E]
0x04 : t 0x20000100 console=ttyS0,115200 root=/dev/ram rw initrd=0x20210000,654]
0x05 : e 0x10000000[E]
0x06 : [E]
0x07 : [E]
0x08 : [E]
0x09 : [E]

>

>e 0x10000000
+... Read from 0x601f0000-0x601fffff to 0x01ff0000:
... Read from 0x601ff000-0x601fffff to 0x01fef000:
**Warning** FLASH configuration checksum error or invalid key
Use 'fconfig -i' to [re]initialize database
PHY: Intel LXT971
AT91RM9200 ETH: Waiting for link to come up.
AT91RM9200 ETH: 100Mb
... waiting for BOOTP information
Ethernet eth0: MAC address 00:23:31:37:00:1c
IP: 10.0.0.207/255.255.255.0, Gateway: 10.0.0.3
Default server: 10.0.0.1

RedBoot(tm) bootstrap and debug environment [ROMRAM]
Non-certified release, version UNKNOWN - built 12:01:32, Dec 13 2004

Platform: KwikByte KB9200 (ARM9)
Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2003, 2004, eCosCentric Limited

RAM: 0x00000000-0x02000000, [0x0002ddf8-0x01fed000] available
FLASH: 0x60000000 - 0x601fffff 32 x 0x10000 blocks
RedBoot> fis init
About to initialize [format] FLASH image system - continue (y/n)? y
*** Initialize FLASH Image System
... Erase from 0x601f0000-0x601fffff: .
... Program from 0x01ff0000-0x02000000 to 0x601f0000: .
RedBoot> fconfig -i
Initialize non-volatile configuration - continue (y/n)? y
Run script at boot: false
Use BOOTP for network configuration: true
Default server IP address: 10.0.0.201
Network hardware address [MAC]: 0x00:0x23:0x31:0x37:0x00:0x1C
GDB connection port: 9000
Force console for special debug messages: false
Network debug at boot time: false
Default network device: at91rm9200_eth
Update RedBoot non-volatile configuration - continue (y/n)? y
... Read from 0x601f0000-0x601fefff to 0x01ff0000:
... Erase from 0x601f0000-0x601fffff: .
... Program from 0x01ff0000-0x02000000 to 0x601f0000: .
RedBoot> 

If it proves necessary to re-install RedBoot, this may be achieved by repeating the above process. Alternatively, a new image may be downloaded and programmed into flash more directly using RedBoot's own commands. See the RedBoot documentation for details.

Initial Installation -- KB9202C

The KB9202C is not equipped with NOR flash, only Dataflash, so the installation method described above will not work. This board boots, via a second-stage loader into U-Boot. By default U-Boot then boots a Linux image that is also stored in Dataflash. The approach described here is to cause U-Boot to boot RedBoot instead of Linux. The following directions give basic instructions for installing RedBoot, for more details of how to configure U-Boot, please refer to the U-Boot documentation.

Connect a straight-through serial cable between the KB920C board serial port and a serial port of the host computer and start a terminal emulator such as minicom or HyperTerminal. Set the communication parameters to 115200 baud, 8 data bits, no parity bit and 1 stop bit. Power the board up and you should see the KwikByte loader and U-Boot startup messages. When it gets to the "Hit any key to stop autoboot" line, type any key. There is only a 1 second timeout here, so you need to be quick, or you can type ahead during the delay after the "NAND:" line. The final output should look like this:

KwikByte KB9202x Copy Loader v0.9
Loading boot loader. . . done


U-Boot 1.2.0 (Sep 26 2007 - 17:32:22)

DRAM:  64 MB
NAND:  NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron NAND 256MiB 3,3V 8-bit)
256 MiB
DataFlash:AT45DB642
Nb pages:   8192
Page Size:   1056
Size= 8650752 bytes
Logical address: 0xC0000000
Area 0: C0000000 to C00020FF      Copy Loader (8kB)
Area 1: C0002100 to C00041FF      Environment (8kB)
Area 2: C0004200 to C003665F      U-Boot (195kB)
Area 3: C0036660 to C0041FFF      Secondary Boot (45kB)
Area 4: C0042000 to C0461FFF      OS (4MB)
Area 5: C0462000 to C083FFFF      DF_SPARE
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
KB920x >

Now we need to set up U-Boot to download the RedBoot image and program it into the DataFlash. First it is necessary to change U-Boot's environment to allow the image to be downloaded. In this example we will be downloading via tftp, so we need to set the ethernet and IP addresses for this board:

KB920x >setenv ethaddr 00:D0:93:00:05:B5
KB920x >setenv ipaddr 10.0.3.1
KB920x >setenv serverip 10.0.1.2
KB920x >saveenv
KB920x >printenv
bootargs=console=ttyS0,115200 noinitrd root=/dev/mtdblock0 rootfstype=jffs2 mem=
64M
bootdelay=1
baudrate=115200
hostname=KB9202C
kernel-size=31c8d0
bootcmd=cp.b c0042000 23000000 31c8d0; bootm 23000000
ethaddr=00:D0:93:00:05:B5
ipaddr=10.0.3.1
serverip=10.0.1.2
stdin=serial
stdout=serial
stderr=serial

Environment size: 307/8444 bytes
KB920x >

In the above example the ipaddr and serverip variables are set to example values. They should be set to the address of this board and the address of the TFTP server in your own network. The redboot_UBOOT.bin should be copied to the tftp server's root directory. It may now be downloaded:

KB920x >tftp 0x20100000 redboot_UBOOT.bin
TFTP from server 10.0.1.2; our IP address is 10.0.3.1
Filename 'redboot_UBOOT.bin'.
Load address: 0x20100000
Loading: T ###################
done
Bytes transferred = 94236 (1701c hex)
KB920x >

Now program the loaded binary into flash. In the following example, the new binary is installed into dataflash at offset 0x500000. This avoids overwriting the Linux image at offset 0x42000. If the Linux image is not required, RedBoot can be programmed in its place and the addresses in the following commands adjusted to match.

KB920x >cp.b 0x20100000 0xc0500000 0x20000
Copy to DataFlash... done
KB920x >

Finally, change the default boot command to load and execute RedBoot rather than Linux. Make sure to include the backslash before the semicolon.

KB920x >setenv bootcmd cp.b 0xc0500000 0x20100000 0x20000\; go 0x20100000
KB920x >saveenv
Saving Environment to dataflash...

Press the reset button on the board and the full boot sequence should be seen:

KwikByte KB9202x Copy Loader v0.9
Loading boot loader. . . done


U-Boot 1.2.0 (Sep 26 2007 - 17:32:22)

DRAM:  64 MB
NAND:  NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron NAND 256MiB 3,3V 8-bit)
256 MiB
DataFlash:AT45DB642
Nb pages:   8192
Page Size:   1056
Size= 8650752 bytes
Logical address: 0xC0000000
Area 0: C0000000 to C00020FF      Copy Loader (8kB)
Area 1: C0002100 to C00041FF      Environment (8kB)
Area 2: C0004200 to C003665F      U-Boot (195kB)
Area 3: C0036660 to C0041FFF      Secondary Boot (45kB)
Area 4: C0042000 to C0461FFF      OS (4MB)
Area 5: C0462000 to C083FFFF      DF_SPARE
In:    serial
Out:   serial
Err:   serial
Hit any key to stop autoboot:  0
.O+AT91RM9200_ETH - Warning! ESA unknown.
AT91RM9200 ETH: Waiting for link to come up.
AT91RM9200 ETH: 100Mb
Ethernet eth0: MAC address 00:23:31:37:00:1c
IP: 10.0.2.6/255.0.0.0, Gateway: 10.0.0.3
Default server: 0.0.0.0, DNS server IP: 10.0.0.1

RedBoot(tm) bootstrap and debug environment [UBOOT]
Non-certified release, version UNKNOWN - built 17:30:00, Jan 11 2008

Platform: KwikByte KB9202C (ARM9)
Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
Copyright (C) 2003, 2004, 2005, 2006, 2007 eCosCentric Limited

RAM: 0x00000000-0x04000000, [0x00120840-0x04000000] available
RedBoot> 

If it is necessary to reinstall RedBoot, the above steps for downloading and programming the new image should be repeated.

Rebuilding RedBoot

Should it prove necessary to rebuild a RedBoot binary, this is done most conveniently at the command line. The steps needed to rebuild the the ROMRAM version of RedBoot for the KB9200 are:

$ mkdir redboot_kb9200_romram
$ cd redboot_kb9200_romram
$ ecosconfig new kb9200 redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/arm/arm9/kb9200/current/misc/redboot_ROMRAM.ecm
$ ecosconfig resolve
$ ecosconfig tree
$ make

The steps needed to rebuild the the ROMRAM version of RedBoot for the KB9202 are:

$ mkdir redboot_kb9202_romram
$ cd redboot_kb9202_romram
$ ecosconfig new kb9202 redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/arm/arm9/kb9200/current/misc/redboot_ROMRAM.ecm
$ ecosconfig resolve
$ ecosconfig tree
$ make

The steps needed to rebuild the the UBOOT version of RedBoot for the KB9202C are:

$ mkdir redboot_kb9202c_uboot
$ cd redboot_kb9202c_uboot
$ ecosconfig new kb9202c redboot
$ ecosconfig import $ECOS_REPOSITORY/hal/arm/arm9/kb9200/current/misc/redboot_UBOOT.ecm
$ ecosconfig resolve
$ ecosconfig tree
$ make

At the end of the build the install/bin subdirectory should contain the file redboot.bin.