Learn to Optimize Code in Assembly… for Android

Learn to Optimize Code in Assembly… for Android | Hackaday

When programming a microcontroller, there are some physical limitations that you’ll come across much earlier than programming a modern computer, whether that’s program size or even processor speed. To make the most use of a small chip, we can easily dig into the assembly language to optimize our code. On the other hand, modern processors in everyday computers and smartphones are so fast and have so much memory compared to microcontrollers that this is rarely necessary, but on the off-chance that you really want to dig into the assembly language for ARM, [Uri Shaked] has a tutorial to get you started.

The tutorial starts with a “hello, world” program for Android written entirely in assembly. [Uri] goes into detail on every line of the program, since it looks a little confusing if you’ve never dealt with assembly before. The second half of the program is a walkthrough on how to actually execute this program on your device by using the Android Native Deveolpment Kit (NDK) and using ADB to communicate with the phone. This might be second nature for some of us already, but for those who have never programmed on a handheld device before, it’s worthwhile to notice that there are a lot more steps to go through than you might have on a regular computer.

If you want to skip the assembly language part of all of this and just get started writing programs for Android, you can download an IDE and get started pretty easily, but there’s a huge advantage to knowing assembly once you get deep in the weeds especially if you want to start reverse engineering software or bitbanging communications protocols. And if you don’t have an Android device handy to learn on, you can still learn assembly just by playing a game.

One thought on “Learn to Optimize Code in Assembly… for Android

  1. It’s not ARM or Intel assembly, but MIPS has a wonderful set of simulators thanks to it’s use teaching in universities. Last I checked Mars was the best of these, not that it’s under very active development.

Leave a Reply Cancel reply

Fill in your details below or click an icon to log in:

Learn to Optimize Code in Assembly… for Android | Hackaday

You are commenting using your WordPress.com account. Log Out /  Change )

Learn to Optimize Code in Assembly… for Android | Hackaday

You are commenting using your Google+ account. Log Out /  Change )

Learn to Optimize Code in Assembly… for Android | Hackaday

You are commenting using your Twitter account. Log Out /  Change )

Learn to Optimize Code in Assembly… for Android | Hackaday

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.