|Loading Linux Images over UART|
This article explains how to load images to the target over UART in U-Boot. Keep in mind that loading via a serial port will take quite a long time (minutes per file!) due to the low speeds (limited to 115.2 Kps). That said, for embedded designs that do not provide an Ethernet port it may be the only reasonable development and software manufacturing option using U-Boot and uClinux.
Using the Embedded Artists LPC4357 Dev Kit, you connect to the target serial console via the USB/UART interface on the baseboard. Assuming you connect to a Linux PC host, on the Linux host the LPC4357 serial console will be visible as a /dev/ttyUSBx device. The U-Boot and Linux software configures the console for 115.2 Kps operation.
There are various serial communication tools available for Linux, the most popular perhaps being kermit. kermit is a very powerful tool that can be run in interactive mode or controlled by a script. There is abundant documentation on kermit available in the Internet, if you require details.
The download procedure is based on the loadb command provided by the U-Boot command interface. loadb implements a download capability over UART using the kermit protocol and has the following synopsis:
loadb [<load_address> <baud_rate>]
If you do not specify a load address, then the value will be taken from the loadaddr environment variable. On the LPC4357 loadaddr is set as follows, placing the download buffer into SDRAM:
EA-LPC4357> print loadaddr
If you do not specify a baud rate, then the speed the console is currently running at will be used (set to a default value of 115200 on the LPC4357 Dev Kit).
Once the transmission using loadb finishes, the file will be in memory at the specified load address. The loadaddr environment variable will automatically be set to the address the loadb command used. The filesize environment variable will automatically be set to the number of bytes transferred during the load operation.
Then you are free to do whatever you like with the loaded image. You can boot Linux from the image (assuming it is a Linux uImage file), copy it to some other place (for instance, on-module Flash), display the memory, etc.
To automate the download procedure, you might want to put a desired sequence of interactive steps involving interactions with the U-Boot command interface on the target and kermit on the host into a shell script. For instance, here is a sample script to download a Linux bootable image (networking.uImage) to SDRAM and boot Linux from it:
$ vi uartboot-lpc4357.script
Copy the sample Linux image (networking.uImage) from the Emcraft software distribution to the host directory you will be running the shell script from.
Then run the script to download the image to the target via UART and boot Linux from it:
[vlad@yota ~]$ ./uartboot-lpc4357.script
It will take a 3+ long minutes to download the image at 115.2Kps but finally it will get to the target and Linux will boot from it:
## Total Size = 0x00202270 = 2105968 Bytes