Android Porting Progress

Hi everyone,

Sorry I haven't posted anything recently, but my days were busy with work, and then my nights were busy porting Android to the FreeRunner. In short, it's coming along, slowly but surely.

I've basically had to teach myself ARM assembly language in the last couple of days (fun, fun, fun!) and thought that I would quickly share all of useful resources that I've come across. So here they are:

The ARM Architecture Reference Manual

This is the definitive reference for pretty much everything. After reading this, I don't think I'll need any other reference material. In fact, I might even print myself a hard copy!

UNSW lab material on microprocessors and embedded systems

This is a surprisingly detailed tutorial for programming ARM in assembly language and C, which sort of bridges the gap between the two languages. It explains precisely the syntax of .S files and complies to the AAPCS (ARM Procedure Call Standard) and Thumb Procedure Call Standard (TPCS). I've archived the material for future reference in case this course website ever goes missing (which tends to happen often with universities).

Finally, the diff that I'm working from

Yes, I realize that it's pretty lame to cling to a single version of Android and not be constantly synchronizing with git and submitting code for review with gerrit, but I have no intentions of targetting anything aside from the FreeRunner / Neo1973 with my port, so I don't really want to deal with the build infrastructure right now. Ignore anything that starts with the less-compatible regular expression '^\- .*smull' (search by hitting '/') - I seem to have hastily deleted those routines in order to get my code to trivially compile before. Please, I don't recommend even trying to apply the diff as a patch - it will do nothing and may even inflict pain on some remote small kitten... and you wouldn't want that, would you? ... But seriously, the diff just highlights what code needs to be worked on. It actually has a lot of 'cruft', i.e. garbage, too, so just look for any lines matching '^\- ' that also contain one of the opcodes listed on the wiki.

Now from what I've been looking at in the code, there are 3 different options for optimizing the .S files for ARMv4T

1) using preprocessor macros for simple opcode translation
2) using globally visible AAPCS-compatible functions for emulating the v5TE instructions (this is where the UNSW tutorial has really come in handy). This is necessary for opcodes that are slightly more complicated, or ones with tricky addressing modes. The GNU preprocessor doesn't really have the capabilities to become a fully fledged scripting language unfortunately.
3) individual, call-by-call changes ... this is the ugly one that I don't really want to touch... but I'm guessing I will have to at some point.

Good luck with your porting efforts!



PS: I find black sabbath very useful for putting myself into the 'zone' for programming in ARM assembly.

1 comment:

spydon said...

Thank you for porting android to openmoko! This will be so awesome!