{"id":28452537,"url":"https://github.com/surban/openemc","last_synced_at":"2026-04-01T20:27:12.613Z","repository":{"id":102297307,"uuid":"543629920","full_name":"surban/openemc","owner":"surban","description":"OpenEMC: open embedded management controller","archived":false,"fork":false,"pushed_at":"2026-03-29T22:36:14.000Z","size":869,"stargazers_count":24,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2026-03-30T00:58:05.626Z","etag":null,"topics":["adc","bootloader","bq25713","driver","embedded-controller","firmware","gpio","gpio-extender","linux","max14636","pwm","rtc","rust","stm32","stm32f1","stusb4500","usb-pd","watchdog"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/surban.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-09-30T14:04:22.000Z","updated_at":"2026-03-29T22:36:18.000Z","dependencies_parsed_at":"2023-11-15T23:27:00.612Z","dependency_job_id":"b88cd965-a3a8-481c-9c30-5e16876482d0","html_url":"https://github.com/surban/openemc","commit_stats":{"total_commits":101,"total_committers":1,"mean_commits":101.0,"dds":0.0,"last_synced_commit":"f30c3645c8a9b416c81f3c2adff7442df70b4a11"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"purl":"pkg:github/surban/openemc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surban%2Fopenemc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surban%2Fopenemc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surban%2Fopenemc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surban%2Fopenemc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/surban","download_url":"https://codeload.github.com/surban/openemc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surban%2Fopenemc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31291619,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adc","bootloader","bq25713","driver","embedded-controller","firmware","gpio","gpio-extender","linux","max14636","pwm","rtc","rust","stm32","stm32f1","stusb4500","usb-pd","watchdog"],"created_at":"2025-06-06T18:11:42.777Z","updated_at":"2026-04-01T20:27:12.599Z","avatar_url":"https://github.com/surban.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OpenEMC\n\nOpenEMC is an open-source firmware implementing an embedded management\ncontroller (EMC) on an STM32F1 microcontroller.\nIt consists of a bootloader and firmware (both written in Rust) and\nLinux kernel driver modules (written in C).\n\n[![Build](https://github.com/surban/openemc/actions/workflows/build.yml/badge.svg)](https://github.com/surban/openemc/actions/workflows/build.yml)\n\n## Features\n\nThe following features are implemented:\n\n  - communication with the host over I2C and one interrupt line\n  - field-upgradable firmware\n  - full logging to host over I2C in production system\n  - power control: system on/off, restart, optional power on when external power supplied\n  - watchdog\n  - real-time clock (RTC) with alarm and system wake-up\n  - GPIO with interrupts\n  - pin control\n  - analog digital converter (ADC)\n  - fully customizable board communication (read, write, ioctl) with Linux userspace via device file\n  - battery charger (BQ25713)\n  - external power supply with USB PD (STUSB4500) and USB charger detector (MAX14636)\n  - charging mode with system power off\n  - Linux pstore (persistent storage) integration for kernel panic logs\n  - configuration storage in flash memory\n  - full devicetree integration\n\nDue to its open-source nature, modular design and usage of the Rust programming\nlanguage, OpenEMC is easy to extend and adapt to a wide variety of boards\nand applications.\n\n## Commercial Licensing and Support\n\nWhile OpenEMC is open-source, we offer commercial licenses, professional support, and custom development services for businesses that require a robust, production-ready solution without the obligations of the GPLv3 license. A commercial license allows you to keep your hardware-specific modifications private.\n\n**[Learn more about our commercial offerings and contact us for a quote.](mailto:openemc@surban.net)**\n\n## Evaluation and development\n\nThe easiest method to evaluate and hack on OpenEMC is to get an STM32F103\nNucleo-64 board ([NUCLEO-F103RB]) and connect its I2C bus (SCL, SDA) and D12 pin (IRQ)\nto a Raspberry Pi or similar board.\n\nBootloader flashing can be performed using the STLink embedded on the board and requires no additional hardware.\n\nLinux drivers have been tested with Linux v5.19.\n\n[NUCLEO-F103RB]: https://www.st.com/en/evaluation-tools/nucleo-f103rb.html\n\n## Building\n\n### Requirements\n\nFor building the firmware your machine must have the following things installed:\n\n  - a recent enough stable Rust toolchain (install from https://rustup.rs),\n  - Rust target thumbv7m-none-eabi (`rustup target add thumbv7m-none-eabi`),\n  - Rust LLVM utils (`rustup component add llvm-tools-preview`),\n  - on Rust nightly: Rust source (`rustup component add rust-src`)\n  - Cargo binutils (`cargo install cargo-binutils`),\n  - STLINK tools (from https://github.com/stlink-org/stlink or your Linux distribution),\n  - for development: probe-run (`cargo install probe-rs-tools`).\n\nFor building the Linux kernel drivers the kernel headers and `gcc` are required.\nThe kernel must have support for devicetree enabled.\n\n### Building the firmware image\n\nTo build both the bootloader and main firmware, run:\n\n    cargo xtask \u003cBOARD_NAME\u003e\n\nThey will be placed into the `image` directory.\nHere `\u003cBOARD_NAME\u003e` specifies the name of the board; see `openemc-bootloader/src/boards` for a list\nof supported boards. If no board is specified a generic board image will be generated.\n\nThis crates four files:\n\n  - `openemc_bootloader_*.bin` is the bootloader image and should be flashed onto the device,\n  - `openemc_*.emc` is the main firmware and should be placed into the `/lib/firmware`\n    directory on the target device, where it will be picked up by the driver and\n    sent to the device,\n  - `*.elf` are ELF images of the firmware and used for formatting of log messages;\n    they should be placed in `/lib/firmware` on the target device if logging is used.\n\n### Flashing the bootloader image\n\nConnect the STM32 to your computer using an (integrated) STLink USB adapter.\nUse `st-flash` from STLINK tools to flash the bootloader image:\n\n    st-flash --connect-under-reset write image/openemc_bootloader_*.bin 0x8000000\n\n### Building the kernel driver\n\nRun `scripts/driver-build.sh` to build the drivers as kernel modules.\nYou can install them using `scripts/driver-install.sh`.\n\n### Logging\n\nReading logs over I2C and forwarding to syslog is done by `openemc-log`,\nwhich should be built for and placed on the target device.\nExample files for systemd integration are located in the `systemd` directory.\n\n### Devicetree\n\nThe driver will only be loaded if it is referenced in the system's devicetree.\nExamples are provided in the `devicetree` directory.\nUse `scripts/devicetree-build.sh` to build them and `scripts/devicetree-load.sh`\nto dynamically load a devicetree overlay into a running system.\n\n## Firmware size considerations\n\nWhen using a nightly Rust toolchain the `core` crate is built along with the firmware and optimized\nfor small size.\nThis saves about 2 kBytes of flash memory space.\n\n## Development and testing\n\nFor development and testing, both the bootloader and main firmware can be flashed\nand executed directly by invoking\n\n    OPENEMC_BOARD=\u003cBOARD_NAME\u003e DEFMT_LOG=info cargo run --release -- --connect-under-reset\n\nfrom the respective directory. Set the environment variable `DEFMT_LOG` your desired log level.\n\n## Board IO and ioctl\n\nOpenEMC allows direct communication between Linux userspace and board-specific code.\nFor this purpose the device `/dev/openemc` is provided, which supports reading, writing, polling\nand ioctls.\nCorresponding to these operations the board-specific functions `Board::io_read`, `Board::io_write` and\n`Board::ioctl` are called.\nAn example is provided in the board file `stm_nucleo_f103rb.rs` together with the host-side code\nin `board-io-test`.\n\n\n## License\n\nThe OpenEMC firmware is released under the [GNU GPL version 3],\nmeaning that you must release the full source code of your modifications\nif you adapt OpenEMC to your application and/or board.\n\nThe OpenEMC drivers are released under the [GNU GPL version 2] or later,\nfollowing the standard license of the Linux kernel.\nThis also requires you to publish all changes you make to the OpenEMC drivers.\n\n[GNU GPL version 2]: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt\n[GNU GPL version 3]: https://www.gnu.org/licenses/gpl-3.0.txt\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurban%2Fopenemc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurban%2Fopenemc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurban%2Fopenemc/lists"}