7.6 Using TFTP 7.8 Importing a Real Disk into Simics
Simics User's Guide  /  II Feature Overview  /  7 Moving Data in and out of the Simulation  / 

7.7 Using FTP service

The service-node provides a FTP service to support file transfers with the host using FTP clients on a target machine.

Assuming a service-node has been created, and that it is named default_service_node0, the FTP-service will be named default_service_node0.ftp. The service node must be configured with an IP address and connected to a link before the FTP service can be enabled and configured. The FTP root directory, the location on the host system for transferred files, can be set by the set-ftp-directory command. The default root directory is the current directory for the Simics session, usually your project directory.

On a target that runs Clear Linux there is usually a curl command for transferring data using various protocols, it can put a file to the server and retrieve a file from the server.

Here is an example on using the FTP service on a target running Firststeps with a network. Start Simics and run the following commands:

simics> run-command-file "targets/qsp-x86/firststeps.simics"
simics> default_service_node0.set-ftp-directory dir = "/tmp/"

A Firststeps target was created. The target machine's IP address is 10.10.0.1 and it contains a default_service_node0 with the FTP service. The root directory was set to the /tmp/ directory on the host file system.

Continue the simulation until a prompt is reached.

simics> c

When prompt has been reached, the curl command can be run in the text console.

~ # curl -T /etc/hostname ftp://10.10.0.1/targetfile.txt

The contents of the target file /etc/hostname has now been sent to the host file targetfile.txt in the path set from the set-ftp-directory command. In similar way:

~ # curl ftp://10.10.0.1/targetfile.txt -o hostfile.txt

will retrieve a file, targetfile.txt, from the host and save it as hostfile.txt on the target.

Using other kind of distributions of Linux than Clear Linux there will most likely exist a ftp command in the shell for running a ftp client. An example on how to put a file to the host:

#> ftp 10.10.0.1
Connected to 10.10.0.1.
220 Welcome to the Simics FTP server
Name (10.10.0.1:simics): <enter>
230 User logged in
ftp> put /proc/cpuinfo targetfile.txt
local: /proc/cpuinfo remote: targetfile.txt
200 OK
150 transfer about to start
226 file transfer done
6520 bytes sent in 0.00 secs (12734.4 kB/s)

If running Microsoft Windows as target then Windows Internet Explorer can be used as client to connect to the FTP service by entering ftp://10.10.0.1 as address. This will allow transfer from host to target. To be able to transfer files back to the host you will need to select Page → Open FTP Site in Windows Explorer.

7.6 Using TFTP 7.8 Importing a Real Disk into Simics