flat assembler
Message board for the users of flat assembler.
Index
> Non-x86 architectures > How to start in ARM assembly? |
Author |
|
system error 25 Dec 2016, 18:28
Ok like for example I want to print a "hello world" to screen. Whose screen because my screen resolution is 1600 x something wide. That screen or emulated screen or real android phones screen?
|
|||
25 Dec 2016, 18:28 |
|
revolution 25 Dec 2016, 18:29
system error wrote: 1. What hardware do I need? system error wrote: 2. Do I need specialized SDK similar to Win Phone/CE SDK? system error wrote: 3. I read that there are too many ARM 'families' out there. Which one should I start with If I were to take the 64-bit path? |
|||
25 Dec 2016, 18:29 |
|
system error 25 Dec 2016, 18:35
And my PC don't have touch screen either. If I were to run my code in an emulator, don't I need a touch device for that?
This is important because I'm considering to sell my laptop for some android smartphone. But before I do that, I need to test it first, at least in emulated environment. I am not rich you know. |
|||
25 Dec 2016, 18:35 |
|
system error 25 Dec 2016, 18:42
revo, I'm having trouble understanding your explanations, or may be I am too clueless to get it. To cut it short,
What do you personally use to code ARM? What is your recommendations for a clueless low-budget peasant like me? |
|||
25 Dec 2016, 18:42 |
|
system error 25 Dec 2016, 18:52
I read things on the internet, but still don't get the bigger picture though.
|
|||
25 Dec 2016, 18:52 |
|
revolution 25 Dec 2016, 18:53
system error wrote: What do you personally use to code ARM? system error wrote: What is your recommendations for a clueless low-budget peasant like me? |
|||
25 Dec 2016, 18:53 |
|
system error 25 Dec 2016, 18:56
But how do you test your source without the CPU?
|
|||
25 Dec 2016, 18:56 |
|
sleepsleep 25 Dec 2016, 19:40
system error wrote: 1. What hardware do I need? Can I run it on my PC? Do I need an emulator like QEMU because I don't have Android Phones. My current phone is smart enough to have a small flashlight led attached to it. Useful though. you could use qemu, https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Virtual_ARM_Linux_environment for a start i would suggest using router with USB, flash with openwrt or etc firmware, they are less expensive and available in every pc shop or reuse old tp-link is fine too, try tp-link brand, they are the cheapest afaik, or you could buy raspberry pi 3 and load it with windows 10 iot or linux arm, could explore both experiences https://developer.microsoft.com/en-us/windows/iot/docs/kitsetuprpi |
|||
25 Dec 2016, 19:40 |
|
system error 25 Dec 2016, 20:02
Setting up Qemu on Linux now... Thanks for the links. Now it's starting to make sense.
|
|||
25 Dec 2016, 20:02 |
|
MatQuasar 01 Mar 2024, 13:10
Sorry for hijacking this thread instead of starting a new topic.
This is my "Hello, world" Linux program in both ARM 32-bit and x86: Code: ARM (32-bit) x86 (32-bit) mov r0, #1 <----> mov ebx, 1 ldr r1, =message <----> mov ecx, message ldr r2, =len <----> mov edx, len mov r7, #4 <----> mov eax, 4 swi 0 <----> int 0x80 mov r7, #1 <----> mov eax, 1 swi 0 <----> int 0x80 I understand that ARM is a load / store architecture, hence the needs of LDR. |
|||
01 Mar 2024, 13:10 |
|
revolution 01 Mar 2024, 15:19
"len" is a constant.
Code: mov r2,len |
|||
01 Mar 2024, 15:19 |
|
bzt 12 May 2024, 22:33
system error wrote: 1. What hardware do I need? Can I run it on my PC? Do I need an emulator like QEMU because I don't have Android Phones. Also works with qemu on your PC, see qemu-system-aarch64 -M raspi3b system error wrote: 2. Do I need specialized SDK similar to Win Phone/CE SDK? system error wrote: 3. I read that there are too many ARM 'families' out there. Which one should I start with If I were to take the 64-bit path? Here's a good tutorial, with lots of details, and easy to follow step-by-step explanations: https://github.com/bztsrc/raspi3-tutorial (also includes Makefiles to run the results in qemu). For FASMARM examples specifically, take a look at https://github.com/PeterLemon/RaspberryPi (not much explanation, just Assembly code. The kernel7.asm is for ARMv7 (32-bit), and kernel8.asm is for ARMv8 (64-bit)). Although keep in mind, that a simple "Hello world" is quite complicated and platform specific, it's not as easy as on x86 where you just write the characters and color codes at B8000h. What you'll need to do: 1. get the framebuffer address, pitch, packed pixel format (platform specific, on RPi you have to construct a MailBox message to the VideoCore GPU) 2. load somehow a bitmap font 3. render the glyphs yourself pixel by pixel to the framebuffer As an example, take a look here (although C, but easy to follow, uses Linux's console font) or here (Assembly only, not much comments about the "why", just "how", but still good resource). Because this is so complex, I suggest to program the UART instead first, and send characters to the serial line, that's several magnitude easier. If you add -serial stdio flag to qemu, then you'll see the the characters on the same terminal window that you have used to start qemu. But if you're just interested in ARM Assembly, and not low-level ARM Assembly programming, then probably all you need is RaspiOS, and a FASMARM compatible source with format ELF64, and use the svc instruction to invoke Linux system calls. Downside that this probably won't work on qemu, or it's going to be painfully laggy at least. Hope this helps, bzt |
|||
12 May 2024, 22:33 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.