• Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors
HomepcDuinoAndroid for pcDuinoWrite a Simple Command-Line Program to Control Har ...
Previous Next

Write a Simple Command-Line Program to Control Hardware under Android on pcDuino

Posted by: admin , November 28, 2014

In pcDuino, there are two flavors to write program to control hardware, command-line and QT GUI. In this post, we go through the first one: command-line program.

To make things simple, we use a virtual box on a windows PC to install 64-bit Ubuntu PC. So all the work done below is on a 64 bit machine if it is done on a X86 PC.

Step 1: Download source code (including 64-bit arm toolchain for android)

$ git clone https://github.com/liaods/c_enviroment_android.git

Step 2: Modify  \c_enviroment_android\Makefile(The Make file is for qt-android APK by default, do a little change for command line program).

  • Change CFLAGS from “CFLAGS = -fPIC -DQT_ANDROID” to “CFLAGS = -fPIC”
  • Uncomment the line “make  -C sample’.

Step 3. Run build script to build the samples ( target is output/test under c_enviroment_android )

$./build_for_android.sh

Step 4: Copy the output on output/test to pcDuino by using OTG port or SD card.

 

android_commandline

 

Note:
The toolchain included is 64-bit, if your machine is 32-bit, you need to generate the toolchain by yourself.
Download android ndk and run:

$./build/tools/make-standalone-toolchain.sh --platform=android-14 --system=linux-x86

Share!
Tweet

admin

About the author

Leave a Reply Cancel reply

You must be logged in to post a comment.

Category

  • Home
  • pcDuino
  • WiKi
  • Store
  • Distributors