13 comments

  • m132 2 hours ago
    The README mentions ARMv7-M, RISC-V, and AVR, but no actual SoCs or boards, and the source code contains unconditional inline assembly for Arm. Similarly, there are measurements of context switch time on RISC-V, while the scheduler is one big stub that doesn't even enter a task, only returns from itself using Arm-specific assembly [0]. The examples rely on this scheduler never returning, so there's no way any of them can run [1]. The bootloader is also a stub [2]. Not a single exception vector table, but plenty of LLM-style comments explaining every single line.

    Others (well, two people really) have also noted the lack of a linker script, start-up code, and that the project doesn't even build.

    82 points at the time of writing, which is 4 hours from the post's submission. Already on the main page. The only previous activity of the author? Two other vibe-coded projects of similar quality and a few comments with broken list formatting, suggesting that they were never even reviewed by a human prior to posting.

    Does anybody read past the headline these days? Had my hopes higher for this site.

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

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

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

    • mbernstein 1 hour ago
      HN used to provide a really high signal to noise ratio for me, but it's degrading pretty quickly. There are new accounts below saying "hey I just learned what RTOS means, thanks!"

      I reflexively reload HN many times per day, but I'm wondering if I need a walled garden with some sort of curation of individuals - which sucks - to get the signal level I want.

      • Retr0id 1 hour ago
        I wish HN upvote data was public, I feel like I could build some kind of improved algorithm that reduces the vote weight of people who upvote slop.
    • Retr0id 1 hour ago
      Don't forget the 71 stars on github, and counting!
      • m132 1 hour ago
        Oh wow, was 60 just a while ago. Guess the dead Internet theory is no longer just a theory.
  • hpscript 7 hours ago
    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: - Implementing context switching correctly - Designing a minimal but usable scheduler - Keeping the codebase simple and readable

    I’d really appreciate feedback, especially on: - Architecture design - Scheduler implementation - Code structure

    GitHub: https://github.com/cmc-labo/tinyos-rtos

    • maximusdrex 3 hours ago
      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.
      • Retr0id 3 hours ago
        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)

        • maximusdrex 11 minutes ago
          Yeah, I read that note and stopped looking further. I was hoping that maybe the hardware-specific code was in a different project and just wanted to be nice in case. I just don’t get the point of making AI slop out of something like a toy RTOS, which is inherently a learning project more than anything else. There’s nothing even fun about doing it if you won’t even try to get it to run on an STM32 or something.
    • bahmboo 6 hours ago
      Impressive! Very complete on first glance. You might want to soften or qualify the RTOS statement so people focus on its compactness and low latency. As you are already seeing in the comments the RTOS aspect has a lot of opinions depending on what one is trying to accomplish.
    • peteforde 5 hours ago
      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.

    • m132 2 hours ago
      > Runs on (your target hardware or environment)

      Nice try, OpenClaw

    • Retr0id 2 hours ago
      Did you never even try compiling it?
  • nofunsir 6 hours ago
    What ever happened to μC/OS?

    Seemed both well documented and well suited to have taken over for the current MCU explosion. I almost never see anyone talk about it.

    Looks like it open-sourced in 2020.

    https://github.com/weston-embedded

  • jockm 5 hours ago
    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?
    • Retr0id 2 hours ago
      It doesn't implement task switching at all...
  • throwawaypath 1 hour ago
    Interesting this kernel implements kernel message queues, which are almost never used out in the wild. Are there any examples of popular software projects that use POSIX/SysV message queues?
  • tvst 3 hours ago
    I thought this was about UC Berkeley's TinyOS: https://github.com/tinyos/tinyos-main

    This was a big deal in some academic circles in the early 2000s

  • synergy20 3 hours ago
    this reminds me of: https://github.com/tinyos/tinyos-main more than one decade ago
  • onetimeusename 4 hours ago
    How much of this was by AI?
    • Retr0id 2 hours ago
      It doesn't even compile, the whole thing is evidently built on vibes.
      • bahmboo 1 hour ago
        It doesn't compile for you or doesn't compile at all? Honest question. It's a nice project in the face of it but if it's all AI fever dreams that would be disappointing. I don't have the cycles to try it out right now.
        • Retr0id 1 hour ago
          It won't compile for anyone, it's not a real software project.
  • nurettin 1 hour ago
    There is already a TinyOS in the sensor networks space. I've used it with MicaZ motes over a decade ago.

    https://github.com/tp-freeforall/prod

  • jaylew1997 52 minutes ago
    Thanks for sharing
  • Yokohiii 6 hours ago
    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 is that this project doesn't mention any of it. Is it just hijacking of a fancy acronym, are there two worlds side by side or am I completely misled?
    • jtrueb 6 hours ago
      RTOS can be used a lot looser than you describe. Like a build system, scheduling, and interrupt framework that allows you to program an MCU like you describe. Zephyr RTOS and Free RTOS provide easy enough ways to write code that uses blocking APIs but probably runs your code according to the timing constraints if you hold it right. As an alternative, you could write for “bare metal” and handle the control flow, scheduling, interrupting, etc. yourself. If you are writing to “random” addresses according to some datasheet to effect some real world change, you are probably reaching for an RTOS or bare metal unless you are writing OS driversn. If you look at the linux drivers, you will see a lot of similarities to the Zephyr RTOS drivers, but one of them is probably clocking in the MHz while the other in the GHz
    • joshvm 1 hour ago
      RTOS doesn't give any guarantees about "safe to compute/execute" - that's more the domain of formal verification. In the sense that you can make guarantees about how the program will behave given some domain of inputs. But predictable (or bounded) latency, yes.

      You might execute formally verified code within an RTOS, which is your two worlds? Consider you have some critical control loop, like an autopilot (see Ardupilot). That control loop must run at some minimum rate, and the action of the system must be well characterized. Similarly you might want to guarantee that you sample a bunch of sensors frequently enough (so the most recent reading is no older than some time period).

    • peteforde 5 hours ago
      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.

    • avadodin 6 hours ago
      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 the average with filesystem and networking support.

      • Yokohiii 3 hours ago
        The distinction between hard and soft RTOS explains my confusion. Thanks for the heads up!
      • brcmthrowaway 2 hours ago
        Can someone explain this whole boondoggle with RTOS and latency means in practice?

        Why would someone make a context switch HIGH latency? That defeats the purpose.

        • Yokohiii 1 hour ago
          Not sure what you are referring to, no one said that?
    • sublinear 6 hours ago
      > It's actual rocket science, as no systemic mistakes are allowed

      Lots of everyday stuff is running on bare metal code that exceeds so-called "real time" requirements without an OS at all, and those programmers are definitely not rocket scientists! :)

  • mc7alazoun 6 hours ago
    I've learnt something new: RTOS stands for Real-Time Operating System. Thanks for sharing; your README is top-notch!
  • ryguz 1 hour ago
    [dead]