RSB-4220 User Manual
56
3.9
Development Guide and Reference
3.9.1
Development of C/C++ Programs
This section will guide you how to write a sample application “Hello World”. You can
refer to following steps:
1.
Open "Terminal" on Ubuntu 12.04 LTS and Change to “root”:
Type user password.
2.
Create the develop environment using flowing command:
3.
Edit the helloworld.c with the following source code:
Save the file and exit.
4.
Compile helloworld.c using flowing command:
Then you can see “helloworld” in current directory.\
5.
Run the executable file helloworld on the RSB-4220.
Insert the Linux system SD card to your developing computer.
Remove this SD card and insert it to RSB-4220, then open serial console.
On RSB-4220 platform, type #root (Login)
On RSB-4220 platform, type #cd /tool
On RSB-4220 platform, type #./helloworld
Now you should be able to see “Hello World!” shown on RSB-4220.
$ sudo su
#source /usr/local/cross_compiler/linux-devkit/environment-setup
# cd /root//4220LBVxxxx_yyyy_mm_dd/source
# mkdir helloworld
# cd helloworld
# gedit hellowrold.c
#include <stdio.h>
void main()
{
printf("Hello World!\n");
}
# $CC -o helloworld helloworld.c
# cp helloworld /media/rootfs/tool
Note!
/media/rootfs is the mounted point of your Linux system SD card.