=====Terminal Programs=====
One of the first things that needs to be done before U-Boot or uClinux can be used, is to setup a terminal program to communicate with the target device.
Communication between a host computer and the UART(s) on the Blackfin device is achieved through the use of a terminal program. A serial cable is connected between the host computer and the development board, data is then transferred between the host computer and the development board via a terminal program. The STAMP board has a DB9 serial connector for this purpose, connectors on other development hardware may vary. For more information consult the documentation for your particular development hardware.
To get started with U-Boot and uClinux a terminal program and a serial connection to the development board are required as U-Boot and uClinux both use this serial link for standard input and output. There are several terminal programs available for a number of platforms. Two common terminal programs, one for Windows and one for Linux, and the methods used to configure them for use with a STAMP board running U-Boot / uClinux are described below. Before preforming the procedures described below a serial cable should be connected between the host computer and the target system.
===== Linux Packages =====
The following is specific to SuSE Linux - but the general concept is the same for other GNU/Linux distributions
The two main GNU/Linux communication programs are ''kermit'' and ''minicom''. Before you can run either, (or any other serial program in Linux) you must ensure that you have read/write access to the serial port. Do you this look at ''/dev/ttyS0'':
rgetz@home:~> ls -l /dev/ttyS0
crw-rw---- 1 root uucp 4, 64 2005-03-19 17:01 /dev/ttyS0
You can see here that only the user ''root'' and the members of the group ''uucp'' have read/write access. To determine if you are in the group ''uucp'' check with the ''groups'' command:
rgetz@home:~> groups
users dialout video
The ''root'' user must add you to the ''uucp'' group either by editing the ''/etc/group'' file, or by using the distributions graphical interface. Before the new group will take affect, you must log out, and log back in.
====Kermit====
Kermit is very easy to set up. Edit or create a ''~/.kermrc'' file, to look something like this:
set line /dev/ttyS0
define sz !sz \%0 > /dev/ttyS0 < /dev/ttyS0
set speed 57600
set carrier-watch off
set prefixing all
set parity none
set stop-bits 1
set modem none
set file type bin
set file name lit
set flow-control none
set prompt "Linux Kermit> "
Ensure you change the ''/dev/ttyS0'' in the above file to whatever serial device you are using. It could be any of: ''/dev/ttyS0'', ''/dev/ttyS1'', ''/dev/ttyS2'', ... , ''/dev/ttyUSB0'', ''/dev/ttyUSB1'',...
Then you can just evoke ''kermit'' by:
rgetz@home:~> kermit
C-Kermit 8.0.211, 10 Apr 2004, for Linux
Copyright (C) 1985, 2004,
Trustees of Columbia University in the City of New York.
Type ? or HELP for help.
Linux Kermit>
To connect to the target, type ''connect'':
Linux Kermit>connect
Connecting to /dev/ttyS0, speed 57600
Escape character: Ctrl-\ (ASCII 28, FS): enabled
Type the escape character followed by C to get back,
or followed by ? to see other options.
----------------------------------------------------
To send a file, just escape back to the kermit prompt and either use the ''send'' command (send kermit protocol), or ''sz'' (send zmodem protocol).
To Escape back from the target console to the host kermit, hold the CONTROL key while you push the \ key, then let go of the CONTROL key, and push the C key
====Minicom (Linux Client)====
This terminal program is available for the Linux platform. You may have to install this program if it is not included with your particular distribution of Linux. The first time Minicom is run you will have to initialize the settings. To do this preform the following steps:
As ''root'' enter the following command:
bash# minicom -s
The Minicom Setup screen will now appear:
{{minicom1.png}}
Down arrow to ''**Serial port setup**'' and hit enter.
The Serial port setup window should now appear:
{{minicom2.png}}
In this menu type the letter of the option you want to choose (e.g. 'A' would be Serial Device) and then edit the configuration for that option. The following settings should be entered:
''**Serial Device: **''
(usually ''/dev/ttyS0'')
''**Lockfile**''''** Location:**'''' ''''****''
(to prevent the serial port from ever being locked)
''**Callin**''''**: **'' \\
''**Callout**''''**: **'' \\
''**Bps/Par/Bits:**'''' ''''**57600 8N1**'' \\
(baud rate (57600), parity (N for none), stop bits (1)) \\
''**Hardware Flow Control: No**'' \\
''**Software Flow Control: No**'' \\
Hit **Esc** to return to the main menu.
57600 baud is the default serial transfer rate for U-Boot and the uClinux kernel, though this can be changed when compiling the kernel.
{{minicom3.png}}
Next the modem features must be disabled. This needs to be done because Minicom is normally used for modem communication and the default settings will be looking to establish communication through a modem.
Back at the Minicom setup screen:
{{minicom4.png}}
Down arrow to **Modem and Dialing** and hit enter.
The modem and dialing setup screen should now appear:
{{minicom5.png}}
In this menu hit the letter of the option you want to choose (e.g. 'A' would be Init string) and then edit the configuration for that option. The following settings should be entered:
''**Init string: **'' \\
''**Reset string: **'' \\
''**Dialing prefix #1: **'' \\
''**Dialing suffix #1: **'' \\
''**Dialing prefix #2: **'' \\
''**Dialing suffix #2: **'' \\
''**Dialing prefix #3: **'' \\
''**Dialing suffix #3: **'' \\
''**Connect string: **'' \\
Hit **Esc** to return to the main menu
Now that the configuration has been set it should be saved as the default configuration so that every time Minicom starts these settings will be restored.
====Telnet====
You can connect to the target system with **telnet**.
telnet 192.168.1.66
Trying 192.168.1.66...
Connected to 192.168.1.66.
Escape character is '^]'.
BusyBox v1.00 (2005.09.05-02:12+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.
root:~> cat /etc/motd
Welcome to:
____ _ _
/ __| ||_| _ _
_ _| | | | _ ____ _ _ \ \/ /
| | | | | | || | _ \| | | | \ /
| |_| | |__| || | | | | |_| | / \
| ___\____|_||_|_| |_|\____|/_/\_\
|_|
For further information see:
http://www.uclinux.org/
http://blackfin.uclinux.org/
root:~>
For telnet to work you must have the **telnet** user package enabled.
For a quick test use **grep** to look for **TELNET** in the user config file (config/.config)
grep TELNET config/.config
CONFIG_USER_TELNETD_TELNETD=y
CONFIG_USER_TELNETD_DOES_NOT_USE_OPENPTY=y
CONFIG_USER_TELNET_TELNET=y
# CONFIG_USER_BUSYBOX_TELNET is not set
# CONFIG_USER_BUSYBOX_TELNETD is not set
Once this is confirmed also confirm that **romfs/bin/telnetd** has also been created.
# on the development system
ls -l romfs/bin/telnetd
-rwxr--r-- 1 root root 37856 Sep 12 15:13 romfs/bin/telnetd
This means that the file should be in the target image too.
# on the target system
root:~> ls -l /bin/telnetd
-rwxr--r-- 1 0 0 37856 /bin/telnetd
Then check that the **telnet daemon** is enabled on the target in the [[uclinux-dist:inetd|**inetd** ]] config file.
# On the target
root:~> cat /etc/inetd.conf
ftp stream tcp nowait root /bin/ftpd -l
telnet stream tcp nowait root /bin/telnetd
If all this works then you should be able to start a **telnet** session on the target as shown above.
====Remote Shell and Remote File Copy====
You can connect to the target system with **rsh**. rsh allows you to execute a single command on the target from a remote machine. The output generated from the command issued is only visible on the remote machine that it was issued from.
===Compiling rsh and rcp===
rsh must first be built into your kernel. To do this follow these steps:
In the uClinux-dist/ directory issue the following commands:
# on the development system
make clean
make menuconfig
Next a dialog box will appear. Here choose the box that says:
Kernel/Library/Defaults Selection
The next dialog box will appear. Here select:
[*] Customize Vendor/User Settings
Exit
Exit
Do you wish to save your new kernel configuration?
Yes
A new menu will appear. In this menu select:
Blackfin app programs --->
In the next dialog box select:
--- Inetutils
[*] rsh
[*] rcp
[*] rshd
Then:
Exit
Exit
Do you wish to save your new kernel configuration?
Yes
Now compile the kernel:
# on the development system
make
After you compile the kernel you can now load and run it (for more information on loading and running the kernel please see [[downloading_to_the_target|Downloading the Kernel to the Target]]) and begin to use **rsh**.
===Using rsh===
After booting the kernel enter the following commands to **start** **rshd** and **dhcpcd**:
# on the target
Welcome to:
____ _ _
/ __| ||_| _ _
_ _| | | | _ ____ _ _ \ \/ /
| | | | | | || | _ \| | | | \ /
| |_| | |__| || | | | | |_| | / \
| ___\____|_||_|_| |_|\____|/_/\_\
|_|
For further information see:
http://www.uclinux.org/
http://blackfin.uclinux.org/
BusyBox v1.00 (2005.09.16-12:31+0000) Built-in shell (msh)
Enter 'help' for a list of built-in commands.
root:~> dhcpcd&
26
root:~> eth0: link down
eth0: link up, 100Mbps, half-duplex, lpa 0x40A1
root:~> rshd &
28
root:~>
Now issue an **ifconfig** to determine the IP address of the target.
# on the target
root:~> ifconfig
eth0 Link encap:Ethernet HWaddr 00:E0:22:FE:06:19
inet addr:10.64.204.163 Bcast:10.64.204.255 Mask:255.255.255.0
UP BROADCAST NOTRAILERS RUNNING MULTICAST MTU:1500 Metric:1
RX packets:95 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
Interrupt:27 Base address:0x300 DMA chan:ff
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
root:~>
With the targets IP now known, we can access it using rsh on our **host** machine. To test this issue the following command from the host machine:
# on the development system
user@linux:~> rsh -l root 10.64.204.163 ls
This command will issue the ls command on the target board and the results will be printed to the console of the **host system**.
# on the development system
user@linux:~> rsh -l root 10.64.204.163 ls
bin
dev
etc
home
lib
lost+found
mnt
proc
root
sbin
tmp
usr
var
user@linux:~>
===Using rcp===
You can also preform a remote file copy, **rcp**, from your host to your target when rshd is running. To do this issue the following command from the host computer:
# on the development system
user@linux:~> rcp foo root@10.64.204.163:/
Where **foo** is the **file** to be copied, **10.64.204.163** is the **target's IP** address, and **/** is the **directory** where the file is to be copied to.
=====Windows Clients=====
HyperTerminal is no longer part of recent Windows releases. There are several options you can use to replace its functionality. See [[http://www.windowsreference.com/windows-vista/alternatives-to-hyperterminal-in-vista/|a few options]].
====Hyper Terminal====
This terminal program is available for most Windows platforms. It usually comes pre‑installed and can be found under: //Start>Programs>Accessories>Communication>HyperTerminal//. When a Hyper Terminal session is started the **Connection Description** window will appear (if the Connection Wizard dialog appears simply complete it with dummy values as we will not be using a dial-up modem):
{{hyperterminal1.png}}
**Name: **.
Click **OK**.
The **Connect To** window should now appear:
{{hyperterminal2.png}}
**Connect using: **
(usually COM1).
Click **OK**.
The **COMX Properties** window should now appear:
{{hyperterminal3.png}}
**Bits per second: 57600** \\
**Data bits: 8** \\
**Parity: None** \\
**Stop bits: 1** \\
**Flow Control: None** \\
Click **OK**.
57600 baud is the default serial transfer rate for U-Boot and the uClinux kernel, though this can be changed when compiling the kernel.
The terminal session should now be connected. You should now be able to see output from U‑Boot or uClinux when they are run.