5877 views|5 replies

298

Posts

1

Resources
The OP
 

Compilation and running of Linux-C test program based on iTOP-4412 development board [Copy link]

The iTOP-4412 development board can run many file systems. Before implementing specific functions on a specific file system, you can
use Linux-C programs to test the hardware and drivers. Moreover, these programs can be easily ported to Android, Qt/E, and
the minimum file system.
Special reminder: Linux-C programs are cross-platform. As long as you compile according to the method described below, you can
run Linux-C programs and Android systems together, and use Linux-C programs to test the content we are concerned about. In essence, we
can understand that Android is just a large file. Taking the first helloworld below as an example,
two programs "helloworld" + "Android" are running on the Linux kernel.
The Linux-C test program source code and executable program are in the network disk directory "iTOP4412 development board data summary (excluding CD
content)\iTOP-4412 development board system source code and image (others)\small module test program".
8.1 Compiling and running the test program
8.1.1 Setting the compilation environment
The C program application runs on Android, and the compiler used is gcc4.4.1. For the installation method of the compiler, refer to
Chapter 5.
Modify the environment variables as shown in the figure below.

(, downloads: 0)

After the modification, update the environment variables, as shown below

(, downloads: 0)

As shown in the figure below, enter "arm" and press the "TAB" key, and the compiler "arm-
none-linux-gnueabi-gcc-4.4.1" that will be used later will be displayed.

(, downloads: 0)

8.1.2 Compile the helloworld
program The source code of helloworld.c is as follows.

(, downloads: 0)

To compile the helloworld program, enter the command "arm-none-linux-gnueabi-gcc-4.4.1 -o helloworld
helloworld.c -static", as shown in the following figure.

(, downloads: 0)

As shown below, the executable file helloworld is generated.

(, downloads: 0)

8.1.3 Upload helloworld to the development board
The development board runs the factory-installed Android 4.0.3 system. Connect the serial console, start the development board, and
connect the OTG cable after Android is running.

Copy the executable file helloworld to the fastboot flashing directory, as shown in the figure below. This directory is
where the fastboot tool is located. For how to use the fastboot tool, refer to Section 3.6.

(, downloads: 0)

After the Android system of the development board runs stably, connect the OTG interface to the USB of the computer and open
the "cmd.exe" in the "USB_fastboot_tool\platform-tools" directory, as shown in the figure below.

(, downloads: 0)

As shown in the figure below, enter the command "adb push helloworld /data" to upload the program to
the "/data" directory of the development board.

(, downloads: 0)

Of course, you can also upload the executable file helloworld through the mobile assistant, TF card or USB flash drive.
8.1.4 Modify program permissions and run helloworld
As shown in the figure below, in the hyperterminal, enter "cd /data" to enter the "/data" directory, use "chmod 777 helloworld" to modify permissions, and finally enter the command "./helloworld" to run the program. "Hello world!"
will be printed in the hyperterminal , indicating that the program runs successfully.

(, downloads: 0)

In addition to modifying permissions and running programs through the console, you can also modify permissions and run programs through the adb console. As
shown in the figure below, after uploading the helloworld program, use the command "adb shell" to open the adb command line (for more adb
commands, refer to Section 3.6.4), use "cd /data" to enter the helloworld program upload directory "/data", use the command
"chmod 777 helloworld" to modify permissions, and then use "./helloworld" to run the helloworld executable
program. You can see that the adb console prints "Hello World!".

(, downloads: 0)

The following tests can use the serial console to run the program, or use the adb command to run the program.

This post is from Embedded System

Latest reply

Thanks for sharing the content...   Details Published on 2019-8-14 19:04
Personal signature更多开发板详情了解哦

1.https://arm-board.taobao.com
2.www.topeetboard.com
Q: 2551456065

1368

Posts

6

Resources
2
 

Good, keep it up!

This post is from Embedded System
 
Personal signature专注智能产品的研究与开发,专注于电子电路的生产与制造……QQ:2912615383,电子爱好者群: void
 

26

Posts

0

Resources
3
 

Okay, this post is awesome.

This post is from Embedded System
 
 
 

26

Posts

0

Resources
4
 

I learned a lot, thanks for sharing the content

This post is from Embedded System
 
 
 

298

Posts

1

Resources
5
 

(, downloads: 0)

This post is from Embedded System
 
Personal signature更多开发板详情了解哦

1.https://arm-board.taobao.com
2.www.topeetboard.com
Q: 2551456065
 
 

1

Posts

0

Resources
6
 

Thanks for sharing the content...

This post is from Embedded System
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list