Once you have the RS232C interface and gdb built, proceed as follows:
- Make sure that the serial port on your host system is set correctly
to 9600 baud. I found that gdb didn't seem to be able to set the baud
rate correctly, so I manually had to do this before running gdb.
stty 9600 < /dev/ttyS0
- Start gdb and issue the following command:
target rdp /dev/ttyS0
- Hold down SW2 inside the Webpal and then turn the Webpal on.
Release SW2 and your host system and Webpal should synchronize. Sometimes
this fails, so you may have to try this multiple times.
- Issue the following command to gdb to download the flash programmer.
If you built gdb as I described above, it will expect to load srec
files, so use prog.srec. I've also included prog.elf if you built a version of gdb that expects
elf format files:
- The host system should now say "Waiting for target...". Control-Z
out of gdb and kill it.
- To test out the programmer, use the wpflash
program to save a copy of your current flash to a file, in case you ever
want to go back to using the original Webpal software:
wpflash -nowait read all webpal.backup.image
- If everything is working, you should see the following messages following
by a counter counting from 0 to 1048576 as the flash is read to the file
you specified; The red LED on the Webpal will flash as the flash is
Attempting to contact programmer...done
Reading partition 'all' to 'webpal.backup.image'
- Its time to overwrite the flash with a Linux image. Here
is one called linux.flash.image. It
contains the bootp bootstrap loader, a parameters file, and a Linux zImage
file. As configured by the parameters file, it will try and
boot the root partition from the IDE device. To write it to flash,
enter the following command:
wpflash -nowait write all linux.flash.image
- If all is working, you should see the following messages followed by
a counter counting form 0 to 1Megabyte as the flash is programmed.
The red LED on the Webpal will flash as the flash is erased and then programmed.
Note that the erase operation takes a while so be patient. You
should see dots slowly written as the flash is erased.
Reading raw object file 'linux.flash.image' ...done
Data size is 1048576 bytes (100% of 'all' partition used).
Erasing all sectors...................done
- Hook up a monitor and keyboard and hit reset. You should see
the system boot. It will get to the point where it tries to
find the root partition and then panic since you probably don't have an IDE
hooked up yet.
You now can modify the parameters file to try other things, such as loading
the root from NFS and the IP addresses from bootp. Assuming you have an NE2000
ethernet card like mine (be sure to configure it in a PC to use 0x300 as
its address and INT3 as its interrupt pin), the kernel contains enough code
to load root from the NFS volume and use a bootp server as its IP address
source. Of course, you could also rebuild the kernel and build
your own root partition for your desired application.
Using the flash programmer in the bootstrap loader
Now that you have bootp programmed in the flash, you will use it's programmer.
By default, it assumes that you will be using a parallel port
via a parallel Laplink cable. If so, then run wpflash as follows:
wpflash -p <read/write/erase> <partition-name>
After you run the command, reboot or power cycle your system. Sometimes,
synchronization using the parallel port will fail. If this happens
to you, hold down the reset button, run the wpflash command, and then release
the reset button.
If you'd rather continue to use the serial port for programming, then run
the wpflash flash command without the -p or -nowait flags:
wpflash <read/write/erase> <partition-name>
After you run the command, hold down the SW2 switch and the reboot the system.
Holding down SW2 tells the system to use alternate device, in
this case, the serial port, for booting messages and programming.
If you want to the serial port to be the default device for booting
messages and programming, add the following line to your parameters file: