Difference between revisions of "Getting Phidget on chumby"
From Chumby Wiki
(New page: This page is in editing, please check back later.) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | This | + | Here's a HOWTO on setting up Phigets C development environment on chumby. |
+ | |||
+ | =Install GCC= | ||
+ | * SSH into your device [[http://wiki.chumby.com/mediawiki/index.php/Chumby_tricks#Hidden_screen_in_Control_Panel view guide]]. | ||
+ | * type 'gcc' (without quote), you'll be prompt to download & install gcc package. You'll see something like this | ||
+ | chumby:~# gcc | ||
+ | GCC isn't on this device by default, but it's possible to download a | ||
+ | package and install it. If you like, we can try fetching one from | ||
+ | http://files.chumby.com/hacks/falconwing_toolchain.sh and installing it. | ||
+ | Install toolchain? [Y/n] Y | ||
+ | It'll take a couple of minutes. | ||
+ | |||
+ | =Install libusb & Phidgets library= | ||
+ | * Download source code for libusb 0.1.12 [http://prdownloads.sourceforge.net/libusb/libusb-0.1.12.tar.gz here] | ||
+ | * Download source code for Phidgets library [http://www.phidgets.com/downloads/libraries/libphidget_2.1.7.20110203.tar.gz here] | ||
+ | * Download [http://protobuf.googlecode.com/svn/tags/release-2.0.2/src/solaris/libstdc++.la libstdc++.la] file and save on a USB thumdrive (This is required by older libtool) | ||
+ | * Copy both libraries on to USB thumbdrive | ||
+ | * Connect the thumbdrive to your chumby | ||
+ | * Copy & extracted libraries source files to /mnt/storage | ||
+ | cp /mnt/usb/libusb-0.1.12.tar.gz /mnt/storage | ||
+ | cp /mnt/usb/libphidget_2.1.7.20110203.tar.gz /mnt/storage | ||
+ | cd /mnt/storage | ||
+ | tar xvf libusb-0.1.12.tar.gz | ||
+ | tar xvf libphidget_2.1.7.20110203.tar.gz | ||
+ | * Make chumby root filesystem writable and copy libstdc++.la (it's a tiny text file) to /lib to be used by libtool while compiling | ||
+ | mount -o remount,re / | ||
+ | cp /mnt/usb/libstdc++.la /lib | ||
+ | * Configure & compile libusb. We don't need to install libusb | ||
+ | cd /mnt/storage/libusb-0.1.12 | ||
+ | ./configure | ||
+ | make | ||
+ | * Copy header file & compiled libusb to libphidget folder | ||
+ | cp ./usb.h /mnt/storage/libphidget-2.1.7.20110203 | ||
+ | cp ./.libs/libusb.a /mnt/storage/libphidget-2.1.7.20110203 | ||
+ | * Configure & compile & install Phidgets library | ||
+ | cd /mnt/storage/libphidget-2.1.7.20110203 | ||
+ | ./configure | ||
+ | make | ||
+ | make install | ||
+ | * Done with the libraries, remount filesystem as read-only | ||
+ | mount -o remount,ro / | ||
+ | |||
+ | =Compile Phidgets examples= | ||
+ | * Download Phidgets Linux examples from [http://www.phidgets.com/downloads/examples/phidget21-c-examples_2.1.7.20110203.tar.gz here] | ||
+ | * Get it on your chumby device with a USB thumbdrive as above | ||
+ | * Copy header file & compiled libphidget to examples folder | ||
+ | cd /mnt/storage/libphidget-2.1.7.20110203 | ||
+ | cp ./phidget21.h /mnt/storage/phidget21-c-examples-2.1.7.20110203 | ||
+ | cp ./.libs/phidget21.a /mnt/storage/phidget21-c-examples-2.1.7.20110203 | ||
+ | * Configure & compile & all examples | ||
+ | cd /mnt/storage/phidget21-c-examples-2.1.7.20110203 | ||
+ | ./configure | ||
+ | make | ||
+ | |||
+ | That's it. Now we have a development environment to compile C/C++ code on your chumby. | ||
+ | Try connecting Phidgets to chumby and run one of the examples. | ||
+ | |||
+ | Use 'gcc' directly to compile your own Phidgets application | ||
+ | gcc MyPhidgets.c -o MyPhidgets -lphidget21 | ||
+ | |||
+ | =Clean up= | ||
+ | * Delete downloaded tarball | ||
+ | rm /mnt/storage/libusb-0.1.12.tar.gz | ||
+ | rm /mnt/storage/libphidget_2.1.7.20110203.tar.gz |
Latest revision as of 06:39, 27 February 2011
Here's a HOWTO on setting up Phigets C development environment on chumby.
Install GCC
- SSH into your device [view guide].
- type 'gcc' (without quote), you'll be prompt to download & install gcc package. You'll see something like this
chumby:~# gcc GCC isn't on this device by default, but it's possible to download a package and install it. If you like, we can try fetching one from http://files.chumby.com/hacks/falconwing_toolchain.sh and installing it. Install toolchain? [Y/n] Y
It'll take a couple of minutes.
Install libusb & Phidgets library
- Download source code for libusb 0.1.12 here
- Download source code for Phidgets library here
- Download libstdc++.la file and save on a USB thumdrive (This is required by older libtool)
- Copy both libraries on to USB thumbdrive
- Connect the thumbdrive to your chumby
- Copy & extracted libraries source files to /mnt/storage
cp /mnt/usb/libusb-0.1.12.tar.gz /mnt/storage cp /mnt/usb/libphidget_2.1.7.20110203.tar.gz /mnt/storage cd /mnt/storage tar xvf libusb-0.1.12.tar.gz tar xvf libphidget_2.1.7.20110203.tar.gz
- Make chumby root filesystem writable and copy libstdc++.la (it's a tiny text file) to /lib to be used by libtool while compiling
mount -o remount,re / cp /mnt/usb/libstdc++.la /lib
- Configure & compile libusb. We don't need to install libusb
cd /mnt/storage/libusb-0.1.12 ./configure make
- Copy header file & compiled libusb to libphidget folder
cp ./usb.h /mnt/storage/libphidget-2.1.7.20110203 cp ./.libs/libusb.a /mnt/storage/libphidget-2.1.7.20110203
- Configure & compile & install Phidgets library
cd /mnt/storage/libphidget-2.1.7.20110203 ./configure make make install
- Done with the libraries, remount filesystem as read-only
mount -o remount,ro /
Compile Phidgets examples
- Download Phidgets Linux examples from here
- Get it on your chumby device with a USB thumbdrive as above
- Copy header file & compiled libphidget to examples folder
cd /mnt/storage/libphidget-2.1.7.20110203 cp ./phidget21.h /mnt/storage/phidget21-c-examples-2.1.7.20110203 cp ./.libs/phidget21.a /mnt/storage/phidget21-c-examples-2.1.7.20110203
- Configure & compile & all examples
cd /mnt/storage/phidget21-c-examples-2.1.7.20110203 ./configure make
That's it. Now we have a development environment to compile C/C++ code on your chumby. Try connecting Phidgets to chumby and run one of the examples.
Use 'gcc' directly to compile your own Phidgets application
gcc MyPhidgets.c -o MyPhidgets -lphidget21
Clean up
- Delete downloaded tarball
rm /mnt/storage/libusb-0.1.12.tar.gz rm /mnt/storage/libphidget_2.1.7.20110203.tar.gz