Post Go back to editing

8051 core Free RTOS

Hi there everyone, 

For those who might be interested, i made an free opensource RTOS for the 8051 family of processors (ADuC84x included). I used the free SDCC compiler in order to compile the source codes, which is a great free tool for those who can't afford Keil IDE. The RTOS contains the following features: 

1 - Full preemptive round robin schedule based on time slicing; 

2 - Synchronism tools such as mutexes and semaphores; 

3 - Low memory and code footprints. 

It's still in it's first release and a lot of work can be done on the kernel in terms of features code otimizations, but still it's a great tool for those who need some RTOS and can't pay for the comercial solutions. 

The source codes are available on my github repository, link bellow.

Parents Reply Children
  • Hi! 

    Well, that depends a lot on the OS configurations you set up. If you take a look on the source code files you'll notice there's a few macros that control some OS parameters such as number of threads, number of time interrupts for the time slice, etc... 

    You can even take a look on the processor datasheet and set the Timer SFR in order to obtain smaller periods for the timer interruption. 

    In that scenario (reading/writing a pin) you'll probably use instructions that take something like one or two processing cycles, so with that and having in mind the clock frequency you can acuratelly know how long your task takes to execute. 

    If you want to know exactly the behaviour of your application, it's recomended to take a look on the .asm files that the compiler is generating. It takes a little work around, since you need to understand the assembly language, but it's the ideal way to design your product when time constraints are really important. 

    i would recommend you to set the SCH_TIMEOUT on a low integer value. I think that in your scenario, something like 1 or 2 is great and will work out well. 

    If you still have some questions feel free to reply me or even contact me via email ( We can schedule a call. 



  • Yeah I understand, but from an expert's perspective can't you give a very rough ballpark figure ?  On a ADuC84x with Free RTOS at full speed and a very trivial main program with an even more trivial (but faaaast) ticker. Ticker would,for instance, just read a pin and write it to another pin as fast as possible.  This is a bit of a theoretical question of course , but are we talking hundreds of ticks, thousands of ticks or ten thousands of ticks per second ?

  • When we talk about using RTOS's you don't use a main program or method, you'll have just a bunch of threads. With that in mind, if you're on a 12MHz crystal frequency and have really small tasks to be done on each thread, houndreds of ticks should do the work. 

    Remember that as you add maths to the code, mainly with floating point variables, you'll have tasks that need more time to be executed, otherwise they'll be preempted all the time! 

    Anyway, figuring out a scenario with only reads and writes on the processor ports, without any serial communications or even extensive memory address manipulations you can use hundreds of ticks and everything will work out well. 

    Important note 1: Actually the ISR is configurated to a 1ms tick on the ADuC847. If you want to achieve higher scheduling frequencies, you'll need to change the SFR's values. I DO NOT RECOMEND THAT, UNLESS YOU REALLY KNOW WHAT YOU ARE DOING! Otherwise, this may lead to several performance issues! 

    Important note 2: At this point, the OS doesn't have any support to blocking delay functions, not even precise delay functions. If you want to put a precise delay on some task you'll need to create a method like schDelayTask(). In future updates i'll add such functions!