LibreRTOS Portable single-stack RTOS
C

README.md

LibreRTOS

by Djones A. Boni

LibreRTOS is a portable single-stack Real Time Operating System.

Provides preemptive, cooperative and hybrid kernel modes. In hybrid mode only higher priority tasks can cause a preemption.

All tasks share the same stack. This allows a large number of tasks to be created even on RAM constrained projects.

Tasks must run to completion and also must hold its state into static memory.

Interrupts that use LibreRTOS API must lock the scheduler at the beginning and unlock before returning.

Features

  • Single-stack
  • Preemptive, cooperative or hybrid kernel
  • Software timers (one-shot, periodic, no-period)
  • Semaphore
  • Queue (message queue)
  • Fifo (character queue)
  • Mutex (no priority inheritance mechanism)
  • Documentation is in the source files

How to use LibreRTOS

LibreRTOS uses only standard C and can be used in any architecture.

User must provide two things:

1) A projdefs.h file, which defines LibreRTOS configurations and basic macros for interrupts and critical section management. For examples look at port/projdefs_*.h

2) A periodic tick interrupt.

Below there is a simple initialization template. For a complete and working example take a look in our AVR example.

#include "LibreRTOS.h"

void Timer_Interrupt(void)
{
    OS_tick();
}

int main(void)
{
    /* Initialize LibreRTOS data structures. */
    OS_init();

    /* Start timer */
    /* Initialize peripherals */
    /* Create tasks */

    /* Start scheduler. */
    OS_start();

    /* Run scheduler. */
    for(;;)
    {
        OS_scheduler();
    }
}

Contributing to LibreRTOS

If you have suggestions for improving LibreRTOS, please open an issue or pull request on GitHub.

Licensing

You can use LibreRTOS both for closed- and open-source projects. You are also free to keep changes to yourself. However we'll enjoy your improvements and suggestions. :-)

You are free to copy, modify, and distribute LibreRTOS with attribution under the terms of the Apache License Version 2.0. See the doc/LICENSE file for details.

Important files

README.md Fast introduction (this file).

doc/LICENCE Complete license text.

doc Documentation and examples.