3

I need to make an architectural decision for developing (actually porting) my embedded solution on a tablet.
The choice comes down to Ubuntu or Android, so I have some specific questions to help me decide.

  • On Android, is it possible to develop applications outside of Dalvik, using Python? If yes, can I access the hardware this way, without the API's provided by the Android SDK?

  • On Android, can I control the process' core_affinity to bind a process to a single core? And can i use isolcpus to isolate other processes from that core making it a (almost) dedicated core for a process? This is possible in regular linux, not sure if it can be done in Android.

  • On Ubuntu, how much control over the HW do I have outside Ubuntu SDK?

gnat
  • 20,543
  • 29
  • 115
  • 306
bosnjak
  • 81

2 Answers2

4

Start with the proposition that an application has a user interface. How do you want that to look and behave? You have 4 choices.

  1. Android native. You're going to write Java, but you can extend it in C++ using the NDK.
  2. HTML5/Javascript. You're probably going to write Javascript, but you can extend it using a server or a wormhole.
  3. Renderer. You can write any language you like because you're going to be drawing your own widgets on a render surface, and they won't be native.
  4. Somebody's devkit. It will eventually do one of the above. Xamarin, Qpython, QT, etc. Whatever.

There is a lot to read eg (https://stackoverflow.com/questions/101754/is-there-any-way-to-run-python-on-android). None of it matters until you decide what kind of UI you want. If you want native you are going to write Java.

In answer to your questions:

  1. Yes, can write and run code, basically via the NDK or similar. Doesn't help with the UI.
  2. Dunno, but once you get down to the NDK you can do most stuff.
  3. Ubuntu is not Android. I'll leave that to others.

Regarding the NDK, I can tell you that it provides a reasonably fully-featured C++ development environment. Most (but not all) standard C++ library features are provided, as well as a set of APIs that hook into the Android process APIs (so you can write Activities entirely in C++), and a JNI capability.

There are device APIs (things like the accelerometer and GPS) that are intended to be accessed from Java, so we go via JNI. You may be able to access devices directly from C++, but I would expect you would tend to lose portability (across manufacturers) and higher level features.

Below that there are device drivers, a HAL, a Linux kernel and other interesting things. If that's where you want to play, there is plenty to read: http://s.android.com/devices/index.html.

david.pfx
  • 8,187
0

If the device in question is a custom or generic tablet on a conventional platform (x86, ARM...), then ask yourself what do you need exactly from it. Do you really need a whole Ubuntu distribution, or will the tablet boot directly into your application? In that case I would go for a basic embedded linux distribution that will take care of your hardware and a QT interface. If the device is running Android then you need to use the appropriate toolkit and API for Android OS. You could also go with a full blown Ubuntu and just develop a web app. In that case all you need is a web browser and you can run it on virtually any tablet, phone, or PC.