Skip to content

Repository files navigation

ARM Lab

Write, assemble, link, and really run ARM assembly directly on your Android phone — then step through it in a built-in debugger.

⚠️ Not available on Google Play — sideload only. To genuinely execute code it compiles, ARM Lab must target an older Android API level (28). Google Play requires a newer target, so ARM Lab is distributed as a standalone APK you install yourself. (This is the same technical reason Termux is not updated on Play.)

Features

  • Real on-device execution. Your assembly is assembled with as, linked statically with ld, and run as a real Linux process on the phone's CPU — not an emulator.
  • Two architecture modes
    • arm64 (AArch64) — works on virtually every modern phone.
    • arm32 (ARMv7) — for older devices. Note: many phones from ~2023 onward are 64-bit-only and physically cannot run 32-bit code; on those, arm32 mode reports a clear "unsupported on this CPU" message.
  • Two ways to write code
    • Text editor — type assembly directly.
    • Visual blocks — drag instruction blocks and plug register/immediate/label operands into their slots; the blocks generate assembly for you.
  • Debugger — single-step, breakpoints, and live views of registers, flags, and memory.

Requirements

  • Android 7.0 (API 24) or newer.
  • For arm32 mode: a device whose CPU still supports 32-bit (AArch32) execution.
  • Installation from outside the Play Store ("install unknown apps") enabled for whichever installer you use.

Install (sideload)

  1. Download the APK (or build it — see below).
  2. Allow installs from your browser / file manager in Settings → Apps → Special access → Install unknown apps.
  3. Open the APK and install.

Build from source

git clone <this-repo>
cd android-asm-app
./gradlew installDebug      # builds and installs to a connected device/emulator

You'll need Android Studio (or the Android SDK + NDK) and a device or emulator. See CLAUDE.md and PLAN.md for architecture and constraints.

How it works (short version)

Android 10+ forbids apps from executing binaries in their own writable storage unless the app targets API ≤ 28. ARM Lab targets 28 to keep that ability. The bundled as/ld ship as native libraries (so they're installed with execute permission), and your compiled program is linked statically and run from the app's private files directory.

Testing on a device over ADB

A device or emulator is required to actually run/debug assembly. These are the adb commands used to drive and inspect the app during development. Set a shortcut first:

ADB=/path/to/android-sdk/platform-tools/adb   # e.g. .../platform-tools/adb

Wake the screen and dismiss the lockscreen (a dozing device screencaps black):

$ADB shell input keyevent 26        # power button — toggles the display on
$ADB shell wm dismiss-keyguard      # get past the lockscreen
$ADB shell dumpsys power | grep -E 'mWakefulness|Display Power'   # confirm Awake/ON

Launch / restart the app:

$ADB shell am start -n com.rockmary.armlab/.MainActivity
$ADB shell am force-stop com.rockmary.armlab    # kill it first for a clean start

Emulate touches (tap coordinates are x y in pixels):

$ADB shell input tap 436 711        # tap the "Debug" button, for example
$ADB shell input swipe 100 800 100 400   # scroll/swipe
$ADB shell input keyevent KEYCODE_BACK

⚠️ MIUI (the Redmi Note 8T) blocks input tap into the app with an INJECT_EVENTS SecurityException, so the UI can't be driven remotely there — tap by hand and verify via logcat. The Zebra TC51 (Android 8.1) does allow injected taps, so it's the better device for scripted UI testing.

Screenshot the current screen:

$ADB exec-out screencap -p > /tmp/shot.png   # first capture is sometimes black; retry

Watch the logs:

$ADB logcat -c                                   # clear, then reproduce
$ADB logcat -d -s armlab-dbg:*                   # debugger logs (pid, stops, pc)
$ADB logcat -d | grep -iE 'avc:|armlab'          # SELinux + app lines
$ADB logcat -d | grep -i 'avc: denied'           # exec-path regressions (should be empty)

Inspect the app sandbox / check for stray processes:

$ADB shell run-as com.rockmary.armlab ls -l files/work/arm64
$ADB shell ps -A | grep -E 'files/work|/prog'    # orphaned tracees (should be none)

Licensing / attribution

ARM Lab bundles the GNU Binutils assembler (as) and linker (ld), which are licensed under the GNU GPL v3. In accordance with the GPL, the corresponding source for the bundled binaries is available on request / at the upstream project. The rest of ARM Lab is licensed under (TBD).

About

Attempt of app to allow writing ARM assembly in Android devices

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages