advertisement
phyCORE-MPC5200B tiny/IO QuickStart Instructions
3.5 Changing the Demo
Now we will extend the myHelloWorld application. The extended myHelloWorld application will write an output on the serial interface ttyPSC0 and the standard output.
•
Open Eclipse if is not opened yet.
•
Double-Click HelloWorld.c in the myHelloWorld project.
•
First include two additional header files:
#include <unistd.h>
#include <fcntl.h>
•
Then add the function write_tty to write n bytes to the serial interface /dev/ttyPSC0.
void write_tty(char *buffer, int count)
{
int out;
out=open("/dev/ttyPSC0",O_RDWR);
write(out,buffer,count);
close(out);
}
•
Enter the following two lines in the main function to declare the buffer und call the write_ttyS0() function.
char buf[]={"Welcome to the World of the phyCORE-
MPC5200
(ttyPSC0)\n"}; write_tty(buf,sizeof(buf)-1);
On the next screenshot you can see the complete program.
74
© PHYTEC Messtechnik GmbH 2007 L-679e_5
Getting More Involved
•
Save your program after changing the code.
The Application will be compiled, built, copied to the target and executed.
Executing the program on the target with Komport:
•
Click on the Komport icon on the desktop
•
If your are not logged in, enter root and press enter.
•
Type ./myHelloWorld to start the application.
•
You will see the following output:
Welcome to the world of the phyCORE-MPC5200! (ttyPSC0)
Welcome to the world of the phyCORE-MPC5200!
© PHYTEC Messtechnik GmbH 2006 L-679e_5
75
advertisement
Related manuals
advertisement
Table of contents
- 4 Introduction
- 4 Rapid Development Kit Documentation
- 5 Professional Support Packages available
- 5 Overview of this QuickStart Instruction
- 6 Conventions used in this QuickStart
- 7 System Requirements
- 8 The PHYTEC phyCORE-MPC5200B tiny/IO
- 11 Software Development Toolchains
- 11 Eclipse
- 12 The Gnu Cross Development Toolchain
- 13 Getting Started
- 13 Requirements of the Host Platform
- 14 Configuring the Host Platform
- 14 Installing Software packages
- 20 Setup Network Card Configuration
- 23 Disabling the Firewall
- 24 Setup TFTP-Server
- 26 Linux-PowerPC-Kit Setup
- 36 Connecting the host with the target
- 42 Copying an Example to the Target
- 51 Getting More Involved
- 51 Configuring and Compiling the Kernel
- 55 Writing the Kernel into Flash
- 60 Opening an Existing Project
- 66 Creating a New Project
- 76 Changing the Demo
- 78 Starting a program out of Eclipse on the target
- 82 Starting the program when booting the target
- 87 Debugging an Example Project
- 87 Starting the GDB-Server on the target
- 89 Configuring and starting the debugger in Eclipse
- 94 Setting a breakpoint
- 95 Stepping and Watching Variables Content
- 97 Changing Variables Values
- 99 Using the Memory Monitor
- 102 Further Information
- 103 Summary