{"id":18602684,"url":"https://github.com/digint/openmptl","last_synced_at":"2025-04-10T19:31:06.818Z","repository":{"id":81022922,"uuid":"108404917","full_name":"digint/openmptl","owner":"digint","description":"OpenMPTL - C++ Microprocessor Template Library","archived":false,"fork":false,"pushed_at":"2021-05-27T22:10:12.000Z","size":1123,"stargazers_count":19,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-25T03:27:32.972Z","etag":null,"topics":["c-plus-plus","cortex-m3","cortex-m4","cpp11","microcontroller"],"latest_commit_sha":null,"homepage":"https://digint.ch/openmptl","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digint.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"COPYING","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}},"created_at":"2017-10-26T11:54:07.000Z","updated_at":"2022-08-04T08:13:49.000Z","dependencies_parsed_at":"2023-07-11T16:16:08.174Z","dependency_job_id":null,"html_url":"https://github.com/digint/openmptl","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digint%2Fopenmptl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digint%2Fopenmptl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digint%2Fopenmptl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digint%2Fopenmptl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digint","download_url":"https://codeload.github.com/digint/openmptl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248281395,"owners_count":21077423,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["c-plus-plus","cortex-m3","cortex-m4","cpp11","microcontroller"],"created_at":"2024-11-07T02:12:13.415Z","updated_at":"2025-04-10T19:31:06.804Z","avatar_url":"https://github.com/digint.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"Introduction\n============\n\nOpenMPTL is a C++ template library for lowlevel access to\nmicroprocessor registers and peripherals. It provides classes for\ngeneric register access and peripheral resources management, as well\nas a simulation framework. It is fast and deterministic, ideal for\nreal-time operating systems.\n\nKey Features:\n\n  * Simple and comprehensive declaration and usage of microprocessor\n    register classes\n  * Framework for generic resources declaration\n    (e.g. auto-configuration of peripheral enable registers)\n  * Automatic generation of interrupt handler tables from resources\n  * Compile-Time errors on resource conflicts or wrong register access\n  * Supports bit-band access to register bits for faster access times\n  * Simulation framework, showing all lowlevel register access and\n    allowing to implement reactions to specific register bits.\n\n\nOpenMPTL benefits from the C++11 template metaprogramming features, is\nan header-only library and does not depend on RTTI, exceptions or any\nexternal library.\n\nOfficial home page: \u003chttps://digint.ch/openmptl\u003e\n\n\nSupported Architechtures\n========================\n\nOpenMPTL provides generic functionality for the ARM Cortex family, as\nwell as specific implementations for STM32 microcontrollers.\n\n## openmptl-reg-arm-cortex\n\nRegister declarations for many ARM Cortex microcontrollers are\navailable, but not yet streamlined:\n\n\u003chttps://github.com/digint/openmptl-reg-arm-cortex\u003e\n\n\nDocumentation\n=============\n\nThe documentation is provided within the source code. The [API\nReference Documentation] is available for online browsing.\n\n\n**Recommended starting points for high-level usage**:\n\n  * `projects/stm32f4discovery-ledtest/src/ledtest.cpp`\n  * `projects/stm32f4discovery/src/kernel.hpp`\n  * `projects/stm32f4discovery/src/kernel.cpp`\n  * `projects/stm32f4discovery/src/startup.hpp`\n  * `drivers/joystick/stm32f103stk/joystick.hpp`\n\n**Recommended starting points for low-level usage**:\n\n  * `arch/arm/cortex/stm32/common/usart.hpp`\n  * `include/register.hpp`\n  * `include/register_access.hpp`\n\n  [API Reference Documentation]: https://digint.ch/openmptl/doc/api/openmptl/index.html\n\n\n### Example usage (high level)\n\n    #include \u003carch/gpio.hpp\u003e\n    using led_green = mptl::gpio_led\u003c 'D', 12 \u003e;\n    led_green::on();\n\n\n### Example usage (low level)\n\n    #include \u003carch/reg/spi.hpp\u003e\n    using SPIx = SPI\u003c1\u003e;\n    auto reg = SPIx::CR1::load();\n    reg \u0026= SPIx::CR1::SPE::value | SPIx::CR1::CRCNEXT::value | SPIx::CR1::CRCEN::value;\n    SPIx::CR1::store(reg);\n\nA **load()** call results in:\n\n    constexpr volatile T * value_ptr = reinterpret_cast\u003cvolatile T *\u003e(addr);\n    auto reg = *value_ptr;\n\nA **store()** call results in:\n\n    *value_ptr = reg;\n\nWhere:\n\n  * `addr` (constexpr) holds the non-pointer-type address of SPIx::CR1\n  * `T` is the register type (e.g. uint32_t or uint8_t)\n\n\nSimulation Framework\n--------------------\n\nThe simulation framework allows you to run embedded code in a\nsimulated environment. It traces every register access and allows you\nto react on specific bit changes.\n\n### Example (ledtest)\n\n    # cd projects/stm32f4discovery-ledtest\n    # make SIMULATION=1\n    # ./stm32f4discovery-ledtest\n    \u003c...\u003e\n    RCC::CR         ::bitset()    0x00010000   [ ........ .......1 ........ ........ ]\n    [INFO] reacting to RCC::CR::HSEON, by setting RCC::CR::HSERDY\n    RCC::CR         ##bitset()    0x00020000   [ ........ ......1. ........ ........ ]\n    \u003c...\u003e\n    RCC::AHB1ENR    ::bitset()    0x00000008   [ ........ ........ ........ ....1... ]\n    GPIOD::MODER    ::load()      0x00000000   [ 00000000 00000000 00000000 00000000 ]\n    GPIOD::MODER    ::store()     0x01000000   [ 00000001 00000000 00000000 00000000 ]\n    GPIOD::BSRR     ::store()     0x00001000   [ 00000000 00000000 00010000 00000000 ]\n\n### Example (stm32f103stk-demo)\n\n    # cd projects/stm32f103stk-demo\n    # make SIMULATION=1\n    # ../../bin/sim_terminal.sh ./stm32f103stk-demo\n    \u003c...\u003e\n    Welcome to OpenMPTL terminal console!\n    # help\n    List of commands:\n       cpuid      prints SCB::CPUID register hexadecimal value\n       heap       allocate (leak) 1k on heap\n       nrf        test the NRF24L01 chip (spi)\n\n\nFolder Hierarchy\n================\n\n  * `arch`: Architecture dependent template library\n  * `bin`: Helper applications\n  * `config`: Makefiles, included by projects\n  * `doc`: doxygen documentation build root\n  * `drivers`: Drivers for specific peripherals\n  * `include`: Main OpenMPTL class declarations\n  * `lib`: Auxiliary libraries\n  * `projects`: Example projects\n    * `stm32f103stk-demo`: Example project for the [stm32f103stk] evaluation board\n    * `stm32f4discovery`: Example project for the [stm32f4discovery] evaluation board\n    * `stm32f4discovery-ledtest`: Simple example for the [stm32f4discovery] evaluation board\n    * `unittest`: OpenMPTL unit tests\n  * `sim`: Compilation units for simulation framework\n\n  [stm32f103stk]: https://www.olimex.com/Products/ARM/ST/STM32-103STK/\n  [stm32f4discovery]: http://www.st.com/en/evaluation-tools/stm32f4discovery.html\n\n\nDevelopment\n===========\n\nSource Code Repository\n----------------------\n\nThe source code for OpenMPTL is managed using Git.\n\nOfficial repository:\n\n    git clone https://dev.tty0.ch/openmptl.git\n\nMirror on GitHub:\n\n    git clone https://github.com/digint/openmptl.git\n\n\nHow to Contribute\n-----------------\n\nYour contributions are welcome!\n\nIf you would like to contribute or have found bugs:\n\n  * Visit the [OpenMPTL project page on GitHub] and use the\n    [issues tracker] there.\n  * Talk to us on [Libera.Chat] in `#openmptl`.\n  * Contact the author via email (the email address can be found in\n    the sources).\n\nAny feedback is appreciated!\n\n  [OpenMPTL project page on GitHub]: http://github.com/digint/openmptl\n  [issues tracker]: http://github.com/digint/openmptl/issues\n  [Libera.Chat]: https://libera.chat\n\n\nLicense\n=======\n\nOpenMPTL is free software, available under the [GNU General Public\nLicense, Version 3][GPLv3].\n\nSome register definition files in `arch/*/reg` contain derivative\nrepresentations of CMSIS System View Description (SVD) files, and are\nsubject to the \"End User License Agreement for STMicroelectronics\"\n(see \"STM_License.html\" in the containing directory).\n\n  [GPLv3]: http://www.gnu.org/licenses/gpl.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigint%2Fopenmptl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigint%2Fopenmptl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigint%2Fopenmptl/lists"}