View unanswered posts | View active topics It is currently Thu Jul 09, 2020 1:02 am



Reply to topic  [ 12 posts ] 
 Seeking a small simple free OS written in C 
Author Message

Joined: Wed Jan 09, 2013 6:54 pm
Posts: 1419
Not far away:
roelh wrote:
I'm searching for a small and simple OS that has free C source code. Suggestions anyone ?


I'm sure there must be a few. Although, 'Operating System' covers quite a range of possible capabilites, from CP/M-like to Windows-like.

Selfie is very interesting, if not exactly what you asked for:
https://github.com/cksystemsteaching/selfie#selfie---
(8k lines of code, in a C subset, for RISC-V)

https://s-matyukevich.github.io/raspber ... ction.html
Teaching project, a bare metal OS for 64 bit ARM


Sun Jun 14, 2020 7:18 pm
Profile

Joined: Sat Jun 16, 2018 2:51 am
Posts: 50
xV6 is a pretty good one. It was designed by MIT for teaching and is based on Unix V6. Since it's commonly used in classes, there's quite a bit of documentation and resources available for understanding it.

Be aware that there are now two version floating around. The original version targets x86 and is the one I've shared links to above. The new version (since 2019) targets RISC-V.


Tue Jun 16, 2020 9:07 pm
Profile

Joined: Mon Oct 07, 2019 2:41 am
Posts: 112
Quote:
The new version (since 2019) targets RISC-V.

Why can the new version never support the old version hardware?
Does any version have the C compiler? the compiler source? Unix and Minix both are
bad for not having a C compiler source.
One Man Unix is here 6809/68000 version.
https://github.com/EtchedPixels/OMU

FreeDos may be another option, but you might have to dig to find out
just what it it written in. Small here is 256KB as a guess.
Structures and long ints (32 bits) and bitfields are must to compile anything.


Wed Jun 17, 2020 7:17 am
Profile

Joined: Wed Jan 09, 2013 6:54 pm
Posts: 1419
It seemed odd to me, too, that a small OS written in C needs two projects to target two architectures. Perhaps it's for teaching reasons: there will be some small amount of assembly language, and maintaining two versions of that would be extra work even without the aim of teaching the construction of the OS.


Wed Jun 17, 2020 8:08 am
Profile

Joined: Sat Jun 16, 2018 2:51 am
Posts: 50
xV6 comes with very few utilities of the bat. And of the utilities included, the code is very minimal (for example cat.c). To me, this is a positive because it helps with learning. If you want a utility, you either write it yourself or port it - both scenarios offer a great learning opportunity.

Thus it does not include a C compiler. There have been attempts to add one (such as this one). I'm not sure if someone has been successful.

@DoctorWkt has a video where he shows how he added various BSD utilities to the OS (code here).


Wed Jun 17, 2020 9:12 pm
Profile

Joined: Sat Jun 16, 2018 2:51 am
Posts: 50
BigEd wrote:
It seemed odd to me, too, that a small OS written in C needs two projects to target two architectures. Perhaps it's for teaching reasons: there will be some small amount of assembly language, and maintaining two versions of that would be extra work even without the aim of teaching the construction of the OS.

Unfortunately they have no plans to continue supporting the x86 version. All attention has shifted to the RISC-V implementation. This looks like the last commit the two branches have in common.


Wed Jun 17, 2020 9:18 pm
Profile

Joined: Mon Oct 07, 2019 2:41 am
Posts: 112
Must the OS be written in C? Some versions of PASCAL compiled to P-code,
that was then emulated on the host machine and came with a simple o/s.
The advantage of emulation is that while it slower,you don't need a smart cpu.
APL on a 8008 or BASIC on a PDP 8 for example, just lots of memory.
Ben.


Wed Jun 17, 2020 11:15 pm
Profile

Joined: Mon Oct 07, 2019 1:26 pm
Posts: 40
The OS should be suitable for my Kobold K2 cpu, so:
The OS should be in C because I have a compiler for C almost finished. It compiles
to machine code, and that compiled C-code will be a lot faster than any interpreted P-code system .
The OS must also be suitable for a 16 bit target system, and optionally use pages to extend the memory speed beyond 64 kBytes.
( One of the proposals above had everything in 64-bit variables, that's not efficient on Kobold)


Sat Jun 20, 2020 10:31 am
Profile

Joined: Mon Oct 07, 2019 2:41 am
Posts: 112
The OS I have is about 2K intructions and 12kb buffer space + 4K word stack.
It uses a block size of 1.5Kb, and a simple FAT table and directory 1 block
in size.(Floppy size disks) This on a 32 bit cpu so that comes out to 32KB.
I have 64KB dos segment and 64KB program segment for now.
(20 bit byte addressing, 8,16,32 bits,TTL logic)
Ben.


Sat Jun 20, 2020 7:47 pm
Profile

Joined: Mon May 28, 2018 8:01 am
Posts: 7
FreeRTOS is a small multitasking system designed for embedded systems, but can be used for general purpose systems if you add a program loader. It is designed to be easy to port to new systems, and supports 8- 16- or 32-bit systems. I looked into it a few years back as a possibility for a multiprocessor Z80 system I was designing (a project that's currently on hold, but I hope to get back to later this year), but it's a good target for just about any memory-constrained system. It's mostly C with a small amount of target specific assembly (initialisation, task switching). There's a good selection of drivers for devices commonly found in embedded systems (eg LCD displays, SD cards, etc).


Tue Jun 23, 2020 8:30 am
Profile

Joined: Thu Dec 05, 2019 7:53 am
Posts: 4
Location: Tokyo, Japan
oldben wrote:
Why can the new version never support the old version hardware?

My guess is becuase it would be directly antithetical to the purpose of the software. Things that make the code more difficult to read, such as support for multiple hardware platforms, make it worse as a teaching tool.

Back in the '90s when I was adding support for the newer 3c509c version of the 3c509 Ethernet card to NetBSD 3c509 driver, I discovered to my dismay that a substantial amount of code was devoted just to handling the differences between the several versions of the cards, bug workarounds, and so on; learning that driver and how to modify it was not an easy experience.

The developer of the other OS mentioned in the head post has had similar experiences:

Quote:
I already mentioned that I don’t want the RPi OS to support multiple computer architectures or a lot of different devices. I felt even stronger about this after I dug into the Linux kernel driver model. It appears that even devices with similar purposes can largely vary in implementation details. This makes it very difficult to come up with simple abstractions around different driver types, and to reuse driver source code. To me, this seems like one of the primary sources of complexity in the Linux kernel....


"Simple" and "supports a wide variety of real hardware" do not go together at all.

_________________
Curt J. Sampson - github.com/0cjs


Tue Jun 30, 2020 11:02 pm
Profile

Joined: Mon Oct 07, 2019 2:41 am
Posts: 112
While not a OS, A SD card fat file system can be found here.
http://elm-chan.org/fsw/ff/00index_e.html
Ben.
PS: Simple Fast Cheap Pick any two of them.


Wed Jul 01, 2020 9:49 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 12 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


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:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software