- Notifications
You must be signed in to change notification settings - Fork149
modm: a C++23 library generator for AVR and ARM Cortex-M devices
License
modm-io/modm
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
modm (pronounced like dial-up "modem") is a toolbox forbuilding custom C++23 libraries tailored to your embedded device.modm generates startup code, HALs and their implementations, communicationprotocols, drivers for external devices, and BSPs in a modular, customizableprocess that you can fine-tune to your needs.
- This project has a homepage.
- Install the toolchain andexplore our examples.
- You candiscover the modm library in more detail.
- Easily start yourown completely custom project.
- Our CI checks every contribution for regressions.
- We careabout testing modm.
- API reference is available here.
- We do quarterly releases with acurated changelog.
This project also has aforum for discussions and atechnical blog to document larger design concepts.
- You found a bug?Open up an issue, we don't bite.
- You have a question?We probably have an answer.
- You require a feature?Write it down to get things rolling.
- You want to contribute?Read the contribution guidelines andopen a pull request.
modm is optimized for the harsh requirements of theEurobot competition,where our robots need to run reliably and completely autonomously for the game's100 second duration. Our robots contain a lot of different microcontrollers, somewithout 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 library source code is licensed as MPLv2 with any external source code undercompatible licenses (BSD, Apache2, MIT). So feel free to fork this project andadapt it to your needs. The only thing we ask of you is to contribute your changesback so everyone can benefit.
Please clone modm recursively, you need all the submodules:
git clone --recurse-submodules --jobs 8 https://github.com/modm-io/modm.git
- Efficient and fast object-oriented C++23 API.
- Support for thousands of AVR and ARM Cortex-M microcontrollers from Microchip, STMicroelectronics and Raspberry Pi.
- Build system agnostic: Choose SCons, CMake, Makefile or use your own.
- Modular, data-driven, target-specific HAL generation using the lbuild code generator.
- 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, External Interrupt and IO expanders.
- ADC, DAC and Comparators.
- UART, I2C, SPI, CAN and Ethernet.
- Interfaces and drivers for many external I2C and SPI sensors and devices.
- Debug/logging system with IOStream and printf interface.
- Cooperative, stackful fibers and scheduler.
- Functional (partial) libstdc++ implementation for AVRs.
- Useful filter, interpolation and geometric algorithms.
- Lightweight unit testing system (suitable for AVRs).
- Hundreds of tests to ensure correct functionality.
- Integration of useful third-party software:
- FreeRTOS andFreeRTOS+TCP operating system.
- CMSIS andCMSIS-DSP interfaces.
- ETL: Embedded Template Library.
- TinyUSB: USB Host/Device stack.
- FatFS: FAT/exFAT filesystem.
- ROSserial: Embedded ROS client.
- CrashCatcher: Crash reports for HardFaults.
- printf: Small printf implementation.
- Nanopb: Embedded Protocol Buffers.
- LVGL: Embedded Graphics Library.
modm can create a HAL for 3839 devices of these vendors:
- STMicroelectronics STM32: 3034 devices.
- Microchip SAM: 416 devices.
- Microchip AVR: 388 devices.
- Raspberry Pi: 1 device.
Here is a table with all device families and the peripheral drivers they support:
- ✅ Implemented as a software driver in modm.
- ○ Available in hardware but missing a software driver in modm.
- ✕ Unavailable in hardware or device with that peripheral not supported by modm.
Note that this is a summary overview and your specific device may not have allthe peripherals in this table.Pleasediscover modm's peripheral drivers for your specific device.
STM32 | SAM | RP | AT | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Peripheral | C0 | F0 | F1 | F2 | F3 | F4 | F7 | G0 | G4 | H7 | L0 | L1 | L4 | L5 | U5 | D1x D2x DAx | D5x E5x | E7x S7x V7x | G5x | 20 | 90 | Mega | Tiny |
ADC | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ✅ | ✅ | ✅ | ○ | ○ | ○ | ✅ | ✅ | ✅ | ○ | ✅ | ✅ |
CAN | ✕ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✕ | ✅ | ✅ | ✅ | ✕ | ○ | ✅ | ✕ | ✕ | ○ | ○ | ✕ |
Comparator | ✕ | ○ | ✕ | ✕ | ✅ | ✕ | ✕ | ✅ | ✅ | ○ | ○ | ○ | ✅ | ○ | ○ | ○ | ○ | ○ | ✕ | ✕ | ○ | ○ | ○ |
DAC | ✕ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ✅ | ✕ | ✕ | ✕ | ○ | ✕ |
DMA | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ○ | ✅ | ✕ | ✅ | ✕ | ✕ | ✕ |
Ethernet | ✕ | ✕ | ○ | ○ | ✕ | ✅ | ✅ | ✕ | ✕ | ○ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ○ | ○ | ✕ | ✕ | ✕ | ✕ | ✕ |
External Interrupt | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ○ | ✅ | ✅ | ✅ | ✅ |
External Memory | ✕ | ✕ | ✅ | ✅ | ✕ | ✅ | ○ | ✕ | ○ | ○ | ✕ | ✕ | ○ | ○ | ○ | ✕ | ✕ | ○ | ✕ | ✕ | ✕ | ✕ | ✕ |
GPIO | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
I2C | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ✅ | ○ | ✅ | ✅ | ✅ | ✅ |
Internal Flash | ○ | ○ | ✅ | ○ | ○ | ✅ | ○ | ✅ | ✅ | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ○ | ✕ | ✕ | ✕ | ✕ |
IWDG | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ |
Random Generator | ✕ | ✕ | ✕ | ✅ | ✕ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✅ | ✅ | ✅ | ✕ | ○ | ○ | ✕ | ✕ | ✕ | ✕ | ✕ |
RTC | ✅ | ✅ | ○ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ○ | ○ | ○ | ✕ | ✕ | ✕ |
SPI | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ○ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
System Clock | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✕ | ✕ |
Timer | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ○ | ✅ | ✅ | ○ | ○ | ○ | ○ |
UART | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ |
Unique ID | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ | ✕ |
USB | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ✅ | ✅ | ✕ | ✕ | ✕ |
We are only a small team of developers and are limited in the amount of deviceswe can support and test in hardware.Open a discussion to ask ifyour specific device is supported out-of-the-box and how you can add it otherwise.
We have out-of-box support for many development boards including documentation.
We also have a number of completely target-independent drivers for externaldevices connected via I2C, SPI, UART, BitBang, etc. Most of thesealso give you access to the entire device so you can easily configure them foryour specific needs.
Please seeour 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 unclearor missing, is if you use the library and give us some feedback byfiling a bugreport or if you have a fix alreadyopening a pull request.
SeeCONTRIBUTING.md for our contribution guidelines.
The modm project is maintained byNiklas Hauser (@salkinium),Raphael Lehmann (@rleh), andChristopher Durand (@chris-durand) with significant contributions fromSascha Schade (@strongly-typed),Fabian Greif (@dergraaf),Kevin Läufer (@ekiwi),Martin Rosekeit (@thundernail),Daniel Krebs (@daniel-k),Georgi Grinshpun (@georgi-g),David Hebbeker (@dhebbeker),Thorsten Lajewski (@TheTh0r),Mike Wolfram (@mikewolfram),andmany 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.
About
modm: a C++23 library generator for AVR and ARM Cortex-M devices