Svd2cppObjects is tool for converting System View Description (SVD) files to C++ driver library. Intention is to access memory mapped IO with C++ objects.
This project provides Peripheral, Register, and Bitfield classes. These classes are used to encapsulate memory addresses in a safe way. There is no more need for raw pointer handling. These classes could be used to create driver for custom hardware.
Python +3.6 and virtualenv is required.
- Add this project as submodule to your project at root directory
git submodule add [email protected]:otukka/Svd2cppObjects.git
- Include this project in your root
CMakeLists.txt
add_subdirectory(Svd2cppObjects)
- In
CMakeLists.txt
add Svd2cppObjects to some target
target_link_libraries(<target> PRIVATE Svd2cppObjects)
- Declare bitwidth in root project
cmake -DSYSTEM_BIT_WIDTH=<SYSTEM_32_BIT|SYSTEM_64_BIT> ..
- In your project main file include target
#include "<target>.hpp"
- Example how to use RCC in STM32F2 platform
auto RCC = PeripheralFactory::instance()->createRCC();
RCC->AHB1ENR.reset();
RCC->AHB1ENR->GPIOGEN->set(1);
Example project can be found here.
- Memory usage is higher than traditional C-like drivers.
- API needs documentation
- Only one platform is tested
- Custom HW driver example needed