Giter VIP home page Giter VIP logo

architecture-ng's Introduction

Problems we're trying to solve

Update hell

Now PACs are generated by svd2rust and used both in HALs and in the user code via HAL reexport. Most PAC updates are technically breaking changes that require a PAC version bump, and then a HAL version bump. Given the overall "breaking changes are bad" attitude, it's better to reduce the consequences caused by PAC updates. The proposed solution here is:

  1. Don't re-export PAC APIs in HAL, use PACs internally instead.
  2. Separate ownership part of PAC from the register access API part
  3. Allow both users and HALs use different register access API over the common "ownership" base.

Ownership part, or "common base" will serve a problem of defining peripherals for all the supported microcontrollers and should be stable as stone. It provides:

  1. Separate peripheral definitions in form of ZST, that can only be constructed unsafely. Each peripheral implements a trait that contains an associated constant -- an address of the peripheral.
  2. Optional safe abstraction (Peripherals structure) for constructing the peripherals once.

Outcomes:

  1. More freedom in using different peripheral access API layers (svd2rust vs stm32ral vs something new)
  2. PAC updates no longer require HAL "breaking" version update

Build times

Despite great efforts towards svd2rust code optimization, build times for "big" chips are still really slow, especially compared to the stm32ral "baseline".

The proposed solution allows importing peripheral access API only for those peripherals that are actually used in HAL. This, with the corresponding support for partial import from the svd2rust, should improve build times a lot.

Common drivers

At the moment non-trivial drivers like stm32-usbd require PAC layer to access the peripherals. Early experience showed that using peripherals re-exported from HALs is not an option, so such crates pull their own peripheral access layer, independent of that provided by HALs.

The proposed solution allows importing arbitrary PAC API instead of vendoring it. This allows updating PAC API in a regular way to get bug fixes and missing field definitions.

Additionally, with the presence of the common base, this solution allows defining a driver trait that will be implemented for all the supported peripherals from different families.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.