stm8-multi-tasker logo

stm8-multi-tasker

Free

STM8-Multi-Tasker - Preemptive/Cooperative Round Robin Scheduler for STM8

FreeFree tier
Type
Open Source

About stm8-multi-tasker

STM8-Multi-Tasker is a tiny preemptive/cooperative round robin scheduler for STM8 microprocessors, implemented in mixed C and assembler using the SDCC compiler. It features stack-based context switching, circular linked list queues, mutexes, semaphores, timers, events, and global state preservation options. The core is written in assembler to reduce code size, and with all features enabled it clocks in just over 1k of code with low data usage. However, the project is marked as unstable and broken (version 0.0) and not ready for use. It is designed for use with CMake and JetBrains CLion IDE, and includes limitations such as interrupts being disabled during library calls, which increases interrupt response latency.

Key Features

Preemptive and cooperative round robin scheduling
Stack-based context switching
Circular linked list queues and nodes
Mutex, semaphore, queue, timer, and event support
Global state preservation option for non-reentrant functions
Core written in assembler for minimal code size (just over 1k with all features)
Low RAM usage: 34 bytes data + 8 bytes per task + task stack
Uses SDCC compiler and CMake build system

Pros & Cons

Pros
  • Very small code footprint (just over 1k) suitable for limited flash memory
  • Low data memory overhead (34 bytes base + minimal per task)
  • Supports both preemptive and cooperative scheduling modes
  • Includes synchronization primitives (mutexes, semaphores, queues)
  • Built-in timer and event handling
  • Core in assembler optimized for size
Cons
  • Currently marked as unstable and broken (version 0.0) – not production ready
  • Interrupts disabled during library calls, increasing latency
  • Assembly routines assume default SDCC caller-saves register convention – not easily portable
  • Requires specific toolchain (SDCC, CMake, CLion) for setup
  • Limited documentation and support

Best For

Embedded systems development on STM8 microcontrollersMulti-threading in resource-constrained environmentsReal-time cooperative task managementPrototyping and learning scheduler internals

FAQ

What is the current status of STM8-Multi-Tasker?
The project is marked as 'Not Ready In Development Status: Broken Do Not Use Yet' with version 0.0, indicating it is unstable and not suitable for production use.
What compilers and IDEs are supported?
It is implemented with the SDCC compiler and uses CMake with JetBrains CLion IDE. Instructions for setup are still TODO.
What synchronization primitives are provided?
The library includes mutexes, semaphores, queues (circular linked lists), timers, and events.
What is the memory footprint?
With all features enabled, the scheduler uses just over 1k of code, 34 bytes of data, plus 8 bytes per task and each task's stack size.
Are there any limitations with interrupts?
Interrupts are disabled during library calls, which increases interrupt response latency. Also, non-reentrant functions called with interrupts enabled need protection via mutexes or global state preservation.