Have you designed any Small OS

Thread Starter

aspirea5745

Joined Apr 17, 2019
99
Hi,
I am aware of how difficult it is to build an operating system. But I see that small size operating systems are made for embedded systems such as Raspberry Pi OS. I will not even try to make it because I never need it. I just want to know the answers to some questions

Have you ever created a small operating system for your project?

What features should be in small operating system?

What do you consider is the operating system?
 

BobaMosfet

Joined Jul 1, 2009
1,780
Yes, I have an amazing mini RTOS, it takes about 6-9K (object) of flash for the executable (full GUI).

All operating systems, irregardless of platform or size exist for one purpose and one purpose only: Resource Management. Everything that an application (any program) requires, is a considered a resource. Examples include:
  1. Memory
  2. Device Access
  3. Events
  4. Timing
  5. etc.

At a minimum, you need to be able to provide
  1. timing (an interrupt queue),
  2. events (creates a means of triggering application operation only when something useful occurs),
  3. device management (makes I/O opaque & uniform)

Upon those 3 things you can very easily make very powerful and dynamic applications. With a little more effort, as I have done, you can have it all- (GUI, etc). Underlay it with a context switcher, which I have, but rarely use because of the nature of most projects I work on, and you have a full windowing O/S. I spend more time writing device drivers for new devices.

The benefit of this, of course, is that when I write an application, I have a rich foundation of code already written, that is smart, and it means my core code is very small, leveraging calls into the O/S or any Manager in order to do the heavy lifting. It also means that I never have to rewrite code for accessing any given device, so code is portable, virtually flawless, and it allows me to develop rich embedded products in a fraction of the time it takes someone to do it who has no idea how to really put the building blocks together.
 
Last edited:

Papabravo

Joined Feb 24, 2006
16,182
Yes. It was a special purpose OS for a communications device. The principle services were timer interrupts and services along with various task switching mechanisms, but with a FIXED number of tasks. As such I did not require queues for the task states because it was easy enough to identify the highest priority task that was ready to run. IIRC it was about 8 tasks. One background/idle task and 7 foreground/IO tasks.
 

BobTPH

Joined Jun 5, 2013
3,332
Well, not exactly, but I did write a tiny cooperative multitasking kernel that was able to run up to 4 tasks on a pic12F675, which has all of 64 bytes of RAM and 1024 words of program memory. Notice, no K or M in those memory sizes.

Bob
 

nsaspook

Joined Aug 27, 2009
8,394
Most of small MCU embedded programming at the OS hardware and hardware abstraction level is for a fairly fixed set of tasks. This more like the development of a task specific system generation process of software routines using OS concepts rather than the building of a classic general (with almost every driver and system functionality included) UI level OS like Linux for the Raspberry Pi. The classic OS of old would have a SYSGEN stage where all of the hardware and software driver, interface and application program requirements are specified in some sort of config file. This would generate a tailored version (often without UI support) of the OS to a specific set of tasks. With Linux, it's possible to still do this and build a task specific version like is usually done with things like IP cameras and other Linux based controller devices.

https://en.wikipedia.org/wiki/System_generation
 
Last edited:

BobaMosfet

Joined Jul 1, 2009
1,780
Well, not exactly, but I did write a tiny cooperative multitasking kernel that was able to run up to 4 tasks on a pic12F675, which has all of 64 bytes of RAM and 1024 words of program memory. Notice, no K or M in those memory sizes.

Bob
@BobTPH I'm just surprised you didn't write a paged memory manager to swap pages in and out.... :p Just Kidding :) Beautiful work.
 

BobaMosfet

Joined Jul 1, 2009
1,780
So operating system manage resources such as Time, Memory, and I/O.

Does your operating system communicate with I2C, SPI, UART devices?
@aspirea5745 Yes, it has I2C/TWI, SPI, and UART all within the first 4K of code. Anything beyond that (into the 7K-code range) requires the device manager and device drivers for daughterboards/devices I've written drivers for: USB, Ethernet, RS232, RS485,, RTCs, Displays (TFT, LCD, LED, VFDs), EEPROMs, DIMMs, SD Flash cards, RFID, Inputs (matrix keypads, etc), and so much more. I can write a driver for anything.

One of the greatest aspects of the Device Manager is that device drivers are not hardwired to specific pins. The application tells the driver what pins it uses when the driver is loaded. This allows me to use MCUs incredibly efficiently, with the same, unchanging code.

By definition, because of the maximum clockspeed I run MCUs at, between 16-20Mhz, I made the arbitrary decision to provide up to 1ms accurate timing clocks (up to 16 IRQs) for app and driver use. I could push that to 32, but haven't needed to do so, yet.
 
Last edited:

Thread Starter

aspirea5745

Joined Apr 17, 2019
99
@BobaMosfet Great! Those descriptions are pretty brief. I know what we do in real time operating system that can also do in simple programming The point is how we do that in RTOS. I would like to learn from you. I have work with PIC18. Can you assist me. I know its not easy job. It takes years to understand. I want give a one chance for myself. I will not take much of your time I want to understand how expert design real time operating system.
 

BobaMosfet

Joined Jul 1, 2009
1,780
@aspirea5745 I would love to help you as a mentor. Unfortunately, I'm already tutoring 5 other people at this point, and I'm at a limit with everything else in my life. When a slot frees up, I'll get back to you. PM me with your knowledge set- I'm not looking for a wiz at stuff, I just need to know where to start with you so I'm not boring you with things you know.
 
Top