Wednesday, 26 August 2009

Windows 7 free legally via MSDNAA - Download Today!

Windows 7 is available for free via the MSDNAA.

The MSDNAA (wiki) provides students with free MS software, I'm not sure how widespread access is. I have an account
as a student of Imperial College London's Computer Science depatrment. I would be interested to know if you have to be a CS student, whether it's just in the UK and just Univesity etc.

I am not advocating this as your main OS just yet (I haven't even installed it). However, it would be naive to underestimate the impact of the software on our industry, you should at least try it if you get it free!
If the industry reviews are anything to go by then MS have certainly righted some wrongs with this iteration - let me know what you think and how widespread availability is.

Hope you're all having a great summer!

Sunday, 7 June 2009

Android Native Code Benchmarks

I have setup some basic tests to compare the runtime of algorithms on
Dalvik Vs those run Natively on a G1.

The tests can be found here;

http://code.google.com/p/android-benchmarks/

Go to 'source' and checkout with SVN.

There are a bunch of links at the bottom of this page for those that
are interested in trying JNI;

http://www.android-internals.org/index.php?title=Main_Page

Although officially it's not supported there is an NDK planned for the
near future (End of 2009);

http://groups.google.com/group/android-ndk

My preliminary results show that quick sort is vastly slower than
native code on the G1 whereas the Sun JVM versus native code (gcc -O2)
are essentially the same on a desktop.

I'm not saying it's groundbreaking info but it's nice to have some
hard statistics. You'll have to change the output log file names to
run this and have the Code Sourcery compiler installed.

I hope to stick some graphs up soon!

Cheers,

Gav

Saturday, 23 May 2009

Android 1.5 and JNI - Basic Example

I have adapted a tutorial written by Davanum Srinivas in 2007, I give all credit to him, I merely updated some stuff for Android 1.5. While we wait for the android-ndk for those of you that get a thrill calling a C library from an android application here's an updated run down.

Requirements

- Dev phone (Hopefully I'll create a better version soon)
- Android SDK 1.5
- Sourcery G++ Lite 2009q1-176 (It's the one I used although EABI might be correct)

  1. Create a new Android project in eclipse
  2. Create an empty folder (native) in the root of the project
  3. Setup your main activity
  4. Setup your static java class to call your native library
  5. Generate header files as per any JNI project
    • cd /path-to-android-project/native/
    • javah -classpath /path-to-sdk/platforms/android-1.5/android.jar:../bin/ com.example.StaticNativeWrapper
  6. Write your native file to match the header file generated
  7. Copy the modified armelf_linux_eabi.xsc to your 'native' folder to find out how and why it's modified check out motz diary.
  8. Compile and link the headers from step 5 and the native code from step 6
    • arm-none-linux-gnueabi-gcc -I/usr/lib/jvm/java-6-sun/include -I/usr/lib/jvm/java-6-sun/include/linux -fpic -c uk_ac_ic_doc_gea05_miffedjni_nativewrappers_NativeAdd.c
    • arm-none-linux-gnueabi-ld -T armelf_linux_eabi.xsc -shared -o libNativeAdd.so uk_ac_ic_doc_gea05_miffedjni_nativewrappers_NativeAdd.o
  9. Put the library on your sdcard and put it in the data for your application;
  • adb push libNativeAdd.so /sdcard/native/libNativeAdd.so
  • adb shell
    • # cat /sdcard/native/libNativeAdd.so >/data/data/com.example.application/libNativeAdd.so
  • Install your application and enjoy!
    • adb install ../bin/Application.apk
Hopefully this works for you. I'm just trying to work out how to change step 8 so that the library is an asset that's loaded to /data/ on install. If anyone can help I think all the info is in the penultimate paragraph of koushik's blog I just don't have time to look at it right now.

Feel free to check out my project over svn and play around with it.

Have fun!