Page 1 of 2

WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sat Nov 17, 2018 6:09 pm
by DavidS
I am working on writing a simple micro-kernel operating system for the Raspberry Pi 3B (possibly could be ported to others later). The purpose of the OS is to demonstrate some concepts of OS theory and implementation, so that everyone may learn. I am hoping to learn a lot in the process, as that is what makes it fun.

This OS is going to be written mostly in C, and compiled with gcc. The assembly components needed to get some things up and running are going to be written in ObjASM syntax using the AsAsm assembler (on RISC OS).

This project has barely started, I have not yet gotten any of the little bit of code uploaded yet. Though for those that would like to follow along the url to the site where I am putting everything is:
https://asmfun.riscos.fr/osdev/index.html

USING BSD 2 CLAUSE LICENSE
After a good amount of debate about the license, primarily between the MIT and 2 clause BSD licenses I have settled on using a 2 clause BSD license.

After thinking about it for a while I realized that the 2 clause BSD license is equal in its permisiveness to the MIT license, and the 2 clause BSD license does a better job with the disclaimer of liability (important when other people can modify and use your code).

I want this project to be as widely usable as possible, hence the choice of a very permisive license.

WE HAVE A NAME
YANGTOS stands for Yet ANother Goliath Tiny Operating System.

Thank you Burngate.

THE OS NEEDS A NAME:
I am not coming up with an appropriate name for this operating system. Any suggestions for a name are very much appreciated. If I want to use a suggested name, and the suggestor allows me to use it without restriction, I will give credit to the source of the name so long as I have there real name.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sat Nov 17, 2018 6:32 pm
by Burngate
Looks interesting - keep us posted!

As to a name for it: if I were called David, I'd want to call something I was building either Solomon or Goliath, and since this is meant to be as simple and small as possible - the very antithesis of those two - either name might do.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sat Nov 17, 2018 7:05 pm
by DarkPlatinum
Nice! LearnALot OS

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sat Nov 17, 2018 9:54 pm
by davidcoton
DavidOS.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sat Nov 17, 2018 10:35 pm
by drgeoff
DavOS rolls off the tongue better. :)

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sat Nov 17, 2018 10:59 pm
by DavidS
Some good suggestoins so far.

I am a little further behind than planned, as I had forgotten today was a friends memorial service.

So I may not have the extra pages on the site until tommorrow.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sat Nov 17, 2018 11:59 pm
by W. H. Heydt
drgeoff wrote:
Sat Nov 17, 2018 10:35 pm
DavOS rolls off the tongue better. :)
Only if the programs that run under it are called Daleks.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sun Nov 18, 2018 8:26 am
by drgeoff
W. H. Heydt wrote:
Sat Nov 17, 2018 11:59 pm
drgeoff wrote:
Sat Nov 17, 2018 10:35 pm
DavOS rolls off the tongue better. :)
Only if the programs that run under it are called Daleks.
No, the creator of the Daleks was Davros.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sun Nov 18, 2018 12:37 pm
by DavidS
drgeoff wrote:
Sun Nov 18, 2018 8:26 am
W. H. Heydt wrote:
Sat Nov 17, 2018 11:59 pm
drgeoff wrote:
Sat Nov 17, 2018 10:35 pm
DavOS rolls off the tongue better. :)
Only if the programs that run under it are called Daleks.
No, the creator of the Daleks was Davros.
Which spoken aloud sounds a lot like DavOS. Phonetically they are very similar (R is not well heard as phonemes go).

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sun Nov 18, 2018 12:43 pm
by DavidS
I think I will go with:

YANGTOS for Yet ANother Goliath Tiny Operating System.

As long as noone sees a reason that I should avoid that name.

Thank you to Burngate for the suggestion. I will being giving credit in the notes about YANGTOS.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sun Nov 18, 2018 12:52 pm
by hansotten
drgeoff wrote:
Sat Nov 17, 2018 10:35 pm
DavOS rolls off the tongue better. :)
And sounds a lot like a well known skiing resort in Switzerland!

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sun Nov 18, 2018 1:01 pm
by DavidS
Now I need to figure out what license, before I begin posting code. So how should I license the source?

I was thinking either a 2 clause BSD license or a MIT license. I want a minimal of restrictions to the use of the code (it is intended for learning), while keeping some small note of where it comes from (to preserve its legacy over time, if it lasts anywhere). I also want to be able to change the license to something even less restrictive in the future if I feel it appropriate at that time (like an unlicense [which gets around the fact that some areas do not allow public domain]).

So I am asking for some kind of input on the issue of license.

I want the first site update of today to reflect both the YANGTOS name and the license moving forward.

@Hansotten:
I do not like the idea of that direct of a reference to the author. It feels egomania in its nature.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sun Nov 18, 2018 1:25 pm
by DavidS
YANGTOS will be licensed under the 2-clause BSD License.
See:
https://opensource.org/licenses/BSD-2-Clause


I realised that the 2-clause BSD license is effectively identicle to the MIT license in its permissiveness, and further the 2-clause BSD license has a more complete, less ambiguous, disclaimer of liability.

Off to get the first update of the day up.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sun Nov 18, 2018 5:55 pm
by DavidS
Well it will be soon that the actual OS code starts apearing on my site.
I am writing a utility to convert C source into syntax highlighted HTML on RISC OS. This will aid in getting the code to the site, as it will take a lot of the work out of displaying the source in a page describing its function. It is interesting how one project so often involves the creation of other tools that are not part of the project it self.

I added a super simple console output module that outputs text to the framebuffer in a readable form (and added enough to the kernel to get the module running). This should make going forward a little easier. Though so far I have only created the uper case alphabet, numbers, and some operator symbols for the bitmapped font used by console output, so it has some limits.


Also debating throwing some code into the kernel for debuging, to display some small bitmapped images, so that a kernel crash before any module gets loaded can be cought, or if there is a crash that pushes things all the way down it still will have a way to report.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sun Nov 18, 2018 8:59 pm
by Heater
Don't do that.

Just push your code to github.com. Then we can see what you have with syntax highlighting and all.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sun Nov 18, 2018 10:05 pm
by DavidS
Heater wrote:
Sun Nov 18, 2018 8:59 pm
Don't do that.

Just push your code to github.com. Then we can see what you have with syntax highlighting and all.
Now why would I want to push my code onto a MS controlled server?

For that matter why would I want to put code that uses RISC OS as a build environment to a type of repo that there is difficulty accessing from in RISC OS?

I will go with the most future proof method for me, I will be uploading the code to my site, in zip's. I will include a form of version controll so that the version can be rolled back to an earlier version if desired, though it will be after downloading a full tree version (and I will offer just current version archives as well, and keep around any major release as a just that version archive).

Though I have seen to many different version control systems come and go. Doing it this way is more likely to ensure the longevity, in proportion to how many people become interested in the project. Each person that downloads it is another backup of the source. If my site goes off-line then another will be able to post the code to there site.

And I do not like the source highlighting that uses a white background and a proportional fornt. Fixed width fonts have there place in source code, fixed width fonts allow for better alignment. Black backgrounds makes for better contrasting color choices for syntax highlighting.

I had already tried a few things that already do the translation, though one used style sheets, another abused charactor codes, etc. Nothing wrong with style sheets, it just clashes with the way my site is done.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sun Nov 18, 2018 10:11 pm
by DarkPlatinum
DavidS wrote:
Sun Nov 18, 2018 10:05 pm
Heater wrote:
Sun Nov 18, 2018 8:59 pm
Don't do that.

Just push your code to github.com. Then we can see what you have with syntax highlighting and all.
Now why would I want to push my code onto a MS controlled server?

For that matter why would I want to put code that uses RISC OS as a build environment to a type of repo that there is difficulty accessing from in RISC OS?

I will go with the most future proof method for me, I will be uploading the code to my site, in zip's. I will include a form of version controll so that the version can be rolled back to an earlier version if desired, though it will be after downloading a full tree version (and I will offer just current version archives as well, and keep around any major release as a just that version archive).

Though I have seen to many different version control systems come and go. Doing it this way is more likely to ensure the longevity, in proportion to how many people become interested in the project. Each person that downloads it is another backup of the source. If my site goes off-line then another will be able to post the code to there site.

And I do not like the source highlighting that uses a white background and a proportional fornt. Fixed width fonts have there place in source code, fixed width fonts allow for better alignment. Black backgrounds makes for better contrasting color choices for syntax highlighting.

I had already tried a few things that already do the translation, though one used style sheets, another abused charactor codes, etc. Nothing wrong with style sheets, it just clashes with the way my site is done.
Do what you feel best is for your OS, don't let others stop what you really want to do.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Sun Nov 18, 2018 10:35 pm
by Heater
DavidS,
Now why would I want to push my code onto a MS controlled server?
OK. Good point.

Although git is nothing to do with MS. There are other places, bitbucket, gitlab, do it yourself server, etc.

You are right, if your code needs RISC OS to be useful then I should not complain, I will never see it.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Mon Nov 19, 2018 1:38 am
by DavidS
Well I am placing the HTML converter on the back burner. It is not yet far enough along to be really usefull, though I can just use HTML < pre > and < code > tags around the code for now, and not worry about syntax highlighting, until I come back to this sub project.

This has delayed getting anything else done on the site yet another day. Well this combined with unexpected interruptions.
Heater wrote:
Sun Nov 18, 2018 10:35 pm
DavidS,
Now why would I want to push my code onto a MS controlled server?
OK. Good point.

Although git is nothing to do with MS. There are other places, bitbucket, gitlab, do it yourself server, etc.

You are right, if your code needs RISC OS to be useful then I should not complain, I will never see it.
You may see it yet. Just because it is being written to initially build on RISC OS, it can still be built on other platforms. The only difficulty I see possible is the choice of assembler, though it should be easy enough to make whatever small changes (or just port asasm, it is open source, and should compile on Linux without to much problem).

The C toolchain is gcc 4.7.4 (will be updated over time), that is gnu versions of:
  • addr2line
  • ar
  • as
  • c++filt
  • cpp
  • elfedit
  • elf2aif
  • gcc
  • gcc-*
  • gconv
  • gprof
  • ld
  • make
  • mkresfs
  • objcopy
  • objdump
  • readelf
So if someone wanted to build it under ARM Linux I do not see anything stopping them, exept for the lack of asasm (or ObjAsm), and it should be possible to port asasm to Linux.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Mon Nov 19, 2018 2:20 am
by DavidS
For an example of how I intend to do the source for now (until I get the utility completed) see my blog page, as I posted about this issue:
https://asmfun.riscos.fr/blog.html

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Mon Nov 19, 2018 4:24 pm
by DavidS
Well I have enough of the site done that it is probably best to look there for updates.

I have added a Documents page. While it does not yet contain any documents, it gives me a container to add documents to. Sometimes I may even just write a text document, and later come back to it and redo it in HTML.

Also I am planning on adding the page for downloads later today, as well as a news page (to replace the rambling status box on the main page).

I need to put togather a good list of resources so that I may be able to put up a links page with good third party information on OS Theory, SMP, ARM, MMU's, VideoCore IV, Raspberrry Pi HW, USB, Bluetooth, Ethernet, TCP/IP, and the BCM2835/6/7 SoC's.

I also just realized that I do not have listed a place for information on BlueTooth or Ethernet. I will have to add those to the list of documents todo.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Tue Nov 20, 2018 12:41 pm
by DavidS
Writing an OS is fairly simple, so long as the basic concepts are understood.

Writing a filesystem is a little harder, though still fairly simple.

Writing Hardware Support code is even harder, and sometimes a bit difficult.

Writing a complex application is even harder.

Writing documentation to describe how everything works is Extremely difficult. And this is where I am. I am attempting to write the documentation for what is already done, in complete detail. That is the most difficult part of a project like this, to the point that there are many places that I rely on the reader being familiar with C and use the code to describe the algorithm, as it is difficult to do a good job of describing how an algorithm works.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Wed Nov 21, 2018 3:49 pm
by DavidS
I am switching primary implementation programming languages.

Now I am going with FreeBASIC, as thinking got me to primarily work from Raspbian which allows the use of FreeBASIC. And FreeBASIC is the only current compiler I am aware of that is appropriate for developing an OS kernel.

I am taking this opportunity to not only show hows on OS design, though also to show that BASIC is NOT dead, though still very useful.

I am also looking for other FreeBASIC compatible compilers that may be out there, as there may be better options (if can find others that can target ARM). Unfortunately at this time FreeBASIC uses gcc as a back end for ARM targets, while it will directly produce x86 code. Also many of the FreeBASIC standard library functions are written in C instead of BASIC.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Wed Nov 21, 2018 11:27 pm
by DavidS
Desregard the previous post. I got fed up with Linux a bit to fast when I got to attempting to recompile YANGTOS. Still with the same C source (and minimum assembly), I attempted to do a clean build (to see how it does), the end results of multiple attempts were not great (despite using the same tool chain as I did on RISC OS).

It is quite telling, and I am not going to attempt to build the project inside of RPCEmu.

Though I am very likely to see what I can do in BBC Basic V for higher levels of the OS. I will be looking for a BBC BASIC V compiler, for RISC OS, with available source that does not require a closed source library module.

Re: WIP: A new learning Toy OS, for the RPi 3B.

Posted: Thu Nov 22, 2018 3:07 am
by Heater
Could you elaborate on why your build was failing.

You have no code to look at on the YANGTOS site but judging by the example source quoted there it looks like straight forward C that should be buildable very easily with nothing but gcc and perhaps make.