Difference between revisions of "Android"

From sigrok
Jump to navigation Jump to search
m
(Android nightly APK for x86.)
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''NOTE:''' This page is work in progress!
This page describes how you can use sigrok on Android devices.
 
== Screenshots ==
 
[[PulseView]] running on a 7" ARM Android tablet (800x400):
 
<gallery>
File:Pulseview android chronovu la8 i2c.png|<small>[[ChronoVu LA8]], I²C</small>
File:Pulseview android usbeesx uart.png|<small>[[CWAV USBee SX]], UART</small>
File:Pulseview android ds1052e.png|<small>[[Rigol DS1052E]]</small>
</gallery>
 
== Nightly APK builds ==
 
You can download and install the experimental [[PulseView]] nightly build APK:
 
* [http://sigrok.org/jenkins/job/sigrok-cross-android/platform=cross-arm-linux-androideabi/lastSuccessfulBuild/artifact/PulseView-NIGHTLY.apk PulseView-NIGHTLY.apk (ARM)]
* [http://sigrok.org/jenkins/job/sigrok-cross-android/platform=cross-i686-linux-android/lastSuccessfulBuild/artifact/PulseView-NIGHTLY.apk PulseView-NIGHTLY.apk (x86)]
 
The APK ships [[PulseView]] for Android including all required libraries, protocol decoders, and so on.
 
=== Firmware files ===
 
In order for [[libsigrok]]/[[PulseView]] to be able to find [[Firmware|firmware files]] for certain devices, you have to copy them to the following location:
 
'''/sdcard/sigrok-firmware'''
 
Please check [[libsigrok]]'s [http://sigrok.org/gitweb/?p=libsigrok.git;a=blob;f=README.devices README.devices] file or the respective wiki page to find out whether your device needs firmware files.
 
=== Issues ===
 
Please check the [http://sigrok.org/bugzilla/buglist.cgi?list_id=2259&query_format=advanced&resolution=---&op_sys=Android list of known Android related issues]. If you have specific issues which are not listed yet, please [http://sigrok.org/bugzilla/enter_bug.cgi open a bug report] and attach the relevant information, e.g. which device you used, which architecture (ARM/x86/MIPS/etc), the relevant parts of the adb log, and so on.


== Building from source ==
== Building from source ==


=== Requirements ===
You can also build various sigrok components from source. The nightly APK (see above) is built using the [http://sigrok.org/gitweb/?p=sigrok-util.git;a=blob;f=cross-compile/android/sigrok-cross-android sigrok-cross-android] script from our [http://sigrok.org/gitweb/?p=sigrok-util.git;a=tree;f=cross-compile/android sigrok-util repository]. You can use that script to build your own APK locally (and/or modify it if you want).


* Android NDK
$ '''git clone git://sigrok.org/sigrok-util'''
$ '''cd sigrok-util/cross-compile/android'''


== Initial setup ==
The following invocation will install the required Android NDK, SDK, and toolchains into '''$HOME/android''' (per default). Please check the [http://sigrok.org/gitweb/?p=sigrok-util.git;a=blob;f=cross-compile/android/README README] and modify the [http://sigrok.org/gitweb/?p=sigrok-util.git;a=blob;f=cross-compile/android/sigrok-cross-android sigrok-cross-android] script to your needs.


First, download the latest [http://developer.android.com/tools/sdk/ndk/index.html Android NDK] and extract it, e.g. in '''$HOME/android'''.
$ '''./sigrok-cross-android prepare'''


$ '''cd $HOME'''
Then, in order to build the APK, you can run:
$ '''mkdir android'''
$ '''cd android'''
$ '''wget http://dl.google.com/android/ndk/android-ndk-r8d-linux-x86.tar.bz2'''
$ '''tar xfvj android-ndk-r8d-linux-x86.tar.bz2'''
$ '''cd android-ndk-r8d'''


Now, create a toolchain installation that can be used for cross-compiling for Android (adapt '''--platform''' and '''--arch''' as needed):
$ '''./sigrok-cross-android'''


$ '''./build/tools/make-standalone-toolchain.sh --platform=''android-9'' --install-dir=$HOME/android/android-arm-toolchain --arch=''arm'''''
The file '''build/pulseview/android/bin/PulseView-debug.apk''' is the APK that you can install on your Android device.


You now have a working toolchain and build environment in '''$HOME/android/android-arm-toolchain'''.
== Manual testing ==


Now prepend the toolchain's '''bin''' directory to your $PATH:
Create a temporary folder where you can store and execute files on your Android device.


  $ '''export PATH=$HOME/android/android-arm-toolchain/bin:$PATH'''
  $ '''adb shell'''
$ '''mkdir /data/local/tmp/sigrok'''
$ '''exit'''


We can now cross-compile packages for Android. Most autotools-using packages will usually just need a '''./configure --host=arm-linux-androideabi''', the rest is pretty straight-forward.
Copy libraries to your device:


=== libzip ===
$ '''cd ~/sr_android/lib'''
$ '''ls *.so* | while read l; do adb push $l /data/local/tmp/sigrok; done'''


$ '''wget http://www.nih.at/libzip/libzip-0.10.1.tar.gz'''
Copy '''sigrok-cli''' to the device:
$ '''tar xfvz libzip-0.10.1.tar.gz'''
$ '''cd libzip-0.10.1'''
$ '''autoreconf -i -f'''
$ '''./configure --host=arm-linux-androideabi --prefix=$HOME/sr_android && make && make install'''


=== libsigrok ===
$ '''cd ~/sr_android/bin'''
$ '''adb push sigrok-cli /data/local/tmp/sigrok'''


In a temporary build directory we can now build (the install directory will be '''$HOME/sr_android'''):
Test if '''sigrok-cli''' is working as expected:


  $ '''git clone git://sigrok.org/libsigrok'''
  $ '''adb shell'''
  $ '''cd libsigrok'''
  $ '''cd /data/local/tmp/sigrok'''
  $ '''./autogen.sh'''
  $ '''export LD_LIBRARY_PATH=/data/local/tmp/sigrok'''
  $ '''./configure --host=arm-linux-androideabi --prefix=$HOME/sr_android && make && make install'''
  $ '''./sigrok-cli --scan'''

Revision as of 22:21, 26 February 2015

This page describes how you can use sigrok on Android devices.

Screenshots

PulseView running on a 7" ARM Android tablet (800x400):

Nightly APK builds

You can download and install the experimental PulseView nightly build APK:

The APK ships PulseView for Android including all required libraries, protocol decoders, and so on.

Firmware files

In order for libsigrok/PulseView to be able to find firmware files for certain devices, you have to copy them to the following location:

/sdcard/sigrok-firmware

Please check libsigrok's README.devices file or the respective wiki page to find out whether your device needs firmware files.

Issues

Please check the list of known Android related issues. If you have specific issues which are not listed yet, please open a bug report and attach the relevant information, e.g. which device you used, which architecture (ARM/x86/MIPS/etc), the relevant parts of the adb log, and so on.

Building from source

You can also build various sigrok components from source. The nightly APK (see above) is built using the sigrok-cross-android script from our sigrok-util repository. You can use that script to build your own APK locally (and/or modify it if you want).

$ git clone git://sigrok.org/sigrok-util
$ cd sigrok-util/cross-compile/android

The following invocation will install the required Android NDK, SDK, and toolchains into $HOME/android (per default). Please check the README and modify the sigrok-cross-android script to your needs.

$ ./sigrok-cross-android prepare

Then, in order to build the APK, you can run:

$ ./sigrok-cross-android

The file build/pulseview/android/bin/PulseView-debug.apk is the APK that you can install on your Android device.

Manual testing

Create a temporary folder where you can store and execute files on your Android device.

$ adb shell
$ mkdir /data/local/tmp/sigrok
$ exit

Copy libraries to your device:

$ cd ~/sr_android/lib
$ ls *.so* | while read l; do adb push $l /data/local/tmp/sigrok; done

Copy sigrok-cli to the device:

$ cd ~/sr_android/bin
$ adb push sigrok-cli /data/local/tmp/sigrok

Test if sigrok-cli is working as expected:

$ adb shell
$ cd /data/local/tmp/sigrok
$ export LD_LIBRARY_PATH=/data/local/tmp/sigrok
$ ./sigrok-cli --scan