ARM board for beginner
ARM board for beginner
Hi,
I'm started to playing the thought to develop a simple OS for an ARM board. I'm new to ARM (and OS dev in general) and couldn't find very good documentation to ARM boards. Some boards like BeagleBone AI have some more documentation then others. Raspberry PI seem to lag behind in docs but it have some as well (maybe due to its popularity).
My goal is to learn ARM assembly and write a modern(ish) 64bit OS with multiprocessor support, memory management, IPC, networking (TCP/IP), storage (FS on SSD or other storage), and maybe even some interactive terminal capability (but that's the least important)...
I'll try to write something that works on QEMU first, and then try to port it to a real-life board. The problem is that even the QEMU documentation is incomplete, and the real boards are even worse... Maybe the problem is in me but I can't really find too much about the so called "qemu 2.x" virtual board even in QEMU's own WiKi or user documentation...
What do you recommend? How to start? Is there any board out there that have a decent enough documentation for a hobby OS? (something that QEMU or any other free emulator supports would be nice)
Thanks
I'm started to playing the thought to develop a simple OS for an ARM board. I'm new to ARM (and OS dev in general) and couldn't find very good documentation to ARM boards. Some boards like BeagleBone AI have some more documentation then others. Raspberry PI seem to lag behind in docs but it have some as well (maybe due to its popularity).
My goal is to learn ARM assembly and write a modern(ish) 64bit OS with multiprocessor support, memory management, IPC, networking (TCP/IP), storage (FS on SSD or other storage), and maybe even some interactive terminal capability (but that's the least important)...
I'll try to write something that works on QEMU first, and then try to port it to a real-life board. The problem is that even the QEMU documentation is incomplete, and the real boards are even worse... Maybe the problem is in me but I can't really find too much about the so called "qemu 2.x" virtual board even in QEMU's own WiKi or user documentation...
What do you recommend? How to start? Is there any board out there that have a decent enough documentation for a hobby OS? (something that QEMU or any other free emulator supports would be nice)
Thanks
-
- Member
- Posts: 426
- Joined: Tue Apr 03, 2018 2:44 am
Re: ARM board for beginner
I'd recommend at least looking at:galex wrote:Hi,
I'm started to playing the thought to develop a simple OS for an ARM board. I'm new to ARM (and OS dev in general) and couldn't find very good documentation to ARM boards. Some boards like BeagleBone AI have some more documentation then others. Raspberry PI seem to lag behind in docs but it have some as well (maybe due to its popularity).
My goal is to learn ARM assembly and write a modern(ish) 64bit OS with multiprocessor support, memory management, IPC, networking (TCP/IP), storage (FS on SSD or other storage), and maybe even some interactive terminal capability (but that's the least important)...
I'll try to write something that works on QEMU first, and then try to port it to a real-life board. The problem is that even the QEMU documentation is incomplete, and the real boards are even worse... Maybe the problem is in me but I can't really find too much about the so called "qemu 2.x" virtual board even in QEMU's own WiKi or user documentation...
What do you recommend? How to start? Is there any board out there that have a decent enough documentation for a hobby OS? (something that QEMU or any other free emulator supports would be nice)
Thanks
https://wiki.osdev.org/Raspberry_Pi
Referenced there is this:
https://github.com/bztsrc/raspi3-tutorial
Which sounds like it'd provide the hardware info you need to get going, and can work in qemu as well as bare metal (disclaimer, I've not tried this tutorial.)
Raspberry Pi is ideal because it's nigh on impossible to brick the hardware, so whatever mistakes you make in programming it can be quickly undone with a power cycle.
Re: ARM board for beginner
Thanks. Will check the tutorial out. Seems quite good for first look.
However probably it would be easier to debug/develop using an emulator first. I started using qemu with x86 and x86_64 many years ago and found quite good for this use case.
I never tried with ARM before and I'm stunned how undocumented it is... I mean qemu and how/what it actually emulates. On the bright side the source code is on the internet
so will figure it out eventually.
However probably it would be easier to debug/develop using an emulator first. I started using qemu with x86 and x86_64 many years ago and found quite good for this use case.
I never tried with ARM before and I'm stunned how undocumented it is... I mean qemu and how/what it actually emulates. On the bright side the source code is on the internet
so will figure it out eventually.
Re: ARM board for beginner
I know I'll get >9000 flame for this post. But please do not get Raspberry Pi as your first OSDev ARM machine. It's very powerful system, but there is no proper documentation for it at all. Anything that's available comes from reverse engineering. In RPI, ARM CPU is just a coprocessor for Broadcom's VideoCore GPU. Get someting that has proper documentation. IMO Broadcom is even worse than NVIDIA when it comes to their documentation.
Re: ARM board for beginner
I agree. The Raspberry Pi is a terrible platform for OsDev, even more so as a first ARM platform.
Re: ARM board for beginner
pvc and kzinti said it all, I just add this.
in response to this
maybe it's "ideal", but not for OS development.
in response to this
Raspberry Pi is ideal because ...
maybe it's "ideal", but not for OS development.
Re: ARM board for beginner
Hi,
Cheers,
bzt
Let me know if you have a question.galex wrote:Thanks. Will check the tutorial out. Seems quite good for first look.
Definitely. I've implemented raspi3 machine for qemu, available in mainline since qemu 2.12. The ARM part is quite fully supported, however there are certain limitations in the hardware emulation. Only the most common peripherals are emulated, many are missing. For the VC, only the Mailbox interface supported, which is enough to get most of the firmware interface working, including setting up framebuffers, configuring clock frequencies etc. but not the 3D acceleration part.galex wrote:However probably it would be easier to debug/develop using an emulator first. I started using qemu with x86 and x86_64 many years ago and found quite good for this use case.
It is quite well documented, but @pvc, @kzinti and @zaval is right about one thing: the documentation is very difficult to come by, which makes ARM less OSdev friendly. But if you try hard enough, it is not impossible to get those.galex wrote:I never tried with ARM before and I'm stunned how undocumented it is...
To get the list of currently supported devices, I'd suggest to take a look at the qemu peripheral initialization code: bcm2835_peripherals.c. For Rpi3 there are some additional devices, see bcm2836.c and the QA7 multicore interrupt controller is also emulated (see bcm2836_control.c). I've also implemented the ARM Local Timer emulation, that works as well (not sure when it was merged into the mainline, but quite some time now, should be available in all current binary qemu packages).galex wrote:I mean qemu and how/what it actually emulates. On the bright side the source code is on the internet
so will figure it out eventually.
Cheers,
bzt
Re: ARM board for beginner
Thanks everyone. Probably my question was a bit premature
What I actually try to achieve is to select a broad that I can more or less can emulate using free/affordable tools. Write an initial toy OS to learn ARM using the emulator then port it to an actual device. If it still works I'll probably cry a little in joy... Then gradually work towards my final goal (see first post).
I've seen several posts here about Raspberry Pi boards (mostly negative) so I haven't really considered that one. However probably the part I need will be fine (I don't need graphics, sound, or anything really fancy).
I know that it isn't a real board but for the basics (processes, threads, memory handling, etc) is fine. Also virtio is well documented so its easy to get a "console" up and running to see what's going on (in compliment to GDB).
What I actually try to achieve is to select a broad that I can more or less can emulate using free/affordable tools. Write an initial toy OS to learn ARM using the emulator then port it to an actual device. If it still works I'll probably cry a little in joy... Then gradually work towards my final goal (see first post).
I've seen several posts here about Raspberry Pi boards (mostly negative) so I haven't really considered that one. However probably the part I need will be fine (I don't need graphics, sound, or anything really fancy).
Sorry, I mean qemu itself is a bit undocumented. Especially the "virt" ARM board. There's some documentation but things like what's the memory layout of the "virt" machine, etc. isn't very well documented. It isn't hard to figure it out, the source is quite nice and readable.bzt wrote:It is quite well documented, but @pvc, @kzinti and @zaval is right about one thing: the documentation is very difficult to come by, which makes ARM less OSdev friendly. But if you try hard enough, it is not impossible to get those.galex wrote:I never tried with ARM before and I'm stunned how undocumented it is...
I know that it isn't a real board but for the basics (processes, threads, memory handling, etc) is fine. Also virtio is well documented so its easy to get a "console" up and running to see what's going on (in compliment to GDB).
Re: ARM board for beginner
Ah, I see. Don't expect the memory layout to be documented when it's user configurable You can query the current layout using the qemu monitor and the "info mtree", "info qtree" and "info memdev" commands.galex wrote:Sorry, I mean qemu itself is a bit undocumented. Especially the "virt" ARM board. There's some documentation but things like what's the memory layout of the "virt" machine, etc. isn't very well documented. It isn't hard to figure it out, the source is quite nice and readable.
Yes, but you'll never be able to test your code on real hardware. Think of it twice before you start coding for "virt" or "versatile". Even if you use "qemu -M raspi3", and your code is running fine in vm, there's no guarantee it will run on real hardware too. Qemu is a lot more permissive with memory accesses than the real CPU (for example it doesn't matter what's in MAIR system register, qemu will work, but for real CPUs, the device memory must be nGnRE and must have outter sharable attribs.) So checking your code on a real hardware from time-to-time is unavoidable.galex wrote:I know that it isn't a real board but for the basics (processes, threads, memory handling, etc) is fine. Also virtio is well documented so its easy to get a "console" up and running to see what's going on (in compliment to GDB).
If you want to save time and only focus on processes, threads, memory handling etc. then I'd recommend my boot loader. It will set up paging, multi-processing, frame buffer and UART, and it will load and map your ELF kernel in upper-half. Tested under qemu and on real hardware too.
Cheers,
bzt
Re: ARM board for beginner
I also agree with that.pvc wrote:I know I'll get >9000 flame for this post. But please do not get Raspberry Pi as your first OSDev ARM machine. It's very powerful system, but there is no proper documentation for it at all. Anything that's available comes from reverse engineering. In RPI, ARM CPU is just a coprocessor for Broadcom's VideoCore GPU. Get someting that has proper documentation. IMO Broadcom is even worse than NVIDIA when it comes to their documentation.
AArch64:
Therefore I bought a PINE64 Rock64 (quad core Cortex-A53) board:
https://www.pine64.org/devices/single-b ... rs/rock64/
The Wiki page from the used SoC (RK3328):
http://opensource.rock-chips.com/wiki_RK3328
On the above page there is also a TRM.
Limitations:
The ARM Mali GPU isn't documented in the TRM.
AArch32:
For ARM 32-Bit I bought a Zybo-Z7 development board fom Digilent.
It use the ZYNQ-7000 (dual core Cortex-A9 with a FPGA) from Xilinx.
https://reference.digilentinc.com/refer ... o-z7/start
Limitations:
The price of the board. About 200~250$.
Code: Select all
/* Beware of bugs in the above code;
I have only proved it correct, not tried it. */