# modm **Repository Path**: wangxinyv/modm ## Basic Information - **Project Name**: modm - **Description**: No description available - **Primary Language**: C - **License**: MPL-2.0 - **Default Branch**: develop - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-01-02 - **Last Updated**: 2025-01-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # modm: a barebone embedded library generator
modm (pronounced like dial-up "modem") is a toolbox for building custom C++23 libraries tailored to your embedded device. modm generates startup code, HALs and their implementations, communication protocols, drivers for external devices, and BSPs in a modular, customizable process that you can fine-tune to your needs. - [This project has a homepage](http://modm.io). - [Install the toolchain][install] and [explore our examples][examples]. - You can [discover the modm library][discover] in more detail. - Easily start your [own completely custom project][custom-project]. - Our CI checks every contribution for regressions. - We care [about testing modm][testing]. - [API reference is available here][api-docs]. - [We do quarterly releases][releases] with a [curated changelog][changelog]. This project also has a [forum for discussions][discussions] and a [technical blog][blog] to document larger design concepts. - You found a bug? [Open up an issue, we don't bite][issues]. - You have a question? [We probably have an answer][questions]. - You require a feature? [Write it down to get things rolling][ideas]. - You want to contribute? [Read the contribution guidelines][contrib] and [open a pull request][prs]. modm is optimized for the harsh requirements of the [Eurobot competition][eurobot], 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 library source code is licensed as MPLv2 with any external source code under compatible licenses (BSD, Apache2, MIT). 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 can benefit. Please clone modm recursively, you need all the submodules: ```sh git clone --recurse-submodules --jobs 8 https://github.com/modm-io/modm.git ``` ## Features - 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][] and [FreeRTOS+TCP][] operating system. - [CMSIS][] and [CMSIS-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. ## Microcontrollers 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 all the peripherals in this table. Please [discover modm's peripheral drivers for your specific device][discover].| 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 | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✕ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ○ | ✅ | ✅ | ✕ | ✕ | ✕ |