3

I always wanted to develop my own crappy operating system, but the many weird legacy quirks of the x86/PC platform kept me from doing so (e.g. real vs protected mode, only low resolutions available in VGA/VESA, etc.). Now I realized, that maybe one of the many SoCs used in smartphones would be a better platform for developing an operating system as they are all-in-one solutions without downward compability considerations and therefore better design (even though I am not the biggest fan of the ARM instruction set).

Even better: There are many single board computers, which bring SoC, RAM, USB ports for connecting mouse/keyboard and hdmi for connecting a monitor for a cheap price... a perfect platform for dabbeling into OS development I thought...

The most established of the single board computers seems to be the Raspberry Pi and I also found 2 tutorials on OS development for them online (https://hackaday.com/2018/01/19/roll-your-own-raspberry-pi-os/). I thought the tutorials would serve as a nice intro, but actually I was missing a lot of info in the tutorials so I tried to get hold of the official documentation which of there is very little... too little in order to really develop bare metal.

Some issues I ran into:

  • there is a peripherals documentation for the raspberry 1, but not for the raspberry 2/3, which have totally different base addresses
  • the RB3 for example has a wifi chip (BCM43438), but I can't find any official documentation on how it is connected to the RB3 SoC (BCM2837)
  • the tutorials hint at the mailbox concepts for getting a framebuffer/get output via hdmi going, but I can't find any useful information on framebuffer/mailboxes in the official documentation
  • same with the boot process... it is nowhere explained in the official documentation
  • on the official broadcom website, I can't find the BCM2837 at all!
  • when looking at other SoCs like the S905 (in the Odroid C2) it has ethernet directly connected to the SoC (instead of through USB like the RB has), but I can't find any information on how to program it
  • besides the framebuffer topic of the tutorials I didn't find any instructions on how to program the GPU (e.g. for 3D rendering). There is a architecture document describing the VisualCore GPU, but not how it has to be interfaced...

Why is the documentation/specification so bad? Is it that the SoCs aren't directly sold to endcustomers and therefore their documentation is confidential? Is it only some SoCs and there are actually some with a proper documentation?

Wolf
  • 165
  • 2
  • 3
    I don't believe there is not enough documentation about virtually *any* aspect of RPI of any version. – Eugene Sh. Jul 23 '18 at 13:49
  • 2
    Just a reminder: SoC means system on a chip. Quite often, it happens that the SoC manufacturer purchases and uses external IP blocks, which might influence the amount of available documentation. – AndrejaKo Jul 23 '18 at 13:52
  • 2
    I had the impression the BCM2837 was produced through an exclusive deal for the RPi and not available to anyone else. So there would be no reason to produce any public documentation. – Finbarr Jul 23 '18 at 13:59
  • @Finbarr There is still available documentation: https://github.com/raspberrypi/documentation/files/1888662/BCM2837-ARM-Peripherals.-.Revised.-.V2-1.pdf – Eugene Sh. Jul 23 '18 at 14:00
  • I believe some people have produced their own by modifying others that parts of it are compatible with. I wouldn't be sure about its accuracy or completeness... – Finbarr Jul 23 '18 at 14:03
  • @Finbarr Yeah, but given the community size I would still go with it. Anyway, I don't think any other or non-opensource solution would work better. – Eugene Sh. Jul 23 '18 at 14:05
  • ...and from the note on the front page and the fact it immediately turns into BCM2385 it looks like that is exactly the case! – Finbarr Jul 23 '18 at 14:05
  • @EugeneSh. If I can't get a datasheet for a part from the manufacturer or their agent then personally I'm unlikely to use it. Others may differ. – Finbarr Jul 23 '18 at 14:07
  • The document is something some random tutor in stanford created by making some changes to the bcm2835 document... as Finbarr said: not complete or accurate... or in other words: nothing offical. @EugeneSh. Could you for example show me documentation on the boot process? My understanding is more and more, that there is a lot of documentation on userspace/linux things, but close to no documentation on bare metal topics – Wolf Jul 23 '18 at 14:08
  • @Finbarr For commercial use - for sure. And apparently, for commercial use I believe you could obtain one. – Eugene Sh. Jul 23 '18 at 14:12
  • @Wolf Anyhow, what is your application you are asking recommendations for? I had a good experience with beaglebone boards and even with [FriendlyArm](http://www.friendlyarm.net/products), even though the boards not *very* popular, but there is no ptoblem to obtain the schematic and/or the components docs. – Eugene Sh. Jul 23 '18 at 14:19
  • Try the TI Beagle Bone Black. Because its based on the Sitara processor these is good documentation available for it. – Steve G Jul 23 '18 at 14:19
  • @EugeneSh. I found a documentation for the Raspberry SD Card boot process here: https://github.com/raspberrypi/documentation/blob/master/hardware/raspberrypi/bootmodes/sdcard.md ... That is basically proof for lacking documentation. I will check out the beagle boards! – Wolf Jul 23 '18 at 14:22
  • Does this constitute an EE question even slightly? – Andy aka Jul 23 '18 at 14:30
  • I recommend focusing on something larger than 8-bit and smaller than 32-bit. I believe the MSP430 is probably the best target for learning how to write an operating system and being able to complete it. A problem will be the lack of any standard input and output device. That can be solved by simply adding an easy-to-handle graphics display and a keyboard interface. But it will require some work on your end to achieve that. The lack of a protection system is another problem, but that's not a requirement when learning. – jonk Jul 23 '18 at 14:37
  • @jonk Looks like you went down from general purpose CPU down to low-end MCU too steeply :) – Eugene Sh. Jul 23 '18 at 14:39
  • I also recommend using Douglas Comer's XINU book -- his first "red" book published in 1983 by Pearson. – jonk Jul 23 '18 at 14:42
  • @EugeneSh. No. It's a "perfect fit" for anyone trying to learn to do this. Also, Douglas Comer's XINU is the perfect ***way*** to learn to do it, as well. (His 2nd editions and later are too complicated and lack some sections -- such as the "memory marking" sections -- so it's important to use his 1st edition.) – jonk Jul 23 '18 at 14:43
  • @Jonk I would still go with something ARM based – Eugene Sh. Jul 23 '18 at 14:44
  • @EugeneSh. That would be my SECOND choice. The reason is that while ARM TDMI is well-documented, it's also "complex" for a 1st time learner. The MSP430 is "simple" by comparison. Also, too many systems include ***two*** ARM processors or else multiple cores. It gets hard, fast. – jonk Jul 23 '18 at 14:45
  • @jonk: I am looking for something I could _in theory_ use as my primary system one day. Mouse, keyboard (I would go for PS2 over USB), a high res graphical display, a reasonable amount of RAM, an editor, compiler... eventually I would like to develop a TCP/IP stack and a simple browser. Philosophy wise I would rather go into the direction of TempleOS (<100.000 LoC) than Unix/Xinu/Minix... – Wolf Jul 23 '18 at 14:46
  • @Wolf That's fine. Comer has additional books (very, very GOOD ONES) on the topic of doing TCP/IP. I would AVOID at all costs the idea of Linux and Minix. (Especially Minix -- horribly complex.) But XINU is as good as it gets. You cannot find a better approach to learning to code an O/S. Take it from someone who worked on the Unix kernel in 1978 and taught operating systems at the largest university in my State. XINU can be done in very few lines of code. – jonk Jul 23 '18 at 14:48
  • 1
    Pardon me if I am mistaken, but isn't it true that writing an OS is kind of a 10-men-year effort for a seasoned professional? – Ale..chenski Jul 23 '18 at 17:06
  • @AliChen There is a wide variety of things one can call an OS :) – Eugene Sh. Jul 23 '18 at 17:49
  • @EugeneSh., sure, but ... "an editor, compiler (+linker?), ICP/IP", plus 2-3 year of learning from the starting point of the OP :-( A "high-res graphical display" would need some GUI, no? X-windows took how many years to develop? For hundreds of developers? 20? Sorry, but this request is nothing but completely unrealistic dream. – Ale..chenski Jul 23 '18 at 18:01
  • @AliChen: X-Windows is also a great example of terrible software! Check out TempleOS by Terry Davis for an example of the power of simplicity. Also I didn't say I want to do it withing a year or five years. Also I am an experienced Software Developer/Engineer/Architect... just never did much bare metal stuff, but I am able to develop in assembler for an 8-bit video game console. – Wolf Jul 24 '18 at 08:18

1 Answers1

1

At least the NXP i.MX6 has most of the documentation publicly available (except for the GPU). There are many development boards (SABRE, Boundary Devices, Novena or systems-on-module for this SoC (check for example Variscite).

Check out also the "big" SAM line from Microchip.

filo
  • 8,801
  • 1
  • 25
  • 46