OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 12:38 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: ARM board for beginner
PostPosted: Sat May 16, 2020 10:27 am 
Offline

Joined: Sun Feb 16, 2020 7:57 am
Posts: 3
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


Top
 Profile  
 
 Post subject: Re: ARM board for beginner
PostPosted: Fri May 29, 2020 1:15 pm 
Offline
Member
Member

Joined: Tue Apr 03, 2018 2:44 am
Posts: 401
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


I'd recommend at least looking at:

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.


Top
 Profile  
 
 Post subject: Re: ARM board for beginner
PostPosted: Sat May 30, 2020 12:34 pm 
Offline

Joined: Sun Feb 16, 2020 7:57 am
Posts: 3
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.


Top
 Profile  
 
 Post subject: Re: ARM board for beginner
PostPosted: Sat May 30, 2020 1:38 pm 
Offline
Member
Member
User avatar

Joined: Mon Jan 15, 2018 2:27 pm
Posts: 201
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.


Top
 Profile  
 
 Post subject: Re: ARM board for beginner
PostPosted: Sat May 30, 2020 3:31 pm 
Offline
Member
Member

Joined: Mon Feb 02, 2015 7:11 pm
Posts: 898
I agree. The Raspberry Pi is a terrible platform for OsDev, even more so as a first ARM platform.

_________________
https://github.com/kiznit/rainbow-os


Top
 Profile  
 
 Post subject: Re: ARM board for beginner
PostPosted: Sat May 30, 2020 8:26 pm 
Offline
Member
Member
User avatar

Joined: Fri Feb 17, 2017 4:01 pm
Posts: 640
Location: Ukraine, Bachmut
pvc and kzinti said it all, I just add this.
Image

in response to this
Quote:
Raspberry Pi is ideal because ...

:D
maybe it's "ideal", but not for OS development.

_________________
ANT - NT-like OS for x64 and arm64.
efify - UEFI for a couple of boards (mips and arm). suspended due to lost of all the target park boards (russians destroyed our town).


Top
 Profile  
 
 Post subject: Re: ARM board for beginner
PostPosted: Sun May 31, 2020 7:53 am 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
Hi,

galex wrote:
Thanks. Will check the tutorial out. Seems quite good for first look.
Let me know if you have a question.

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.
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:
I never tried with ARM before and I'm stunned how undocumented it is...
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 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.
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).

Cheers,
bzt


Top
 Profile  
 
 Post subject: Re: ARM board for beginner
PostPosted: Sun May 31, 2020 3:11 pm 
Offline

Joined: Sun Feb 16, 2020 7:57 am
Posts: 3
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).

bzt wrote:
galex wrote:
I never tried with ARM before and I'm stunned how undocumented it is...
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.


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.

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).


Top
 Profile  
 
 Post subject: Re: ARM board for beginner
PostPosted: Sun May 31, 2020 3:43 pm 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 1584
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.
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:
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).
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.

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


Top
 Profile  
 
 Post subject: Re: ARM board for beginner
PostPosted: Fri Jun 05, 2020 11:55 pm 
Offline

Joined: Tue Jan 28, 2020 12:11 am
Posts: 7
Location: Graz - Austria
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.

I also agree with that.

AArch64:
Therefore I bought a PINE64 Rock64 (quad core Cortex-A53) board:
https://www.pine64.org/devices/single-board-computers/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/reference/programmable-logic/zybo-z7/start

Limitations:
The price of the board. About 200~250$.

_________________
Code:
/* Beware of bugs in the above code;
I have only proved it correct, not tried it. */

Original quote by Donald E. Knuth


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Sa41848 and 78 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group