Skip to content

otukka/Svd2cppObjects

Repository files navigation

Svd2cppObjects

Introduction

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.

Requirements

Python +3.6 and virtualenv is required.

Usage

  1. Add this project as submodule to your project at root directory
git submodule add [email protected]:otukka/Svd2cppObjects.git
  1. Include this project in your root CMakeLists.txt
add_subdirectory(Svd2cppObjects)
  1. In CMakeLists.txt add Svd2cppObjects to some target
target_link_libraries(<target> PRIVATE Svd2cppObjects)
  1. Declare bitwidth in root project
cmake -DSYSTEM_BIT_WIDTH=<SYSTEM_32_BIT|SYSTEM_64_BIT> ..
  1. In your project main file include target
#include "<target>.hpp"
  1. Example how to use RCC in STM32F2 platform
auto RCC = PeripheralFactory::instance()->createRCC();
RCC->AHB1ENR.reset();
RCC->AHB1ENR->GPIOGEN->set(1);

Examples

Example project can be found here.

Known issues / TODO

  • Memory usage is higher than traditional C-like drivers.
  • API needs documentation
  • Only one platform is tested
  • Custom HW driver example needed

About

Convert SVD file to C++ driver: OOP approach

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published