Test Drive - Hello World

 

With all tools installed and settings set, we now start build, download and execute our first program "Hello World".

 

/* -------------------------------------------------------------------

   "Hello World" Example

   ------------------------------------------------------------------- */

void Example00()

{   int i;

 

    for(i=0;i<10;i++)

    {   printf("Hello World %d\n",i);

        Sleep(1000);

    }

}

 

Before building the example program, remember to set the variable DEVICE in ¡¥bin/w90n7xx.inc¡¦ to the IP address of your target. In this example, we assume IP address = 10.0.0.145.

 

Build and Download Program

 

There are several ways to build the program. The following examples show how to use:

l          Command line

l          Gedit

l          Eclipse IDE

l          Netbeans IDE

 

 

Using command line

 

When using command line directly, only 2 commands are required.

l          cd prj/app/example

l          make

 

 

 

 

Using gedit

 

gedit is the default text editor in linux Gnome environment. With plugins, gedit can execute external programs without the need of issuing commands manually.

 

Select example.c in the file browser. The system will open the source code with gedit automactically. Then select menu {Tools->Build} or press Ctrl-F8, the system will start building process by calling ¡¥make¡¦ utility in current directly.

 

 

 

 

Using Eclipse IDE

 

Eclipse is an integrated development environment (IDE) which provides more functionalities than just a text editor (e.g. gedit). The project settings files are provided together with the source files. To start the project, you need first to import them into your workspace:

 

Select menu {File->Import}

Select Import from existing projects

Select root directory to ¡¥example¡¦

 

 

 

Then, in the {Project} menu, select {Build Project} or press Alt-F8 to start building the project.

 

 

 

Using Netbeans IDE

 

Sun¡¦s Netbeans, based on Java, is another powerful integrated development environment (IDE) which provides great functionalities. The project setting files are provided together with the source files. To start the project, you need first to open the project files:

 

Use the menu {File->Open Project} or press Ctrl+Shift+O to open the project ¡¥example-prj¡¦

 

 

 

Use menu {Run-Build Main Project} or press Alt+F8 to start building project.

 

 

 

Execute Program

 

Login into Telnet server of your device and change working directory to /usr which lives in RAM disk. The program "example" should have been downloaded there. In Linux, for security reason, current directory is not included in the program search path. To execute a program in current directory, you need to prefix "./" to the.program name as "./example".

 

Sash command shell (version 1.1.1)

/> cd /usr

/usr> ls

example

/usr> ./example

Hello World 0

Hello World 1

Hello World 2

Hello World 3

Hello World 4

Hello World 5

Hello World 6

Hello World 7

Hello World 8

Hello World 9

/usr>