Boot Loader

The firmware factory-programmed into the onboard flash contains a useful and powerfull bootloader. By using it, it is possible to upload a code image (over TFTP or serial Xmodem protocol) to SDRAM or flash and run it.

To use the bootloader's console interface, you need to connect a serial terminal to the W90N740's serial port (115200 bps, 8 data bits, no parity, no flow control, 1 stop bit), and reboot the board (using the modified reset button described in Section 2.1). You will see a boot up message similar to the following:

Boot Loader Configuration:

        TFTP server port    : MAC 1
        Network phy chip    : IC PLUS
        MAC 0 Address       : 00:02:44:79:82:ED
        IP 0 Address        : 192.168.2.246
        MAC 1 Address       : 00:02:44:79:03:17
        IP 1 Address        : 192.168.2.246
        DHCP Client         : Disabled
        CACHE               : Enabled
        BL buffer base      : 0x00300000
        BL buffer size      : 0x00100000
Press ESC to enter debug mode ...

If you quickly press ESCAPE or B on your terminal you will see the following (or similar):

W90N740 Command Shell v1.0 Rebuilt on Jun 06 2003 at 14:11:54

bootloader >

Type h (Help) to see a list of supported commands:

bootloader > h

W90N740 Command Shell v1.0 Rebuilt on Jun 06 2003 at 14:11:54

H        Display the available commands
B        Set Baud Rate
D        Display memory. D -? for help
E        Edit memory. E -? for help
G        <hex> Goto address
MX       Xmodem download
MT       TFTP download
FT       Program the flash by TFTP. FT -? for help
FX       Program the flash by Xmodem. FX -? for help
CP       Memory copy
LS       List the images in flash
SET      Setting boot loader configuration. SET -? for help
CHK      Check the flash
RUN      Execute image
DEL      DEL the image or flash block
MSET     Fill memory
TERM     Change the terminal output port
CACHE    Cache setting
UNZIP    Unzip image

It supports up to 7 code images in the available flash memory space, which can optionally be set to execute from SDRAM (in which case the bootloader will automatically copy the image to a specified address the execute it), or be zipped if necessary (the bootloader will decompress the image into SDRAM before executing it). At bootup, the first image (ranked by number, 1 to 7) that is active is processed as necessart (copy or decompress) then executed.

Memory Map

The flash memory device is mapped to address 0x0000.0000 at boot time, but during the course of normal power-on initialization, the flash memory is remapped to 0x7F00.0000, and the SDRAM is mapped to the first 4 MB of address space from 0x0000.0000.


At Power-on
0x0000.0000 Bootloader
0x0001.0000 System Paramter Storage
0x0002.0000 User Images
...
0x000F.FFFF


Flash after booting
0x7F00.0000 Bootloader
0x7F01.0000 System Paramter Storage
0x7F02.0000 User Images
...
0x7F0F.FFFF


SDRAM after booting
0x0000.0000 System Area (?)
0x0000.8000 User Area
...
0x003F.FFFF


Usage: Commands

h, Help, Show command list. Syntax: h

All supported commands are listed with a breif summary.

b, Set baud rate. Syntax: b [1200, 2400, 4800, 9600, 14400, 19200, 28800, 38400, 57600, 115200, 230400, 460800]

Sets the serial port baud rate to the specified value.

d, Displays the memory contents. Syntax: d -[w, h, b] [addr]

Displays system memory at address addr, with word, half-word or byte allignments.

e, Edit system memory. Syntax: e -[w,h,b][addr]

Edits system memory at address addr manually over the terminal. At each address starting at addr, the address and current contents are displaye, and a replacement can be typed in. Press ENTER to move to the next address, or ESCAPE to stop editing memory.

g, Goto, Branch execution to specified address. Syntax: g [addr]

Transfers control to the specified address (in hex, e.g. 0x8000).

mx, Download into memory via Xmodem over serial. Syntax: mx [addr]

Initiates an Xmodem download over the console serial port at the current baud rate, storing the received data in memory at the specified address. [Editors note: the Xmodem download only seems to support the Windows Hyperterminal communications software; it does not appear to work with Minicom on Unix, Zterm on Mac and so on.]

mt, Download into memory via TFTP over ethernet. Syntax: mt [addr]

Initializes a TFPT download into system memory at the specified address. The bootloader acts as a TFPT server at the IP address set with the set command. For example, to download test.bin to 0x8000:

bootloader >  mt 0x8000

On your computer, (Windows command prompt) type tfpt -i 192.168.2.246 put test.bin, or (Linux bash prompt) type:

$ tftp 192.168.2.246
tftp> binary
tftp> put test.bin
Sent 172 bytes in 1 seconds
tftp> 

fx, Flash Xmodem, Download via Xmodem over serial, program to flash. Syntax: fx [number] [name] [addr] [execAddr] -[a,c,x,f,z]

Initiates an Xmodem download over the console serial port at the current baud rate, stores the received data in a buffer in SDRAM, then programs it into flash at the specified address (addr). A flash image footer is added to describe the image to the bootloader. An image name and number need to be specified, as well as an address (execAddr) to copy the image to and execute it from when the image is run. The flags tell the bootloader what processing needs to be done before executing the image (more than one can be used, e.g. -aczx):

At bootup, each image is processed in order of the specified number, and the first active executable image is processed and run. The image name is only of use to the user to identify a particular image - it can be seen by using the ls command.

ft, Flash TFTP, Download via TFTP, program into flash. Syntax: ft [number] [name] [addr] [execAddr] -[a,c,x,f,z]

Downloads an image into memory via TFTP over ethernet, then programs it into flash at the specified address. See fx and mt for more information.

cp, Copy memory. Syntax: cp [srcAddr] [destAddr] [size]

Copies size bytes of memory from source address srcAddr to desitination address destAddr. The destination memory must be writable, i.e. in RAM.

ls, List flash images. Syntax: ls

Lists the contents of the flash memory, giving the number, name, flags, start address and size for each image. Example:

bootloader > ls
Image: 0 name:BOOT INFO base:0x7F010000 size:0x38 exec:0x7F010000 -f
Image: 1 name:MAIN base:0x7F040000 size:0x82B09 exec:0x00008000 -acx

set, Set configuration values. Syntax: set -[net_mac [0,1], phy [0,1,2], mac0 [addr], mac1 [addr], ip1 [addr], dhcp [0,1], cache [on,off], buffer [base] [size]]

Sets various configuration parameters used by the bootloader, and when initializing the system. Before the new settings are activated, you need to reboot the system.

Chooses which ethernet port (0 or 1) is used by the TFTP server.

Chooses which PHY chip is used. 1 = IC+ IP175A switch and PHY.

Sets the MAC hardware network address of the specified MAC.

Sets the IP address for MAC 0. Used by TFTP server.

Turns DHCP off for the bootloader. 0 = off, 1 = on.

Sets the buffer used by the flash download commands and the unzip function to be the top 1MB of SDRAM.

Turns on the I+D caches.

run, Runs the specified image. Syntax: run [number]

Executes the flash image number, doing and processing (copy, unzip) that may be needed.

del, Delete Flash. Syntax: del [imageNumber, b[blockNumber], -all]

Erases flash memory, either a specified image number, a specified block (e.g. to erase block 1, type del b1), or the entire flash chip except for the bootloader and system parameter block (e.g. del -all).

mset, Set memory. Syntax: mset -[w,h,b] [addr] [size] [value]

Fills a block of writable memory starting at the address addr, of length size, with value. The alignment flags (w, h, b) work the same as the other commands that use them.

unzip, Decompresses a flash image into RAM. Syntax: unzip [imageNumber]

Decompresses the specified flash image into RAM, at the address that was specified when it was programmed to flash (check the exec field in the ls command).