TNeo: a well-formed and carefully tested preemptive real-time kernel for 16- and 32-bits MCUs
C C++ Assembly Makefile Shell Objective-C Other

TNeo: a real-time kernel (RTOS)

TNeo is a compact and fast real-time kernel for embedded 32/16 bits microprocessors. It performs a preemptive priority-based scheduling and a round-robin scheduling for the tasks with identical priority.

You might want to read an article: How I ended up writing new real-time kernel.

TNeo was born as a thorough review and re-implementation of TNKernel v2.7. The new kernel has well-formed code, inherited bugs are fixed as well as new features being added, it is well documented and tested carefully with unit-tests.

Currently it is available for the following architectures:

  • ARM Cortex-M cores: Cortex-M0/M0+/M1/M3/M4/M4F (supported toolchains: GCC, Keil RealView, clang, IAR)
  • Microchip: PIC32/PIC24/dsPIC

Comprehensive documentation is available in two forms: html and pdf.

Index of all available docs can be found here.

Documentation is generated by means of doxygen.

This project was initially a fork of PIC32 TNKernel port by Anders Montonen. I don't like several design decisions of original TNKernel, as well as many of the implementation details, but Anders wants to keep his port as close to original TNKernel as possible. So I decided to fork it and have fun implementing what I want.

The more I get into how TNKernel works, the less I like its code. It appears as a very hastily-written project: there is a lot of code duplication and a lot of inconsistency, all of this leads to bugs. More, TNKernel is not documented well enough and there are no unit tests for it, so I decided to reimplement it almost completely. Refer to the page Why reimplement TNKernel for details.

I decided not to care too much about compatibility with original TNKernel API because I really don't like several API decisions, so, I actually had to choose new name for this project, in order to avoid confusion, hence "TNeo". Refer to the Differences from TNKernel API page for details.

Together with almost totally re-writing TNKernel, I've implemented detailed unit tests for it, to make sure I didn't break anything, and of course I've found several bugs in original TNKernel 2.7: refer to the section Bugs of TNKernel 2.7. Unit tests are, or course, a "must-have" for the project like this; it's so strange but original TNKernel seems untested.

Note that PIC32-dependent routines (such as context switch and so on) are originally implemented by Anders Montonen; I examined them in detail and changed several things which I believe should be implemented differently. Anders, great thanks for sharing your job.

Another existing PIC32 port, the one by Alex Borisov, also affected my project a bit. In fact, I used to use Alex's port for a long time, but it has several concepts that I don't like, so I had to move eventually. Nevertheless, Alex's port has several nice ideas and solutions, so I didn't hesitate to take what I like from his port. Alex, thank you too.

And, of course, great thanks to the author of original TNKernel, Yuri Tiomkin. Although the implementation of TNKernel is far from perfect in my opinion, the ideas behind the implementation are generally really nice (that's why I decided to reimplement it instead of starting from scratch), and it was great entry point to the real-time kernels for me.

I would also like to thank my chiefs in the ORION company, Alexey Morozov and Alexey Gromov, for being flexible about my time.

For comprehensive information, refer to the documentation (see links at the top of this page)

If you have any comments, feel free to leave them at