modm (pronounced like dial-up "modem") is a toolbox for building custom C++17 libraries tailored to your embedded device. modm generates startup code, HALs and their implementations, communication protocols, drivers for external devices, BSPs, etc… in a modular, customizable process that you can fine-tune to your needs.
- This project has a homepage.
- Check out our install instructions and our getting started guide.
- Feast your eyes on lots of working examples.
- Our CI checks every contribution for regressions:
- We care about testing modm.
This project also has a technical blog to document larger design concepts.
- You found a bug? Open up an issue, we don't bite.
- You want to contribute? Read the contribution guidelines and open a pull request.
modm is optimized for the harsh requirements of the Eurobot competition, where our robots need to run reliably and completely autonomously for the game's 100 second duration. Our robots contain a lot of different microcontrollers, some without a lot of resources, so modm needs to fulfill a diverse set of objectives, like small code size with small memory consumption, predictable program flow, extreme portability.
The source code is freely available under the MPLv2 license, so feel free to fork this project and adapt it to your needs. The only thing we ask of you is to contribute your changes back so everyone benefits.
Please clone modm recursively, you will need all the submodules.
git clone --recurse-submodules https://github.com/modm-io/modm.git
- Efficient and fast object-oriented C++17 API.
- Support for hundreds of AVR and ARM Cortex-M microcontrollers from Atmel and ST.
- Build system agnostic: We use SCons by default, but you don't have to.
- Data-driven HAL generation using the library-builder engine.
- No memory allocations in HAL with very low overall RAM consumption.
- Highly-configurable modules with sensible defaults and lots of documentation.
- Cross platform peripheral interfaces incl. bit banging:
- GPIO and GPIO expanders.
- ADC and Analog.
- UART, I2C, SPI, CAN.
- Interfaces and drivers for many external I2C and SPI sensors and devices.
- Debug/logging system with IOStream interface.
- Lightweight, stackless threads and resumable functions using cooperative multitasking.
- Useful filter, interpolation and geometric algorithms.
- Lightweight unit testing system (suitable for AVRs).
- Graphical user interface for small binary and color displays.
- Hundreds of tests to ensure correct functionality.
modm can generate code for 76 AVR and 886 STM32 devices, however, there are different levels of support and testing.
Device Family | Support | Device Family | Support |
---|---|---|---|
AVR | ★★★ | STM32F3 | ★★★★★ |
STM32F0 | ★★★★ | STM32F4 | ★★★★★ |
STM32F1 | ★★★★ | STM32F7 | ★★★★ |
STM32F2 | ★★★ | STM32L4 | ★★★★ |
All of these targets are compiling and booting correctly (★) and have GPIO and UART working (★★). Most targets have support for basic peripherals, like I2C, SPI and ADC (★★★) as well as complicated peripherals, like Timers, CAN and external memory (★★★★). We also use a few targets in everyday development, which are very well tested (★★★★★).
We are only a small team of developers and are limited in the amount of targets we can support and test in hardware. We have prepared, but currently not finished support for STM32F2, STM32L0 and STM32L1. Open an issue to ask if your specific target is supported out-of-the-box and what you can do if it's not.
We have out-of-box support for several development boards including documentation.
AL-AVREB-CAN | Arduino Uno | Black Pill | Blue Pill |
DISCO-F051R8 | DISCO-F072RB | DISCO-F100RB | DISCO-F303VC |
DISCO-F407VG | DISCO-F429ZI | DISCO-F469NI | DISCO-F746NG |
DISCO-F769NI | DISCO-L476VG | NUCLEO-F031K6 | NUCLEO-F042K6 |
NUCLEO-F103RB | NUCLEO-F303K8 | NUCLEO-F401RE | NUCLEO-F411RE |
NUCLEO-F429ZI | NUCLEO-L432KC | NUCLEO-L476RG | OLIMEXINO-STM32 |
STM32F030F4P6-DEMO |
We also have a number of completely target-independent drivers for external devices connected via I2C, SPI, UART, BitBang, etc. Most of these also give you access to the entire device so you can easily configure them for you specific needs.
AD7280A | AD7928 | ADNS9800 | ADS7843 | AMS5915 | SPI-FLASH |
BME280 | BMP085 | DRV832X | DS1302 | DS1631 | DS18B20 |
EA-DOG | FT245 | FT6X06 | HCLAx | HD44780 | HMC58x |
HMC6343 | I2C-EEPROM | ITG3200 | L3GD20 | LAWICEL | LIS302DL |
LIS3DSH | LM75 | LSM303A | LTC2984 | MAX6966 | MAX7219 |
MCP23X17 | MCP2515 | NOKIA5110 | NRF24 | TFT-DISPLAY | PAT9125EL |
PCA8574 | PCA9535 | PCA9548A | PCA9685 | SIEMENS-S65 | SIEMENS-S75 |
SSD1306 | TCS3414 | TCS3472 | TMP102 | TMP175 | VL53L0 |
VL6180 |
Please see our examples for a complete list of tested targets and drivers.
The easiest way for you and the best way for us to see if something is unclear or missing, is if you use the library and give us some feedback by filing a bug report or if you have a fix already, opening a pull request.
See CONTRIBUTING.md for our contribution guidelines.
The modm project is maintained by Niklas Hauser (@salkinium) with significant contributions from Sascha Schade (@strongly-typed), Fabian Greif (@dergraaf), Kevin Läufer (@ekiwi), Martin Rosekeit (@thundernail), Daniel Krebs (@daniel-k), Georgi Grinshpun (@georgi-g) and 20 more contributors.
- examples
- Example projects that show the usage of parts of the modm library. These projects are always up to date and are tested to compile by our CI.
- src
- This folder contains the actual source code of modm grouped into several modules.
- test
- Contains hundreds of tests for making sure modm works the way we expect it to.
- docs
- General documentation about this library and how to use it.
- ext
- Third-party code used in this library.
- tools
- Support tools, scripts and files.