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.
The two main GNU/Linux communication programs are
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
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
rgetz@home:~> groups users dialout video
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 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> "
/dev/ttyS0in the above file to whatever serial device you are using. It could be any of:
/dev/ttyS2, … ,
Then you can just evoke
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
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).
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:
root enter the following command:
bash# minicom -s
The Minicom Setup screen will now appear:
Down arrow to
Serial port setup and hit enter.
The Serial port setup window should now appear:
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: <choose the device the serial cable is connected to>
(to prevent the serial port from ever being locked)
(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.
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:
Down arrow to Modem and Dialing and hit enter.
The modem and dialing setup screen should now appear:
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: <blank>
Reset string: <blank>
Dialing prefix #1: <blank>
Dialing suffix #1: <blank>
Dialing prefix #2: <blank>
Dialing suffix #2: <blank>
Dialing prefix #3: <blank>
Dialing suffix #3: <blank>
Connect string: <blank>
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.
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 is not set 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 **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.
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.
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:
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
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 the Kernel to the Target) and begin to use 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:~>
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 email@example.com:/
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.
More infos: Remote Shells
This terminal program is an established alternative to hyperterminal, and also easier to setup, because you are not confused with setup dialogs related to PSTN-like connections.
Two versions exists. V2.3 is under 1M and supports serial and TCP/IP connections with telnet (even colorful prompts are supported). Download URL:
The more recent version V4.67 is 10 times as big, but that includes a bunch of add-ons, including SSH-2 support. Download URL:
Upon first start, a dialog occurs where you must select between serial and TCP/IP. Subsequent starts do without this dialog. Serial settings must be set up in the Setup⇒Serial port… dialog. You may also wish to set up a big screen buffer: Setup⇒Window… (item Scroll buffer), or set up the default window size: Setup⇒Terminal…
Upon each start-up, the terminal is active. If the set-up is done properly you should be able to see output from U‑Boot or uClinux when they are run.
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):
Name: <type any appropriate name for the session>.
The Connect To window should now appear:
Connect using: <choose the port the serial cable is connected to>
The COMX Properties window should now appear:
Bits per second: 57600
Data bits: 8
Stop bits: 1
Flow Control: None
The terminal session should now be connected. You should now be able to see output from U‑Boot or uClinux when they are run.
As a Windows counterpart for rcp/rsh, the puTTY package fits well. WinSCP uses puTTY resources and provides a dual pane file manager where you can even preset a directory of your local host machine for the left pane and a preset directory for the connected target. Does not work with sftp protocol, you should select SCP or allow “fallback to SCP” in the appropriate connect dialog. Home page: http://winscp.net/
Note: Linux two pane file managers tend to fail in building up connections to blackfin targets, even when fish or scp (ssh-1) is supported.