Uploading and running the “hello” program, Developing your first application, Uploading and running the “hello” program -15 – Moxa Technologies THINKCORE W341 User Manual
Page 24: Developing your first application -15

d
e
t
r
a
t
S
g
n
it
t
e
G
l
a
u
n
a
M
s
’r
e
s
U
x
u
n
i
L
1
4
3
/
1
2
3
/
1
1
3
W
e
r
o
C
k
n
i
h
T
2-15
NOTE
Since Moxa’s tool chain places a specially designed Makefile in the directory
/tmp/example/hello, be sure to type the #make command from within that directory. This
special Makefile uses the mxscale-gcc compiler to compile the hello.c source code for the Xscale
environment. If you type the #make command from within any other directory, Linux will use
the x86 compiler (for example, cc or gcc).
Refer to Chapter 5 to see a Makefile example.
Uploading and Running the “Hello” Program
Use the following commands to upload hello-release to the W311/321/341 by FTP.
1. From the PC, type:
#ftp 192.168.3.127
2. Use the bin command to set the transfer mode to Binary mode, and then use the put command
to initiate the file transfer:
ftp> bin
ftp> put hello-release
3. From the W311/321/341, type:
# chmod +x hello-release
# ./hello-release
The word Hello will be printed on the screen.
root@Moxa:~# ./hello-release
Hello
Developing Your First Application
We use the tcps2 example to illustrate how to build an application. The procedure outlined in the
following subsections will show you how to build a TCP server program plus serial port
communication that runs on the W311/321/341.
ftp> cd /home