flat assembler
Message board for the users of flat assembler.

Index > Non-x86 architectures > Building and running Android armv7 sample

Author
Thread Post new topic Reply to topic
MazeGen



Joined: 06 Oct 2003
Posts: 959
Location: Czechoslovakia
MazeGen
You need any Android device or emulator such as Bluestacks to run the sample (yes, Android x86 devices and emulators can run arm code).

You also need Android SDK because of Android Debug Bridge adb.exe, or you can copy the file to the device manually and run it in Terminal Emulator.

You don't need to root the device/emulator.

sample.asm:
Code:
format ELF executable
entry start

STDOUT      equ 1
SYS_EXIT    equ 1
SYS_WRITE   equ 4

segment readable executable

start:
 mov r0, STDOUT
 add r1, pc, msg-$-8
 mov r2, msg_len
 mov r7, SYS_WRITE
 swi 0

 mov r0, 0
 mov r7, SYS_EXIT
 swi 0

msg DB "hellow from android", 13, 10
msg_len=$-msg
    

Build:

fasmarm.exe sample.asm sample.out

Copy to device (/data/local/tmp/ is usually available on all devices and emulators):

adb.exe push sample.out /data/local/tmp/

Set read and executable rights for all users:

adb.exe shell chmod 555 /data/local/tmp/sample.out

Run it:

adb.exe shell /data/local/tmp/sample.out
Post 04 Jan 2020, 10:49
View user's profile Send private message Visit poster's website Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8711
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
is that possible to build one just to restart/reboot phone?

sort of utility,
Post 04 Jan 2020, 11:11
View user's profile Send private message Reply with quote
MazeGen



Joined: 06 Oct 2003
Posts: 959
Location: Czechoslovakia
MazeGen
You can try the reboot syscall (0x58) but I'm note sure if the default Android user has sufficient priviledges.
Post 04 Jan 2020, 12:16
View user's profile Send private message Visit poster's website Reply with quote
sleepsleep



Joined: 05 Oct 2006
Posts: 8711
Location: ˛                             ⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣⁣Posts: 334455
sleepsleep
or simulate a power button click?
Post 04 Jan 2020, 14:13
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.