Live data from Hacker News

Show HN: TinyOS – A minimalist RTOS for Cortex-M written in C

github.com

11–20 of 47 posts

Re: Show HN: TinyOS – A minimalist RTOS for Cortex-M written in C

#11
post #2

Hi HN, I’ve been working on a tiny RTOS as a personal project to better understand how operating systems and schedulers work internally. This project includes: - Basic task scheduler - Context switching - Simple memory management - Runs on (your target hardware or environment) Motivation: I wanted to learn OS internals by building everything from scratch rather than relying on existing frameworks. Challenges: - Imple…

Very cool! Thanks for sharing.

I would appreciate an honest comparison with FreeRTOS. Building something like this is an excellent learning exercise for the coder, but someone who has to balance the risks, learning curve and feature set has to justify the adventure in a different way.

One thing that would be interesting to hear more about would be your own recounting of the places where you made opinionated decisions about how things should work.

Re: Show HN: TinyOS – A minimalist RTOS for Cortex-M written in C

#12
post #3

I have no practical insight on RTOS in general, if anyone bothers to give me a hint, please. From all what I've looked into, RTOS does mean to create software systems that are almost perfectly predictable and safe to execute. Predictable latency, runtime and memory usage, plus maybe side channels to do the unpredictable stuff in between. It's actual rocket science, as no systemic mistakes are allowed. The confusion i…

TIL I learned that I am also a rocket scientist!

I would suggest that a slightly more approachable way to view an RTOS for MCUs is a library that sits on your bare metal that takes primary responsibility for efficiently dividing up available resources across multiple task functions.

An RTOS will usually provide a well documented SDK with support for memory safe queues, semaphores and message brokering.

Think of it as a software enforced contract + best practices to ensure that you get stable, predictable timing loops without ugly polling and blocking.

Re: Show HN: TinyOS – A minimalist RTOS for Cortex-M written in C

#14
post #2

Hi HN, I’ve been working on a tiny RTOS as a personal project to better understand how operating systems and schedulers work internally. This project includes: - Basic task scheduler - Context switching - Simple memory management - Runs on (your target hardware or environment) Motivation: I wanted to learn OS internals by building everything from scratch rather than relying on existing frameworks. Challenges: - Imple…

Looks like a fun project, but I’m curious what you actually tested on. There’s real numbers for estimated context switch timing, and you mentioned implementing context switching, but I can’t find any actual implementations of the context switching routine in your code. You don’t need to do this yourself, but it’s weird to talk about it if you haven’t.

Re: Show HN: TinyOS – A minimalist RTOS for Cortex-M written in C

#16
post #2

Hi HN, I’ve been working on a tiny RTOS as a personal project to better understand how operating systems and schedulers work internally. This project includes: - Basic task scheduler - Context switching - Simple memory management - Runs on (your target hardware or environment) Motivation: I wanted to learn OS internals by building everything from scratch rather than relying on existing frameworks. Challenges: - Imple…

Looks like a fun project, but I’m curious what you actually tested on. There’s real numbers for estimated context switch timing, and you mentioned implementing context switching, but I can’t find any actual implementations of the context switching routine in your code. You don’t need to do this yourself, but it’s weird to talk about it if you haven’t.

https://github.com/cmc-labo/tinyos-rtos/blob/2a47496047fdb45...

"Context switch (to be implemented in assembly for target architecture)"

There's no asm in the repo so I can only assume this is not something that actually compiles and runs.

Other things that are missing:

- No startup code (stack setup etc.)

- No linker script ("to be created", per makefile comment)

Re: Show HN: TinyOS – A minimalist RTOS for Cortex-M written in C

#18
post #4
post #3

I have no practical insight on RTOS in general, if anyone bothers to give me a hint, please. From all what I've looked into, RTOS does mean to create software systems that are almost perfectly predictable and safe to execute. Predictable latency, runtime and memory usage, plus maybe side channels to do the unpredictable stuff in between. It's actual rocket science, as no systemic mistakes are allowed. The confusion i…

You're probably thinking of a hard real-time RTOS with time slices and WCET constraints. For soft real-time, you basically only need low latency. Threads with priorities, synchronization primitives and some way of handling interrupts is generally considered good enough. From the description, this sounds like the kind of RTOS that runs most embedded RT applications currently if perhaps a bit heavier in features than t…

The distinction between hard and soft RTOS explains my confusion. Thanks for the heads up!

Re: Show HN: TinyOS – A minimalist RTOS for Cortex-M written in C

#20
post #10

Question: Do you mean real time, meaning there is some kind of expectation of task switching time, nothing can stop other threads from executing, etc; or do you really mean embedded?

It doesn't implement task switching at all...
Post reply on HN