[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avrdude-dev] cross compilation of avrdude for Android devices
From: |
luca tamburrano |
Subject: |
[avrdude-dev] cross compilation of avrdude for Android devices |
Date: |
Fri, 24 Oct 2014 15:19:04 +0200 |
Hi all,
I would like to share with you my successful experience (so far) of cross
compilation of avrdude for Android
First of all I created the following script for setting all the
cross-compilation variables and I placed it in the source folder of avrdude:
#!/bin/sh
export DEV_PREFIX=/Users/lucatamburrano/Documents/Triduino
export
LIBUSB1_SOURCE=/Users/lucatamburrano/Documents/Triduino/myavrdude/libusb-1.0.9
export
LIBUSBCOMPAT_SOURCE=/Users/lucatamburrano/Documents/Triduino/myavrdude/libusb-compat-0.1.4
export ANDROID_NDK=${DEV_PREFIX}/android-ndk-r10b
export CROSS_COMPILE=arm-linux-androideabi
export
ANDROID_PREFIX=${ANDROID_NDK}/toolchains/arm-linux-androideabi-4.8/prebuilt/darwin-x86_64
export SYSROOT=${ANDROID_NDK}/platforms/android-19/arch-arm
export CROSS_PATH=${ANDROID_PREFIX}/bin/${CROSS_COMPILE}
export CPP="${CROSS_PATH}-cpp --sysroot=$SYSROOT"
export AR="${CROSS_PATH}-ar "
export AS="${CROSS_PATH}-as --sysroot=$SYSROOT"
export NM="${CROSS_PATH}-nm --sysroot=$SYSROOT"
export CC="${CROSS_PATH}-gcc --sysroot=$SYSROOT"
export CXX="${CROSS_PATH}-g++ --sysroot=$SYSROOT"
export LD="${CROSS_PATH}-ld --sysroot=$SYSROOT"
export RANLIB="${CROSS_PATH}-ranlib "
export PREFIX=${DEV_PREFIX}/android-builds/
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
export CFLAGS="${CFLAGS} --sysroot=${SYSROOT} -I${SYSROOT}/usr/include
-I${ANDROID_PREFIX}/include -I${LIBUSB1_SOURCE}/libusb
-I${LIBUSBCOMPAT_SOURCE}/libusb"
export CPPFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib
-L${PREFIX}/lib -static "
./configure --host=${CROSS_COMPILE} --prefix=${PREFIX} "$@"
Once compiled as static libs both libusb1 and libusb-compat I encountered a
tricky problem related to not having recognised the libusb-compat in the
configure.
I finally found the following post where a guy had a similar problem
http://sourceforge.net/p/libusb/mailman/libusb-devel/thread/address@hidden/
and the solution was to modify the AC_CHECK_LIB line in configure.ac in order
to recognise the presence of the libusb-compat
AC_CHECK_LIB([usb], [usb_get_string_simple], [have_libusb=yes], [], [-lusb-1.0])
then I compiled everything with make and I successfully upload a sketch to
Arduino from my android mobile :)
I haven’t recompiled it yet with the libftdi support because I encountered some
problems with CMAKE, but I hope that sharing my experience will save many
headaches to people that are trying to do the same
hope that helps
Luca
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [avrdude-dev] cross compilation of avrdude for Android devices,
luca tamburrano <=