advertisement
phyCORE-i.MX35 Getting More Involved
•
You will see the following output:
Welcome to the World of the phyCORE-i.MX35! (serial)
Welcome to the World of the phyCORE-i.MX35!
•
Close Microcom.
When you start the application over an SSH session, you only see one output line. When you execute the program with Microcom, you see two output lines.
The first line is a direct output on the serial interface. You can’t see this line in an SSH session, because you are connected over a TCP/IP connection to the target. With Microcom, however, you have direct access to serial interface, so you can also see the line that it written to the serial console.
In this passage you have changed an existing application. You also learned how to access the serial interface. First you called the function open() on the device /dev/console. The return value of this function was a file descriptor. With the file descriptor you called the function write() to send n bytes to the device /dev/console. After that, the file descriptor was closed with the function close().
This procedure is in principle quite typical for Linux because Linux treats everything like a file.
3.5 Starting a Program out of Eclipse on the Target
After compiling a project in Eclipse, the program is copied to the target and directly executed. A program can also be executed on the target without compiling a project. In the following section you will learn how to start a program on the target as an external tool.
© 2009 PHYTEC Messtechnik GmbH L-724e_2
65
phyCORE-i.MX35 Quick Start Instructions
•
Select Run ► External Tools ► External Tools from the menu bar.
66
•
Select Program.
•
Select New.
© 2009 PHYTEC Messtechnik GmbH L-724e_2
phyCORE-i.MX35 Getting More Involved
•
In the Name input field, enter: myHelloWorld Target
•
Enter /usr/bin/ssh in the Location input field.
•
Enter [email protected] ./myHelloWorld into the Arguments field.
•
Select Apply.
•
Select Run.
If you want to execute the program the next time, you can use the
Run External Programs
button from the menu bar.
© 2009 PHYTEC Messtechnik GmbH L-724e_2
67
phyCORE-i.MX35 Quick Start Instructions
3.6 Automatically Starting the Program when Booting the
Target
In this passage you will integrate the myHelloWord program into the startup process of the target. When you have finished this part, the
myHelloWorld
application will be started automatically each time you are starting the target.
The scripts for controlling the system startup live in /etc/init.d.
These are executed directly or indirectly by /sbin/init, the father of all processes. The configuration of /sbin/init is placed in /etc/inittab.
After system startup, /sbin/init will switch to the default run level, as configured in /etc/inittab. It calls the run level master script /etc/init.d/rcS to start or stop services provided by the other scripts in /etc/init.d. This is done by the help of symbolic links in the directory /etc/rc.d. These links point to the actual startup scripts in /etc/init.d.
First you will have to create a startup script in /etc/init.d.
•
Click the FTP for Target icon on your KDE desktop.
68
© 2009 PHYTEC Messtechnik GmbH L-724e_2
phyCORE-i.MX35 Getting More Involved
•
Browse to the target’s /etc/init.d. If an authorization dialog should appear, just click on OK (no password is required for FTP access).
In the directory /etc/init.d you can see the existing scripts.
•
Right-click in the opened window and select Create New ► Text File.
•
Enter myHelloWorld.
•
Click OK.
•
Right-click on myHelloWorld and select Open with.
•
Enter kwrite and click OK.
The text editor KWrite starts with an empty document.
© 2009 PHYTEC Messtechnik GmbH L-724e_2
69
phyCORE-i.MX35 Quick Start Instructions
70
•
Enter the following two lines:
#!/bin/sh
/home/myHelloWorld
•
Select File ► Save.
•
Close the KWrite window.
•
Close the FTP window.
•
Click the Telnet for Target icon on your desktop.
© 2009 PHYTEC Messtechnik GmbH L-724e_2
phyCORE-i.MX35 Getting More Involved
•
Enter root and press Enter to login.
•
The startup script we have just created with KWrite must be made executable in order to run it later:
chmod a+x /etc/init.d/myHelloWorld
•
Change to the directory /etc/rc.d. Type the following command:
cd /etc/rc.d
•
Enter ls -l to list the directory contents.
You can see the different links to the scripts in the directory
/etc/init.d
. The scripts are started in alphabetic order: The script udev is the first script started because the link starts with S00…, whereas
S99zzz_PHYTEC_BSP_version_startup_script
will be started last.
To start your myHelloWorld application automatically when the system boots, you have to create a new link to the start script
/etc/init.d/myHelloWorld.
•
In
/etc/rc.d,
create a symbolic link which points to
/etc/init.d/myHelloWorld.
Enter the following command:
ln -s /etc/init.d/myHelloWorld /etc/rc.d/S99myHelloWorld
•
Type ls -l again to check the newly created link.
•
Close the window.
•
Open Microcom.
•
Push the RESET button on the target to restart your system.
© 2009 PHYTEC Messtechnik GmbH L-724e_2
71
phyCORE-i.MX35 Quick Start Instructions
The program myHelloWorld now starts automatically on startup.
Because its link in /etc/rc.d starts with S99…, you should see
myHelloWorld
’s output near the output of the two other scripts that start with S99… (which print all sorts of version information).
•
Close Microcom.
Now you can add your own programs to the root file system and start these programs automatically when your phyCORE-i.MX35 boots.
You have successfully passed the “Getting More Involved” part of this Quick Start.
72
© 2009 PHYTEC Messtechnik GmbH L-724e_2
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 5 Introduction
- 5 Rapid Development Kit Documentation
- 5 Professional Support Packages available
- 6 Overview of this Quick Start Instruction
- 7 Conventions Used In This Quick Start Manual
- 8 System Requirements
- 8 Software Development Tool Chains
- 8 Eclipse
- 9 The GNU Cross Development Tool Chain
- 11 Getting Started
- 11 Requirements of the Host Platform
- 12 Configuring the Host Platform
- 12 Installing Software packages
- 18 Set Up Network Card Configuration
- 19 Disabling the Firewall
- 20 Set Up TFTP Server
- 22 Linux-i.MX35-Kit Setup
- 23 Starting the Setup
- 31 Advanced Configuration Information
- 32 Connecting the host with the target
- 36 Copying an Example to the Target
- 37 Copying a program to the target
- 38 Using Telnet to Execute a Program on The Target
- 39 Using SSH to Execute a Program on The Target
- 42 Advanced Information
- 42 Copying a Program to the Target With the Command Line
- 42 Executing a Program on the Target
- 42 Executing a Program Directly on the Target Using SSH
- 44 Getting More Involved
- 44 Configuring and Compiling the Kernel
- 47 Writing the Kernel into the Target’s Flash
- 51 Opening an Existing Project
- 52 Copying the HelloWorld Project
- 52 Starting Eclipse and Importing the Example Project
- 57 Creating a New Project
- 67 Changing the Demo Application
- 68 Executing the Program on the Target using Microcom
- 69 Starting a Program out of Eclipse on the Target
- 77 Debugging an Example Project
- 77 Starting the GDB server on the target
- 79 Configuring and Starting the Debugger in Eclipse
- 83 Setting a Breakpoint
- 84 Stepping and Watching Variable Contents
- 86 Changing Variable Values
- 88 Using the Memory Monitor
- 91 Further Information
- 92 Summary
- 93 Installing Linux on the phyCORE-i.MX
- 93 Installing the Boot Loader
- 98 Configuring Environmental Variables
- 102 Restoring the U-Boot Default Configuration
- 102 Writing the Kernel / Root File System into Flash