flat assembler
Message board for the users of flat assembler.
Index
> Non-x86 architectures > hello world using fasm (arm) for android |
Author |
|
sleepsleep 09 May 2014, 06:47
if there are a guide on, how to do hello world using fasm (arm) for android, maybe kinda cool,
|
|||
09 May 2014, 06:47 |
|
revolution 31 May 2014, 08:07
To make the code a bit more flexible you can do this:
Code: ;... adr r1,hello ;... |
|||
31 May 2014, 08:07 |
|
typedef 31 May 2014, 08:24
Oh. Lol, after banging my head I thought you'd moved it here.
And yup, mov r1, hello ldr r1, [hello] adr r1, hello |
|||
31 May 2014, 08:24 |
|
revolution 31 May 2014, 08:26
ldr won't do it for you unless you put a pointer there.
|
|||
31 May 2014, 08:26 |
|
revolution 31 May 2014, 11:38
Note that the reason I suggest using adr instead of mov is because by default fasmarm will use all available instructions from all architecture versions. So the mov will use the v7/T2 wide encoding to create "movw r1,0x8074". Whereas using adr will encode "add r1,r15,0x14" which is relocatable.
BTW: It is also advisable to use the processor and coprocessor directives to tell fasmarm which instructions are available. Without these you may get unavailable encodings for your particular CPU. |
|||
31 May 2014, 11:38 |
|
sleepsleep 31 May 2014, 17:21
ok, this is cool, and i wanna say thank you first to typedef.
|
|||
31 May 2014, 17:21 |
|
Picnic 01 Feb 2015, 11:54
Hi all,
I have tested typedef's example using fasmarm and adb.exe as suggested above (day 1 in arm). Then i try a string copy, but the code outputs nothing. Code: format ELF executable entry start segment readable executable start: mov r1, src mov r0, dest strcopy: ldrb r2, [r1], 1 strb r2, [r0], 1 tst r2, r2 bne strcopy mov r0, 1 mov r1, dest mov r2, 5 mov r7, 4 ; write syscall svc 0 mov r0, 0 ; exit mov r7, 1 svc 0 src db "12345",0 dest db "00000",0 |
|||
01 Feb 2015, 11:54 |
|
Picnic 01 Feb 2015, 19:22
I would really appreciate a hint.
|
|||
01 Feb 2015, 19:22 |
|
revolution 02 Feb 2015, 00:45
Which system are you using? Perhaps "svc 0", or the parameters you are passing, or the file format, is the problem because the copy code appears to be fine. Also the the note above about using "adr" instead of "mov" to get your code relocatable. And use the "processor" directive to avoid any silliness with incompatible CPUs.
|
|||
02 Feb 2015, 00:45 |
|
Picnic 02 Feb 2015, 20:09
Hi revolution,
I have windows xp connected with my android phone (CPU:ARM Cortex A7, GPU:ARM Mali-400 MP1) via usb cable. typedef's code along with few other tiny scripts i wrote are working, but the code above outputs "Segmentation fault" at my phone's terminal window. How to workaround this? |
|||
02 Feb 2015, 20:09 |
|
revolution 03 Feb 2015, 01:07
Did you try with ADR? Did you use the proper PROCESSOR setting?
|
|||
03 Feb 2015, 01:07 |
|
Picnic 03 Feb 2015, 07:19
I used adr but the error remains. What can be the correct settings in my case, can you show me a processor setting example ?
I noticed that whenever i use strb i am getting a "Segmentation fault". p.s. I appreciate the assistance. |
|||
03 Feb 2015, 07:19 |
|
revolution 03 Feb 2015, 07:24
Perhaps the Android system enforces the read only attribute you used?
Code: segment readable executable |
|||
03 Feb 2015, 07:24 |
|
Picnic 03 Feb 2015, 17:04
Golden reply, thank you.
I struggled enough and lost my temper for a while. |
|||
03 Feb 2015, 17:04 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.