flat assembler
Message board for the users of flat assembler.
Index
> Non-x86 architectures > raspberry pi, arduino |
Author |
|
edfed 25 Oct 2018, 10:47
hello, i am trying to use assembly langage on rpi and arduino compatible boards (arm, avr, esp, stm) in order to understand their architectures.
it is very powerfull to use assembly langage to get the deep understanding of an architecture. then, i plan to do some stuff inside them, using fasm/fasmg of course. and as i not really active here these times, i have two choices: asking everybody. searching in the exponential number of topics and search results. and then, create the topic that will reference every pertinent ressources about this subject. cause i like a lot to create things. [fasmarm] rpi lower16 upper16 Raspberry Pi [AVR] fasmg assembles with error(s) |
|||
25 Oct 2018, 10:47 |
|
revolution 25 Oct 2018, 22:13
Hi edfed.
What are you planning? |
|||
25 Oct 2018, 22:13 |
|
revolution 30 Oct 2018, 19:07
There is a good chance you can get help with the rPi code on this board.
|
|||
30 Oct 2018, 19:07 |
|
edfed 17 Nov 2018, 13:24
hurrah, i got the rasp working using ssh on my pc.
a friend installed it for me, and i got a cpp project running, with code edition with netbeans on the pc let say, to display one pixel, i have approximatelly 4G raspbian on the SD, and 1.5G of tools on the PC... here, assembler takes all it's sense. it is very ugly, the rasp is using raspbian jessie distro on a 4G SD, and i don't have many more room for files cause linux... is linux, very frustrating when it comes to play with access rights, paths, and so on.... the startup is very slow, i get a 1 minute console scrolling, very annoying. and linux file system is really not my taste. now thenext goal is to get the minimal set of files on the sd to fit my needs, and after, run some fasmarm code. see you in 2034 then |
|||
17 Nov 2018, 13:24 |
|
bzt 17 Nov 2018, 14:53
Hi,
I've never used fasm with arduino, but I can help with Raspberry Pi. You create a raw AArch64 binary (not ELF) and save it on the first (fat) partition on the SD card as "kernel8.img". If you've an AArch32 binary, name it as "kernel7.img". (Where the number designates ARMv8 for AArch64 and ARMv7 for AArch32 respectively). You'll also need three firmware files (bootcode.bin, start.elf, fixup.dat) on that fat partition, from here. That's all, forget all the other rasbian files and partitions. What's common: on a RaspberryPi3 board, your code will be executed in paralell by all 4 cores at once (in contrast to x86, where you have to send an interrupt from BP to start APs). You can distinguish by reading a system register (mpidr_el1). You have to set up a stack and clear the bss yourself. For both modes, you can use the Mailbox interface (an MMIO area) to communicate with the board (like reading board number, setting screen resolution and require framebuffer address, etc.). In both cases your code will be running at hypervisor level (EL2), unless you set "kernel_old=1" in the config.txt, which will load your code at address 0 and executes it at EL3 (!). Therefore you should write a trampoline code which switches to supervisor (EL1) or userspace (EL0). I think EL1 is what you're after at first. What's different: kernel7.img is loaded at 0x8000 (note 3 zeros), and you'll get some system table pointers in registers. Kernel8.img is loaded at 0x80000 (note 4 zeros) and you can't rely on the registers (linux uses a different method in 64 bit mode to pass dtb). So it's better to use a Mailbox call to get the command line for example, as that works for both AArch32 and AArch64. An example minimal C trampoline code is here. Throw rocks on me, but I've used GNU toolchain for that. Thankfully there are lots of pure fasmarm examples as well, I suggest to take a look at Peter Lemon's tutorials, which includes examples in AArch32 and AArch64 for all models (Rpi1, Rpi2, Rpi3). The main difference among board models is that 2 and 3 uses a different MMIO address than the original Pi, and only Rpi3 supports AArch64. Not a starfield, but Peter's graphic mode hello world example is here, illustrating core and Mailbox handling as well as writing to the framebuffer: https://github.com/PeterLemon/RaspberryPi/blob/master/HelloWorld/CPU/kernel8.asm#L22 Oh, and very important. Don't believe the BCM2835/6/7 documentation! They are full of typos and bugs, always look for an errata! Cheers, bzt |
|||
17 Nov 2018, 14:53 |
|
pelaillo 22 Nov 2018, 12:50
|
|||
22 Nov 2018, 12:50 |
|
FlierMate11 26 Oct 2022, 05:46
What about RP2040 (a MCU from Raspberry Pi Foundation)? It uses ARM Cortex-M0.
The documentations say: Quote: The processor implements the ARMv6-M Thumb instruction set, including a number of 32-bit instructions that use Thumb-2 technology. The ARMv6-M instruction set comprises: Source: https://developer.arm.com/documentation/ddi0432/c/programmers-model/instruction-set-summary?lang=en Is the above supported in FASM ARM? I am new to everything revolving around ARM and MCU. RP2040 can be programmed in MicroPython, but like what edfed was saying, I want to get a deeper understanding about MCU by writing program in Assembly language. BTW, bzt came up with useful information. |
|||
26 Oct 2022, 05:46 |
|
revolution 26 Oct 2022, 05:48
FlierMate11 wrote: Is the above supported in [FASMARM]? BTW: fasmarm is one word. |
|||
26 Oct 2022, 05:48 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.