Android porting

From Openmoko

Revision as of 18:11, 26 January 2009 by Jernst (Talk | contribs)

Jump to: navigation, search


Contents

Android.png

Introduction

This page is dedicated to porting the Android OS to the Neo 1973 and Neo FreeRunner handsets. Since the Android OS was publically released on 20081021, work is currently underway to port Android to the Neo 1973 and FreeRunner handsets.

Goals

  1. Systematically introduce patches for ARMv4T in the Android codebase
  2. Provide Neo1973 and Neo FreeRunner hardware-dependent patches in the Android codebase, leveraging the work already done by the Openmoko developers, without forcing Android-specific changes upstream
  3. Provide a useable Android filesystem and kernel on the Distributions page that conform to current Openmoko installation routines

Early Attempts

Before the source code was released, kernel trap handlers were implemented to 'emulate' the ARMv5TE ISA. Although the results worked in many cases, trapping is costly and performance suffered as a result. Moreover, without explicitly knowing which conditions were set by various instructions, such as Thumb Mode execution, the result became non deterministic.

Current State

With the release of the Android source code, the Open Source community is no longer limited to dealing with a binary-only product. The Open Handset Alliance (OHA) has let their source code become their product for everyone enrich and benefit from. Currently, porting efforts are underway in many circles.

Patches should be submitted via the official Android channels.

To track the status of which parts of the Android source tree contain ARMv5 specific code, I've created a table of where it is contained, and the status of patches. It can be found at: http://spreadsheets.google.com/pub?key=pzDEXnU19gkeTjpD28t-7fw User:Bricode


Google has released their open source version of the Android phone software distribution. In order to use it on the Freerunner, a number of patches need to be applied and a compiler with armv4 java exception support needs to be used to compile the software.

Status

Most of the hardware on Freerunner seems to work on latest Android images, but not always perfectly.

If you want to see details of what is already usable, please have a look at: Android_usage

Compiler suite

Android is a little picky about the version of gcc compiler. It also requires some java exception support that isn't available for armv4 without a minor modification. The following tools are what I use to build Android:


Binutils 2.18

At one time I had some armv5t code that was compiled into Android which would cause the linker to generate these blx instructions which fail on armv4. I'm not sure if this is still necessary, but I still have the following change applied to binutils:

diff -urN binutils-2.18-orig/bfd/elf32-arm.c binutils-2.18/bfd/elf32-arm.c
--- binutils-2.18-orig/bfd/elf32-arm.c	2007-08-07 02:59:23.000000000 +0700
+++ binutils-2.18/bfd/elf32-arm.c	2008-03-15 11:30:17.000000000 +0700
@@ -3093,8 +3093,8 @@
 static void check_use_blx(struct elf32_arm_link_hash_table *globals)
 {
   if (bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC,
-				Tag_CPU_arch) > 2)
-    globals->use_blx = 1;
+				Tag_CPU_arch) >= TAG_CPU_ARCH_V5T)
+    globals->use_blx = 0;
 }
 
 bfd_boolean


configure --prefix={devel path}/android/cross --target=arm-eabi

gcc 4.2.4 with gcc41-java-arm4.patch

configure --prefix={devel path}/android/cross --target=arm-eabi --with-arch=armv4t --enable-shared --enable-threads --disable-nls --disable-libmudflap --enable-target-optspace --with-abi=aapcs --enable-multilib --disable-libssp --disable-libstdcxx --enable-languages=c,c++

java-6-sun

This is the standard Linux package available for most (all?) distributions.

Patches

Coming soon. I've posted a number of them on the devel mailing list so far. Eventually, I expect to provide everything necessary for people to build Android for themselves.


Building the Koolu Android Source

  1. Configure your machine with the prerequisites documented in the Setting up your machine section of Google's build instructions.
  2. Install repo and download the source, as documented at http://trac.koolu.org/.
  3. After the build finishes you can put together a root file system by editing and running Sean McNeil's scripts, which are attached to this message. The first script (cp_android_OS) is used to copy the newly built files into a staging area. The second one (mkjffs2) makes a jffs2 image from the staging area. Be sure to edit the paths in the two files to match your environment. Alternatively, you can use the script below
  4. The result of the previos step is a file, androidfs.jffs2, which may be flashed to your Freerunner.


If you don't have mkfs.jffs2 you need mtd-tools, in debian based distros like Ubuntu just do:
sudo apt-get install mtd-tools

Building a jffs2 image

You can use this script:

#!/bin/sh

currentdir=`pwd`

ANDROID_OUT=out
ANDROID_DEVICE=freerunner
EXPORT_ROOT=$currentdir/build_jffs2_tmp

Usage()
{
	echo "Usage: $0 release|debug jffs2filename"
}

BuildImage()
{

	if [ -d $1 ]
	then
		echo "[INFO] Copying from... $1"

		sudo rm -rf $EXPORT_ROOT
		mkdir $EXPORT_ROOT
		mkdir $EXPORT_ROOT/root

		# Copy the image...
		cd $1
		tar cf - root | (cd $EXPORT_ROOT; sudo tar xf -)
		tar cf - system | (cd $EXPORT_ROOT/root; sudo tar xf -)

		# Change owner and permissions...
		cd $EXPORT_ROOT
		sudo chown -R root:root root
		sudo chmod -R 777 root
		
		cd $currentdir

		# Make the JFFS2 file
		mkfs.jffs2 --pad=0x700000 -o $2 -e 0x20000 -n -d$EXPORT_ROOT/root/
		echo "[INFO] Image written to $2"
		
		sudo rm -rf $EXPORT_ROOT
	else
		echo "$1 does not exist!"
	fi
}

if [ $# != 2 ]
then
	Usage
else

	case $1 in
	    release)
		BuildImage $ANDROID_OUT/target/product/$ANDROID_DEVICE $2
		;;
	    debug)
		BuildImage $ANDROID_OUT/debug/target/product/$ANDROID_DEVICE $2
		;;
	    *)
		Usage
	esac
fi

Android Debug Bridge

To assist in debugging and to gain shell access to the phone with Android, you can use the instructions found here: Android_debug_bridge


Windows Connectivity

It is possible to get Windows to at least recognize the Android "Ethernet Gadget" and charge the FreeRunner using the Android USB Windows driver (http://dl.google.com/android/android_usb_windows.zip) by modifying the android_usb.inf file in that package before attempting to install the driver. The following modifications are required:

Add the following to the [Google.NTx86] section of the android_usb.inf file:

; Neo FreeRunner
%USB\VID_1457&PID_5117.DeviceDescRelease%=androidusb.Dev, USB\VID_1457&PID_5117
%USB\VID_1457&PID_5117&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_1457&PID_5117&MI_01

and add the following to the to the [Strings] section of the android_usb.inf file:

USB\VID_1457&PID_5117.DeviceDescRelease="Neo FreeRunner"
USB\VID_1457&PID_5117&MI_01.DeviceDescRelease="Neo FreeRunner Composite ADB Interface"

The Windows version of adb does not appear to recognize the connected device yet but at least the FreeRunner charges and the device driver indicates that "This device is working properly."

How to Help

You can start by following the instructions to download and build the Android source from scratch. Please see http://source.android.com/download and follow the instructions for your architecture.

Publicize Your Efforts

It's generally a good idea to make your efforts known via wiki systems, public mailing lists, forums, and publically open version control systems.

Always take credit for your work but please don't do it in the form of comments. Some code is already hard enough to read without comments polluting the text. The best thing to do is to create a patch and put a header with your information at the top. Collaboration systems such as git might already do this for you (??).

If you create something new and have the ability to designate the license for it, please consider license compatibility issues.

Porting Strategy

  • Analysis and leverage of the existing build system
    • buid/core/combo/arm-linux.mk
      • -D__ARCH_ARM_4__ -D__ARCH_ARM_4T__
      • -march=armv4t -mcpu=arm920t
    • fix various static references to 'armv5'
  • Isolating ARMv5TE ISA dependent code
    • e.g. grep -n -R -i "${armv5te_isa_pattern}" ~/android
  • Abstracting
    • ( C/C++ )
      • Use inlined functions / #ifdef statments to implement functions in a portable manner
      • For inlined assembler calls, it's acceptable for now to use generic C code instead, so long as later on we optimize it by hand.
    • ( ASM )
      • Proprocessor statements based on ISA / architecture, e.g. #ifdef __ARCH_ARM_5__ ... #endif #ifdef __ARCH_ARM_4__ ... #endif
      • It's highly suggested that preprocessor statements should not be nested (i.e. make them mutually exclusive)
      • Some people have suggested that we should not do #ifdef's based on ARCH or ISA, but rather based on an AndroidConfig.h which would define macros like PLD(...) #ifdef HAVE_ARM_PLD pld #else ... #endif .

For each ARMv5TE instruction, one could potentially

  • Implement the instruction using general registers instead of DSP calls (i.e. eabi / softfloat)
  • If that is a) nondeterministic, or b) slow, then sections of code need to be analyzed and hand-optimized for the ARMv4T isa

List of Unsupported Instructions

This is a list of opcodes, extracted from the Android source, that are unsupported for ARMv4T compliant processors (specifically the arm920t). The opcodes represent instructions available for ARMv5, ARMv5T, and ARMv5TE architectures, which are not present in the ARMv4T ISA. The list was obtained by exhaustively editing the recompiling the Android source code until it compiled without error.

Please keep in mind, that in some cases, translating these instructions into a sequence of ARMv4T instructions will be impossible and / or result in nondeterministic execution because of

  • the requirement of additional context
  • the tendencies of certain opcodes to change condition registers that may or may not be present in the arm920t core

Opcodes

Opcode Desription [PDF] Page Number C ASM
BLX(1) Branch, Link, and Exchange 166 N/A (Unused in Android) N/A (Unused in Android)
BLX(2) Branch, Link, and Exchange 168

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_BLX
... (inline asm) ...
#else
... (inline asm with equivalent blx code, as shown to the right) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_BLX
#define BLX(a) \
blx a
#else
#define BLX(a) \
mov pc,lr \
bx a
#endif
CLZ Count Leading Zeros 175

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_CLZ
... (inline asm) ...
#else
... (inline asm with equivalent clz code, as shown to the right) ...
#endif

User:Cfriedt 20081029

#ifdef HAVE_CLZ
#define CLZ(Rd,Rm) \
clz Rd,Rm
#else
#define CLZ(Rd,Rm) \
...
#endif
...
CLZ(Rd,Rm)
LDRD Load Registers Doubleword 200

User:Cfriedt 20081028 Substitute different inline assembly code with something like

#ifdef HAVE_LDRD
... (inline asm) ...
#else
... (inline asm with ldrd substituted) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_LDRD
#define LDRD(a,b) \
ldrd a,b
#else
#define LDRD(a,b) \
...
#endif
PLD Preload Data 240

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_PLD
... (inline asm) ...
#else
... (inline asm with pld removed) ...
#endif

User:Cfriedt 20081028 Remove or substitute with a macro reference such as

#ifdef HAVE_PLD
#define PLD(a,b) \
pld a,b
#else
#define PLD(a,b)
#endif
...
PLD(r0,#0)
SMLA<x><y> Signed Multiply-Accumulate 291
SMLAL<x><y> Signed Multiply Accumulate Long 298
SMLAW<y> Signed Multiply-Accumulate Word 302
SMUL<x><y> Signed Multiply 316
SMULW<y> Signed Multiply Word 320
QADD Saturating Add 242
QDADD Saturating Double and Add 249
QDSUB Saturating Double and Subtract 251
QSUB Saturating Subtract 253
STRD Store Registers Doubleword 349

User:Cfriedt 20081028 Substitute different inline assembly code with something like

#ifdef HAVE_STRD
... (inline asm) ...
#else
... (inline asm without strd) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_STRD
#define STRD(a,b) \
strd a,b
#else
#define STRD(a,b) \
...
#endif


Scanning for Files That Use the ARMv5TE ISA

Using the above list of opcodes, one can scan the Android source code for ARMv4T-incompatible instruction sequences.

Code:

#!/bin/sh

# $1 is the android directory

if [ $# -ne 1 ]; then
exit -1
fi

cd "${1}"

opcodes="blx clz ldrd pld smlabb smlabt smlatt
smlal smlawb smlawt smulbb smulbt smultt smulwb
smulwt qadd qdadd qdsub qsub strd"

for op in ${opcodes}; do

echo "* ${op} ====================================="

if [ ! -e .files.${op} ]; then

files="$(grep -R -i "${op} " * 2>/dev/null)"
files="$(echo $files | grep -v "^Binary file" | sed -e 's/:.*//')"
files="$(echo $files| grep -v "CREDIT\|README\|^\(kernel/\|.git/\)\|\(\.txt\)$" | sort -u)"

echo "${files}" > .files.${op}

else
files="$(cat .files.${op})"
fi

for fil in ${files}; do
lines="$(grep -n -i "${op} " ${fil} | sed -e 's/:.*//g' )"
lines="$(echo $lines | sed -e 's/ /,/g')"
echo "** ${fil}: lines {${lines}}"
done
done


Source Files in Android that Use the ARMv5TE ISA

The list of files below may or may not be complete. There might also be some assembly code that is generated with a python script (verification?).


  • blx =====================================
    • bionic/libc/tools/gensyscalls.py: lines {168,186}
    • bootloader/legacy/nandwrite/init.S: lines {77}
    • bootloader/legacy/usbloader/init.S: lines {95}
    • dalvik/vm/arch/arm/CallEABI.S: lines {239}
    • dalvik/vm/arch/arm/CallOldABI.S: lines {145}
    • development/emulator/qtools/thumbdis.cpp: lines {187,265}
    • external/qemu/target-arm/translate.c: lines {1151,1971,2444}
    • external/qemu/trace.c: lines {774,1353,1358}
    • system/core/libpixelflinger/codeflinger/disassem.c: lines {416}
  • clz =====================================
    • development/emulator/qtools/armdis.cpp: lines {654}
    • external/opencore/codecs_v2/audio/aac/dec/src/pv_normalize.h: lines {67,84}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h: lines {137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h: lines {78,95}
    • external/opencore/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.h: lines {67,84}
    • external/opencore/codecs_v2/video/avc_h264/dec/src/vlc.cpp: lines {23}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h: lines {125,162,168,204,218}
    • external/qemu/target-arm/translate.c: lines {1247}
    • external/skia/libcorecg/Sk64.cpp: lines {340,341,343}
    • external/skia/libcorecg/SkMatrix.cpp: lines {500,501}
    • external/skia/libsgl/effects/SkColorMatrixFilter.cpp: lines {135}
    • external/skia/libsgl/sgl/SkBitmap.cpp: lines {945,946,947}
    • external/skia/libsgl/sgl/SkBitmapShader.cpp: lines {32,33,34}
    • external/skia/libsgl/sgl/SkGraphics.cpp: lines {429,437}
  • ldrd =====================================
    • dalvik/vm/mterp/armv5/OP_AGET_WIDE.S: lines {28}
    • dalvik/vm/mterp/armv5/OP_IGET_WIDE.S: lines {37}
    • dalvik/vm/mterp/armv5/OP_IGET_WIDE_QUICK.S: lines {10}
    • dalvik/vm/mterp/armv5/OP_SGET_WIDE.S: lines {17}
    • dalvik/vm/mterp/out/InterpAsm-armv5.S: lines {2653,7464,8318,8390}
    • system/core/libpixelflinger/rotate90CW_4x4_16v6.S: lines {40,41,42,43}
  • pld =====================================
    • bionic/libc/arch-arm/bionic/memcmp.S: lines {37,44,45,56,57,107,108,195,196}
    • bionic/libc/arch-arm/bionic/memcmp16.S: lines {37,44,45,67,68,116,117,198,199}
    • bionic/libc/arch-arm/bionic/memcpy.S: lines {55,56,57,145,266,293,320}
    • bionic/libc/arch-arm/bionic/strlen.c: lines {59,65}
    • bionic/libc/kernel/arch-arm/asm/arch/irqs.h: lines {162}
    • external/elfutils/src/Makefile: lines {243}
    • external/elfutils/src/Makefile.am: lines {32}
    • external/elfutils/src/Makefile.in: lines {243}
    • external/jpeg/jidctfst.S: lines {69,235,247}
    • external/qemu/target-arm/translate.c: lines {1149}
    • system/core/libpixelflinger/codeflinger/ARMAssembler.cpp: lines {368}
    • system/core/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp: lines {104,108,117}
    • system/core/libpixelflinger/t32cb16blend.S: lines {111,112,134,143}
  • smlabb =====================================
    • external/jpeg/jidctfst.S: lines {110,115,155,156}
    • external/neven/Embedded/common/src/b_BasicEm/Math.c: lines {584,589}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {147,166}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {120,129}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {514,533}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {418,429}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {202}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {250}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/dct_inline.h: lines {119,155,167,278,326,341}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h: lines {178,225,437,517}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {405,436}
  • smlabt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {184}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {138}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/dct_inline.h: lines {131,143,294,310}
  • smlatt =====================================
    • external/neven/Embedded/common/src/b_BasicEm/Math.c: lines {585,590}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {157}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {441}
  • smlal =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v4.h: lines {179,223,236,257,267}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v4_gcc.h: lines {264,341}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {178,188,198}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_dct_9.s: lines {84,90,96,101,109,114,116,118,121,132,138,150,163,165,167,174,176,178}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_dct_9_gcc.s: lines {73,79,86,90,98,103,105,107,110,121,127,139,152,154,156,163,165,167}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18.asm: lines {143,162,178,188,192,199,207,217,225,231,237,241,244}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18.s: lines {145,164,180,190,194,201,209,219,227,233,239,243,246}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18_gcc.s: lines {143,162,178,188,192,199,207,217,225,231,237,241,244}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window.asm: lines {62,63,66,72,76,77,81,82,85,90,94,97,99,100,103,108,113,114,118,119,122,129,136,137,176,179,183,187,190,193}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window.s: lines {67,68,71,77,81,82,86,87,90,95,99,102,104,105,108,113,118,119,123,124,127,134,141,142,181,184,188,192,195,198}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window_gcc.s: lines {65,66,69,75,79,80,84,85,88,93,97,100,102,103,106,111,116,117,121,122,125,132,139,140,179,182,186,190,193,196}
    • external/opencore/codecs_v2/audio/mp3/dec/src/pv_mp3dec_fxd_op_arm.h: lines {148}
    • external/qemu/trace.c: lines {813}
    • frameworks/base/opengl/libagl/iterators.S: lines {66,67}
    • frameworks/base/opengl/libagl/matrix.h: lines {67,68,96,126,127,282,283,314,315,316}
  • smlawb =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {203,259}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {166,416}
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {93,109}
    • frameworks/base/opengl/libagl/matrix.h: lines {163,203}
  • smlawt =====================================
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {114}
    • frameworks/base/opengl/libagl/matrix.h: lines {162,202,243,244}
  • smulbb =====================================
    • external/jpeg/jidctfst.S: lines {109,114,151,153}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {79}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {71,81}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {207,251,297,348,361,375,427,440,487}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {199,234,274,314,316,326,367,369,404}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h: lines {121,137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h: lines {123,142}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h: lines {122,140}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h: lines {132,134,138,164,177,191}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h: lines {127,129,150,163}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h: lines {121,141}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {115,139,151,163,189,190,212}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {112,113,164,183,201,218,265}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h: lines {250,457,531}
    • external/skia/include/corecg/SkMath.h: lines {170}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {420,462}
    • system/core/libpixelflinger/t32cb16blend.S: lines {39,66,74,82}
  • smulbt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {115}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {109}
    • system/core/libpixelflinger/codeflinger/texturing.cpp: lines {1091}
    • system/core/libpixelflinger/t32cb16blend.S: lines {47,55}
  • smultt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {131}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {100}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {467}
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {73}
  • smulwb =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {221}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {373}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {222}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {283}
    • external/opencore/codecs_v2/audio/sbc/enc/src/sbcenc_filter.h: lines {33}
    • frameworks/base/opengl/libagl/matrix.h: lines {161,201,242}
  • smulwt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {202,240}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {385,415}
  • qadd =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {64}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {60}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {130,256}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {128,235}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h: lines {122,137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h: lines {123,145}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {71,102,152,176,192}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {91,115,148,202,234}
    • external/openssl/crypto/bn/bn_prime.c: lines {454,455}
  • qdadd =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/calc_sbr_synfilterbank.cpp: lines {116,162}
    • external/opencore/codecs_v2/audio/aac/dec/src/trans4m_freq_2_time_fxp.cpp: lines {472,494}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {212,356,370,385,435,449}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {200,315,321,331,368,371}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h: lines {122,142}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h: lines {133,136,140,172,186,201}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h: lines {128,131,158,172}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {116}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {184}
  • qdsub =====================================
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {302}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {275}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h: lines {124,147}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {140}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {165}
  • qsub =====================================
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {167}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {162}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h: lines {121,138}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {88,127}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {70,133}
  • strd =====================================
    • dalvik/vm/mterp/armv5/OP_APUT_WIDE.S: lines {31}
    • dalvik/vm/mterp/armv5/OP_IPUT_WIDE.S: lines {39}
    • dalvik/vm/mterp/armv5/OP_IPUT_WIDE_QUICK.S: lines {14}
    • dalvik/vm/mterp/armv5/OP_SPUT_WIDE.S: lines {21}
    • dalvik/vm/mterp/out/InterpAsm-armv5.S: lines {2834,7530,8331,8542}
    • dalvik/vm/oo/Object.h: lines {589}
    • external/opencore/fileformats/avi/parser/include/pv_avifile_streamlist.h: lines {179}
    • external/opencore/fileformats/avi/parser/src/pv_avifile_streamlist.cpp: lines {153}
    • system/core/libpixelflinger/rotate90CW_4x4_16v6.S: lines {47,52,56,60}


Discussion

The file system/core/libpixelflinger/codeflinger/ARMAssembler.cpp will need special attention. It's responsible for dynamic generation of DSP code.

User:Cfriedt 20081024 I'm not sure how feasible this is, given that the SMedia 3362 is heavily NDA'd. However, since the arm920t lacks a floating-point unit / DSP core, is it possible to use the SMedia chip for general-purpose math? This would help in the Android platform, at least, for things like audio and video codecs. Aside from an OpenGL ES driver, OpenMoko documentation for the SMedia would be highly appreciated.

Important Links

Documentation

Instruction Set References

Hardware Reference

Communities

Personal tools


Contents

Android.png

Introduction

This page is dedicated to porting the Android OS to the Neo 1973 and Neo FreeRunner handsets. Since the Android OS was publically released on 20081021, work is currently underway to port Android to the Neo 1973 and FreeRunner handsets.

Goals

  1. Systematically introduce patches for ARMv4T in the Android codebase
  2. Provide Neo1973 and Neo FreeRunner hardware-dependent patches in the Android codebase, leveraging the work already done by the Openmoko developers, without forcing Android-specific changes upstream
  3. Provide a useable Android filesystem and kernel on the Distributions page that conform to current Openmoko installation routines

Early Attempts

Before the source code was released, kernel trap handlers were implemented to 'emulate' the ARMv5TE ISA. Although the results worked in many cases, trapping is costly and performance suffered as a result. Moreover, without explicitly knowing which conditions were set by various instructions, such as Thumb Mode execution, the result became non deterministic.

Current State

With the release of the Android source code, the Open Source community is no longer limited to dealing with a binary-only product. The Open Handset Alliance (OHA) has let their source code become their product for everyone enrich and benefit from. Currently, porting efforts are underway in many circles.

Patches should be submitted via the official Android channels.

To track the status of which parts of the Android source tree contain ARMv5 specific code, I've created a table of where it is contained, and the status of patches. It can be found at: http://spreadsheets.google.com/pub?key=pzDEXnU19gkeTjpD28t-7fw User:Bricode


Google has released their open source version of the Android phone software distribution. In order to use it on the Freerunner, a number of patches need to be applied and a compiler with armv4 java exception support needs to be used to compile the software.

Status

Most of the hardware on Freerunner seems to work on latest Android images, but not always perfectly.

If you want to see details of what is already usable, please have a look at: Android_usage

Compiler suite

Android is a little picky about the version of gcc compiler. It also requires some java exception support that isn't available for armv4 without a minor modification. The following tools are what I use to build Android:


Binutils 2.18

At one time I had some armv5t code that was compiled into Android which would cause the linker to generate these blx instructions which fail on armv4. I'm not sure if this is still necessary, but I still have the following change applied to binutils:

diff -urN binutils-2.18-orig/bfd/elf32-arm.c binutils-2.18/bfd/elf32-arm.c
--- binutils-2.18-orig/bfd/elf32-arm.c	2007-08-07 02:59:23.000000000 +0700
+++ binutils-2.18/bfd/elf32-arm.c	2008-03-15 11:30:17.000000000 +0700
@@ -3093,8 +3093,8 @@
 static void check_use_blx(struct elf32_arm_link_hash_table *globals)
 {
   if (bfd_elf_get_obj_attr_int (globals->obfd, OBJ_ATTR_PROC,
-				Tag_CPU_arch) > 2)
-    globals->use_blx = 1;
+				Tag_CPU_arch) >= TAG_CPU_ARCH_V5T)
+    globals->use_blx = 0;
 }
 
 bfd_boolean


configure --prefix={devel path}/android/cross --target=arm-eabi

gcc 4.2.4 with gcc41-java-arm4.patch

configure --prefix={devel path}/android/cross --target=arm-eabi --with-arch=armv4t --enable-shared --enable-threads --disable-nls --disable-libmudflap --enable-target-optspace --with-abi=aapcs --enable-multilib --disable-libssp --disable-libstdcxx --enable-languages=c,c++

java-6-sun

This is the standard Linux package available for most (all?) distributions.

Patches

Coming soon. I've posted a number of them on the devel mailing list so far. Eventually, I expect to provide everything necessary for people to build Android for themselves.


Building the Koolu Android Source

  1. Configure your machine with the prerequisites documented in the Setting up your machine section of Google's build instructions.
  2. Install repo and download the source, as documented at http://trac.koolu.org/.
  3. After the build finishes you can put together a root file system by editing and running Sean McNeil's scripts, which are attached to this message. The first script (cp_android_OS) is used to copy the newly built files into a staging area. The second one (mkjffs2) makes a jffs2 image from the staging area. Be sure to edit the paths in the two files to match your environment. Alternatively, you can use the script below
  4. The result of the previos step is a file, androidfs.jffs2, which may be flashed to your Freerunner.


If you don't have mkfs.jffs2 you need mtd-tools, in debian based distros like Ubuntu just do:
sudo apt-get install mtd-tools

Building a jffs2 image

You can use this script:

#!/bin/sh

currentdir=`pwd`

ANDROID_OUT=out
ANDROID_DEVICE=freerunner
EXPORT_ROOT=$currentdir/build_jffs2_tmp

Usage()
{
	echo "Usage: $0 release|debug jffs2filename"
}

BuildImage()
{

	if [ -d $1 ]
	then
		echo "[INFO] Copying from... $1"

		sudo rm -rf $EXPORT_ROOT
		mkdir $EXPORT_ROOT
		mkdir $EXPORT_ROOT/root

		# Copy the image...
		cd $1
		tar cf - root | (cd $EXPORT_ROOT; sudo tar xf -)
		tar cf - system | (cd $EXPORT_ROOT/root; sudo tar xf -)

		# Change owner and permissions...
		cd $EXPORT_ROOT
		sudo chown -R root:root root
		sudo chmod -R 777 root
		
		cd $currentdir

		# Make the JFFS2 file
		mkfs.jffs2 --pad=0x700000 -o $2 -e 0x20000 -n -d$EXPORT_ROOT/root/
		echo "[INFO] Image written to $2"
		
		sudo rm -rf $EXPORT_ROOT
	else
		echo "$1 does not exist!"
	fi
}

if [ $# != 2 ]
then
	Usage
else

	case $1 in
	    release)
		BuildImage $ANDROID_OUT/target/product/$ANDROID_DEVICE $2
		;;
	    debug)
		BuildImage $ANDROID_OUT/debug/target/product/$ANDROID_DEVICE $2
		;;
	    *)
		Usage
	esac
fi

Android Debug Bridge

To assist in debugging and to gain shell access to the phone with Android, you can use the instructions found here: Android_debug_bridge


Windows Connectivity

It is possible to get Windows to at least recognize the Android "Ethernet Gadget" and charge the FreeRunner using the Android USB Windows driver (http://dl.google.com/android/android_usb_windows.zip) by modifying the android_usb.inf file in that package before attempting to install the driver. The following modifications are required:

Add the following to the [Google.NTx86] section of the android_usb.inf file:

; Neo FreeRunner
%USB\VID_1457&PID_5117.DeviceDescRelease%=androidusb.Dev, USB\VID_1457&PID_5117
%USB\VID_1457&PID_5117&MI_01.DeviceDescRelease%=androidusb.Dev, USB\VID_1457&PID_5117&MI_01

and add the following to the to the [Strings] section of the android_usb.inf file:

USB\VID_1457&PID_5117.DeviceDescRelease="Neo FreeRunner"
USB\VID_1457&PID_5117&MI_01.DeviceDescRelease="Neo FreeRunner Composite ADB Interface"

The Windows version of adb does not appear to recognize the connected device yet but at least the FreeRunner charges and the device driver indicates that "This device is working properly."

How to Help

You can start by following the instructions to download and build the Android source from scratch. Please see http://source.android.com/download and follow the instructions for your architecture.

Publicize Your Efforts

It's generally a good idea to make your efforts known via wiki systems, public mailing lists, forums, and publically open version control systems.

Always take credit for your work but please don't do it in the form of comments. Some code is already hard enough to read without comments polluting the text. The best thing to do is to create a patch and put a header with your information at the top. Collaboration systems such as git might already do this for you (??).

If you create something new and have the ability to designate the license for it, please consider license compatibility issues.

Porting Strategy

  • Analysis and leverage of the existing build system
    • buid/core/combo/arm-linux.mk
      • -D__ARCH_ARM_4__ -D__ARCH_ARM_4T__
      • -march=armv4t -mcpu=arm920t
    • fix various static references to 'armv5'
  • Isolating ARMv5TE ISA dependent code
    • e.g. grep -n -R -i "${armv5te_isa_pattern}" ~/android
  • Abstracting
    • ( C/C++ )
      • Use inlined functions / #ifdef statments to implement functions in a portable manner
      • For inlined assembler calls, it's acceptable for now to use generic C code instead, so long as later on we optimize it by hand.
    • ( ASM )
      • Proprocessor statements based on ISA / architecture, e.g. #ifdef __ARCH_ARM_5__ ... #endif #ifdef __ARCH_ARM_4__ ... #endif
      • It's highly suggested that preprocessor statements should not be nested (i.e. make them mutually exclusive)
      • Some people have suggested that we should not do #ifdef's based on ARCH or ISA, but rather based on an AndroidConfig.h which would define macros like PLD(...) #ifdef HAVE_ARM_PLD pld #else ... #endif .

For each ARMv5TE instruction, one could potentially

  • Implement the instruction using general registers instead of DSP calls (i.e. eabi / softfloat)
  • If that is a) nondeterministic, or b) slow, then sections of code need to be analyzed and hand-optimized for the ARMv4T isa

List of Unsupported Instructions

This is a list of opcodes, extracted from the Android source, that are unsupported for ARMv4T compliant processors (specifically the arm920t). The opcodes represent instructions available for ARMv5, ARMv5T, and ARMv5TE architectures, which are not present in the ARMv4T ISA. The list was obtained by exhaustively editing the recompiling the Android source code until it compiled without error.

Please keep in mind, that in some cases, translating these instructions into a sequence of ARMv4T instructions will be impossible and / or result in nondeterministic execution because of

  • the requirement of additional context
  • the tendencies of certain opcodes to change condition registers that may or may not be present in the arm920t core

Opcodes

Opcode Desription [PDF] Page Number C ASM
BLX(1) Branch, Link, and Exchange 166 N/A (Unused in Android) N/A (Unused in Android)
BLX(2) Branch, Link, and Exchange 168

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_BLX
... (inline asm) ...
#else
... (inline asm with equivalent blx code, as shown to the right) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_BLX
#define BLX(a) \
blx a
#else
#define BLX(a) \
mov pc,lr \
bx a
#endif
CLZ Count Leading Zeros 175

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_CLZ
... (inline asm) ...
#else
... (inline asm with equivalent clz code, as shown to the right) ...
#endif

User:Cfriedt 20081029

#ifdef HAVE_CLZ
#define CLZ(Rd,Rm) \
clz Rd,Rm
#else
#define CLZ(Rd,Rm) \
...
#endif
...
CLZ(Rd,Rm)
LDRD Load Registers Doubleword 200

User:Cfriedt 20081028 Substitute different inline assembly code with something like

#ifdef HAVE_LDRD
... (inline asm) ...
#else
... (inline asm with ldrd substituted) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_LDRD
#define LDRD(a,b) \
ldrd a,b
#else
#define LDRD(a,b) \
...
#endif
PLD Preload Data 240

User:Cfriedt 20081028 Remove from inline assembly with something like

#ifdef HAVE_PLD
... (inline asm) ...
#else
... (inline asm with pld removed) ...
#endif

User:Cfriedt 20081028 Remove or substitute with a macro reference such as

#ifdef HAVE_PLD
#define PLD(a,b) \
pld a,b
#else
#define PLD(a,b)
#endif
...
PLD(r0,#0)
SMLA<x><y> Signed Multiply-Accumulate 291
SMLAL<x><y> Signed Multiply Accumulate Long 298
SMLAW<y> Signed Multiply-Accumulate Word 302
SMUL<x><y> Signed Multiply 316
SMULW<y> Signed Multiply Word 320
QADD Saturating Add 242
QDADD Saturating Double and Add 249
QDSUB Saturating Double and Subtract 251
QSUB Saturating Subtract 253
STRD Store Registers Doubleword 349

User:Cfriedt 20081028 Substitute different inline assembly code with something like

#ifdef HAVE_STRD
... (inline asm) ...
#else
... (inline asm without strd) ...
#endif

User:Cfriedt 20081028 Substitute with a macro reference such as

#ifdef HAVE_STRD
#define STRD(a,b) \
strd a,b
#else
#define STRD(a,b) \
...
#endif


Scanning for Files That Use the ARMv5TE ISA

Using the above list of opcodes, one can scan the Android source code for ARMv4T-incompatible instruction sequences.

Code:

#!/bin/sh

# $1 is the android directory

if [ $# -ne 1 ]; then
exit -1
fi

cd "${1}"

opcodes="blx clz ldrd pld smlabb smlabt smlatt
smlal smlawb smlawt smulbb smulbt smultt smulwb
smulwt qadd qdadd qdsub qsub strd"

for op in ${opcodes}; do

echo "* ${op} ====================================="

if [ ! -e .files.${op} ]; then

files="$(grep -R -i "${op} " * 2>/dev/null)"
files="$(echo $files | grep -v "^Binary file" | sed -e 's/:.*//')"
files="$(echo $files| grep -v "CREDIT\|README\|^\(kernel/\|.git/\)\|\(\.txt\)$" | sort -u)"

echo "${files}" > .files.${op}

else
files="$(cat .files.${op})"
fi

for fil in ${files}; do
lines="$(grep -n -i "${op} " ${fil} | sed -e 's/:.*//g' )"
lines="$(echo $lines | sed -e 's/ /,/g')"
echo "** ${fil}: lines {${lines}}"
done
done


Source Files in Android that Use the ARMv5TE ISA

The list of files below may or may not be complete. There might also be some assembly code that is generated with a python script (verification?).


  • blx =====================================
    • bionic/libc/tools/gensyscalls.py: lines {168,186}
    • bootloader/legacy/nandwrite/init.S: lines {77}
    • bootloader/legacy/usbloader/init.S: lines {95}
    • dalvik/vm/arch/arm/CallEABI.S: lines {239}
    • dalvik/vm/arch/arm/CallOldABI.S: lines {145}
    • development/emulator/qtools/thumbdis.cpp: lines {187,265}
    • external/qemu/target-arm/translate.c: lines {1151,1971,2444}
    • external/qemu/trace.c: lines {774,1353,1358}
    • system/core/libpixelflinger/codeflinger/disassem.c: lines {416}
  • clz =====================================
    • development/emulator/qtools/armdis.cpp: lines {654}
    • external/opencore/codecs_v2/audio/aac/dec/src/pv_normalize.h: lines {67,84}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/norm_l.h: lines {137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/normalize_amr_wb.h: lines {78,95}
    • external/opencore/codecs_v2/audio/mp3/dec/src/pvmp3_normalize.h: lines {67,84}
    • external/opencore/codecs_v2/video/avc_h264/dec/src/vlc.cpp: lines {23}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/vlc_encode_inline.h: lines {125,162,168,204,218}
    • external/qemu/target-arm/translate.c: lines {1247}
    • external/skia/libcorecg/Sk64.cpp: lines {340,341,343}
    • external/skia/libcorecg/SkMatrix.cpp: lines {500,501}
    • external/skia/libsgl/effects/SkColorMatrixFilter.cpp: lines {135}
    • external/skia/libsgl/sgl/SkBitmap.cpp: lines {945,946,947}
    • external/skia/libsgl/sgl/SkBitmapShader.cpp: lines {32,33,34}
    • external/skia/libsgl/sgl/SkGraphics.cpp: lines {429,437}
  • ldrd =====================================
    • dalvik/vm/mterp/armv5/OP_AGET_WIDE.S: lines {28}
    • dalvik/vm/mterp/armv5/OP_IGET_WIDE.S: lines {37}
    • dalvik/vm/mterp/armv5/OP_IGET_WIDE_QUICK.S: lines {10}
    • dalvik/vm/mterp/armv5/OP_SGET_WIDE.S: lines {17}
    • dalvik/vm/mterp/out/InterpAsm-armv5.S: lines {2653,7464,8318,8390}
    • system/core/libpixelflinger/rotate90CW_4x4_16v6.S: lines {40,41,42,43}
  • pld =====================================
    • bionic/libc/arch-arm/bionic/memcmp.S: lines {37,44,45,56,57,107,108,195,196}
    • bionic/libc/arch-arm/bionic/memcmp16.S: lines {37,44,45,67,68,116,117,198,199}
    • bionic/libc/arch-arm/bionic/memcpy.S: lines {55,56,57,145,266,293,320}
    • bionic/libc/arch-arm/bionic/strlen.c: lines {59,65}
    • bionic/libc/kernel/arch-arm/asm/arch/irqs.h: lines {162}
    • external/elfutils/src/Makefile: lines {243}
    • external/elfutils/src/Makefile.am: lines {32}
    • external/elfutils/src/Makefile.in: lines {243}
    • external/jpeg/jidctfst.S: lines {69,235,247}
    • external/qemu/target-arm/translate.c: lines {1149}
    • system/core/libpixelflinger/codeflinger/ARMAssembler.cpp: lines {368}
    • system/core/libpixelflinger/codeflinger/ARMAssemblerInterface.cpp: lines {104,108,117}
    • system/core/libpixelflinger/t32cb16blend.S: lines {111,112,134,143}
  • smlabb =====================================
    • external/jpeg/jidctfst.S: lines {110,115,155,156}
    • external/neven/Embedded/common/src/b_BasicEm/Math.c: lines {584,589}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {147,166}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {120,129}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {514,533}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {418,429}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {202}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {250}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/dct_inline.h: lines {119,155,167,278,326,341}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h: lines {178,225,437,517}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {405,436}
  • smlabt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {184}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {138}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/dct_inline.h: lines {131,143,294,310}
  • smlatt =====================================
    • external/neven/Embedded/common/src/b_BasicEm/Math.c: lines {585,590}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {157}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {441}
  • smlal =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v4.h: lines {179,223,236,257,267}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v4_gcc.h: lines {264,341}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {178,188,198}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_dct_9.s: lines {84,90,96,101,109,114,116,118,121,132,138,150,163,165,167,174,176,178}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_dct_9_gcc.s: lines {73,79,86,90,98,103,105,107,110,121,127,139,152,154,156,163,165,167}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18.asm: lines {143,162,178,188,192,199,207,217,225,231,237,241,244}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18.s: lines {145,164,180,190,194,201,209,219,227,233,239,243,246}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_mdct_18_gcc.s: lines {143,162,178,188,192,199,207,217,225,231,237,241,244}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window.asm: lines {62,63,66,72,76,77,81,82,85,90,94,97,99,100,103,108,113,114,118,119,122,129,136,137,176,179,183,187,190,193}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window.s: lines {67,68,71,77,81,82,86,87,90,95,99,102,104,105,108,113,118,119,123,124,127,134,141,142,181,184,188,192,195,198}
    • external/opencore/codecs_v2/audio/mp3/dec/src/asm/pvmp3_polyphase_filter_window_gcc.s: lines {65,66,69,75,79,80,84,85,88,93,97,100,102,103,106,111,116,117,121,122,125,132,139,140,179,182,186,190,193,196}
    • external/opencore/codecs_v2/audio/mp3/dec/src/pv_mp3dec_fxd_op_arm.h: lines {148}
    • external/qemu/trace.c: lines {813}
    • frameworks/base/opengl/libagl/iterators.S: lines {66,67}
    • frameworks/base/opengl/libagl/matrix.h: lines {67,68,96,126,127,282,283,314,315,316}
  • smlawb =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {203,259}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {166,416}
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {93,109}
    • frameworks/base/opengl/libagl/matrix.h: lines {163,203}
  • smlawt =====================================
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {114}
    • frameworks/base/opengl/libagl/matrix.h: lines {162,202,243,244}
  • smulbb =====================================
    • external/jpeg/jidctfst.S: lines {109,114,151,153}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {79}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {71,81}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {207,251,297,348,361,375,427,440,487}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {199,234,274,314,316,326,367,369,404}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h: lines {121,137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h: lines {123,142}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h: lines {122,140}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h: lines {132,134,138,164,177,191}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h: lines {127,129,150,163}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mult.h: lines {121,141}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {115,139,151,163,189,190,212}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {112,113,164,183,201,218,265}
    • external/opencore/codecs_v2/video/m4v_h263/enc/src/fastquant_inline.h: lines {250,457,531}
    • external/skia/include/corecg/SkMath.h: lines {170}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {420,462}
    • system/core/libpixelflinger/t32cb16blend.S: lines {39,66,74,82}
  • smulbt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {115}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {109}
    • system/core/libpixelflinger/codeflinger/texturing.cpp: lines {1091}
    • system/core/libpixelflinger/t32cb16blend.S: lines {47,55}
  • smultt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {131}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {100}
    • frameworks/base/libs/audioflinger/AudioMixer.cpp: lines {467}
    • frameworks/base/libs/audioflinger/AudioResamplerSinc.cpp: lines {73}
  • smulwb =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {221}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {373}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {222}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {283}
    • external/opencore/codecs_v2/audio/sbc/enc/src/sbcenc_filter.h: lines {33}
    • frameworks/base/opengl/libagl/matrix.h: lines {161,201,242}
  • smulwt =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {202,240}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {385,415}
  • qadd =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_gcc.h: lines {64}
    • external/opencore/codecs_v2/audio/aac/dec/src/fxp_mul32_arm_v5.h: lines {60}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {130,256}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {128,235}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_add.h: lines {122,137}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mult.h: lines {123,145}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {71,102,152,176,192}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {91,115,148,202,234}
    • external/openssl/crypto/bn/bn_prime.c: lines {454,455}
  • qdadd =====================================
    • external/opencore/codecs_v2/audio/aac/dec/src/calc_sbr_synfilterbank.cpp: lines {116,162}
    • external/opencore/codecs_v2/audio/aac/dec/src/trans4m_freq_2_time_fxp.cpp: lines {472,494}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {212,356,370,385,435,449}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {200,315,321,331,368,371}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_mac.h: lines {122,142}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32.h: lines {133,136,140,172,186,201}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/mpy_32_16.h: lines {128,131,158,172}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {116}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {184}
  • qdsub =====================================
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {302}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {275}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_msu.h: lines {124,147}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {140}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {165}
  • qsub =====================================
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_gcc_v5.h: lines {167}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/basic_op_arm_v5.h: lines {162}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/include/l_sub.h: lines {121,138}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_armv5.h: lines {88,127}
    • external/opencore/codecs_v2/audio/gsm_amr/amr_wb/dec/src/pvamrwbdecoder_basic_op_gcc_armv5.h: lines {70,133}
  • strd =====================================
    • dalvik/vm/mterp/armv5/OP_APUT_WIDE.S: lines {31}
    • dalvik/vm/mterp/armv5/OP_IPUT_WIDE.S: lines {39}
    • dalvik/vm/mterp/armv5/OP_IPUT_WIDE_QUICK.S: lines {14}
    • dalvik/vm/mterp/armv5/OP_SPUT_WIDE.S: lines {21}
    • dalvik/vm/mterp/out/InterpAsm-armv5.S: lines {2834,7530,8331,8542}
    • dalvik/vm/oo/Object.h: lines {589}
    • external/opencore/fileformats/avi/parser/include/pv_avifile_streamlist.h: lines {179}
    • external/opencore/fileformats/avi/parser/src/pv_avifile_streamlist.cpp: lines {153}
    • system/core/libpixelflinger/rotate90CW_4x4_16v6.S: lines {47,52,56,60}


Discussion

The file system/core/libpixelflinger/codeflinger/ARMAssembler.cpp will need special attention. It's responsible for dynamic generation of DSP code.

User:Cfriedt 20081024 I'm not sure how feasible this is, given that the SMedia 3362 is heavily NDA'd. However, since the arm920t lacks a floating-point unit / DSP core, is it possible to use the SMedia chip for general-purpose math? This would help in the Android platform, at least, for things like audio and video codecs. Aside from an OpenGL ES driver, OpenMoko documentation for the SMedia would be highly appreciated.

Important Links

Documentation

Instruction Set References

Hardware Reference

Communities