An open API service indexing awesome lists of open source software.

https://github.com/patrislav1/coop-sched

A minimalistic context switcher for cooperative multitasking
https://github.com/patrislav1/coop-sched

baremetal cooperative-multitasking cortex-m cortex-m4 embedded embedded-systems scheduler

Last synced: about 2 months ago
JSON representation

A minimalistic context switcher for cooperative multitasking

Awesome Lists containing this project

README

        

# coop-sched

A minimalistic scheduler / context switcher to facilitate cooperative multitasking on ARM Cortex-M.

## Why?

Sometimes a bare-metal embedded system grows too complex to fit into a simple single-threaded `while (1)` loop pattern, but at the same time not complex enough to justify adding a full-blown RTOS. Sometimes it's also necessary to add a modicum of concurrency to are large legacy codebase, but without introducing the extra complexity of preemptive task switching and multithreading, and their associated pitfalls (like race conditions). Finally, for extremely space-constrained applications (e.g. bootloaders) the smallest and least complex solution is desirable.

## Size

The whole project is less than 250 lines of code, and compiled size is significantly less than 1K (current version takes up 611 bytes when compiled with `-Os`).

## Dependencies

`coop-sched` only needs standard, low-level CMSIS functions / definitions which are usually bundled with the MCU vendor's libraries. `platform.h` includes these MCU-specific headers - to support new MCUs, this file has to be extended, but `coop_sched.c` should not need to change.

## Supported MCUs

At the moment, MCUs based on Cortex-M3 and -M4 (both with and without FPU) are supported. ATSAM4L, STM32L433 and STM32F103 are supported out of the box; more MCUs will be added in the future.

## TODO

Add support for other cores such as Cortex-M0 and -M7.