Going Low Level

First Steps into Assembly Programming

Some time ago I have on boarded on a very ambitious project that I though could be overkill, nevertheless I have persevered in my ambition to prove it is doable. Tired of looking for all kind of OSX IDE solutions for my embedded programming projects, I thought that creating one myself would be a cool idea.

One year later, and mostly due to lack of enough time, I am still at this level[s]:

Micro project - IDE for embedded programming on Mac OSX

Micro project – IDE for embedded programming on Mac OSX

Micro Project IDE - general IDE preferences - colors

Micro Project IDE – general IDE preferences – colors

Micro Project IDE - general IDE preferences - code indentation

Micro Project IDE – general IDE preferences – code indentation

Which means, almost nothing – well, sort of: logic for preferences in place and some routines for creating new projects… that’s all.

The battle is not finished, yet. And I will not give up, but probably a better planning will be handy. However, as I needed to dig a bit into Assembly language, I have gathered some resources I thought it might be useful to share here. Most of them can be found here, but I will restructure this page with more and more information as I will dive deeper in the topic.

For writing many/ complex assembly functions then I’d recommend a standalone Assembly file for GCC, or an external assembler such as FASMARM.

A very good but old intro to ARM Assembly can be found at http://www.coranac.com/tonc/text/asm.htm. This is a good way to learn the basics of ARM Assembly from scratch.

Another brief introduction about writing ARM Assembly code with GCC can be found at Begin Programming Assembler with GCC. Same resource also has a very good inline assembler cookbook at ARM GCC Inline Assembler Cookbook. This is handy if one is using the GCC inline assembler.

In what regards general Assembly Programming, check the official [instruction set] reference manual on the ARM website, which can be download at ARM and Thumb-2 Quick Reference Card. Please also refer to documentation for specific CPUs. For example, the iPhone 3GS and iPhone 4 both have an ARMv7-A Cortex-A8 CPU, so you download the ARM Architecture Reference Manual ARMv7-A and ARMv7-R Edition (2000 pages long) that tells you exactly which instructions are available and exactly how they work, and the Cortex-A8 Technical Reference Manual (700 pages long) that explains the instruction timing, etc for your specific CPU. There is also a recent ARM Cortex-A Programmer’s Guide, containing useful info and comparisons of Cortex-A8, Cortex-A9, Cortex-A5 and Cortex-A15 CPUs.

It is important to understand that many ARM CPU’s include the NEON Advanced SIMD coprocessor (aka NEON Media Processing Engine), and so if you expect to run operations that can take advantage of SIMD architecture (eg: heavily data parallel tasks), then you should make it a big priority to learn how to use NEON effectively! As mentioned above, the official ARM Architecture Reference Manual and ARM Cortex-A8 Reference Manual are the most important sources of info, but there are other places for quicker info such as:

Stay tuned. More to come.

Filed in Apple Programming and tagged , .

Leave a Reply

Your email address will not be published. Required fields are marked *