Giter Club home page Giter Club logo

stm32-data's Introduction

stm32-data

stm32-data is a project aiming to produce clean machine-readable data about the STM32 microcontroller families, including:

  • ✔️ Base chip information
    • RAM, flash
    • Packages
  • ✔️ Peripheral addresses and interrupts
  • ✔️ Interrupts
  • ✔️ GPIO AlternateFunction mappings (for all families except F1)
  • GPIO mappings for F1
  • 🚧 Register blocks for all peripherals
  • ✔️ DMA stream mappings
  • Per-package pinouts
  • ✔️ Links to applicable reference manuals, datasheets, appnotes PDFs.

✔️ = done, 🚧 = work in progress, = to do

Data sources

These are the data sources currently used.

  • STM32Cube database: describes all MCUs, with useful stuff like GPIO AF mappings, DMA stream mappings, pinouts...
  • stm32-rs SVDs: register blocks. YAMLs are extracted and manually cleaned up.

Install pre-requisites

In order to run the generator, you will need to install the following tools:

  • wget
  • git
  • jq
  • svdpip3 install svdtools

Generating the YAMLs

  • Run ./d download-all
  • Run python3 -m stm32data

This generates all the YAMLs in data/ except those in data/registers/, which are manually extracted and cleaned up.

Do not manually edit the files in data/chips, contents of these files are autogenerated. Assignments of registers to peripherals is done in the file parse.py and fixes to registers can be done in the files located in data/registers.

Extracting new register blocks

For instance, to add support for the G0 series first download all the source SVDs:

$ ./d download-all

Now extract the RCC peripheral registers:

./d install-chiptool
./d extract-all RCC --transform ./transform-RCC.yaml

Note that we have used a transform to mechanically clean up some of the RCC definitions. This will produce a YAML file for each chip model in ./tmp/RCC.

Sometimes the peripheral name will not match the name defined in the SVD files, check the SVD file for the correct peripheral name.

At this point we need to choose the model with the largest peripheral set (e.g. the STM32G081) and compare its YAML against each of the other models' to verify that they are all mutually consistent.

Finally, we can merge

./merge_regs.py tmp/RCC/g0*.yaml

This will produce regs_merged.yaml, which we can copy into its final resting place:

mv regs_merged.yaml data/registers/rcc_g0.yaml

To assign these newly generated registers to peripherals, utilize the mapping done in parse.py. An example mapping can be seen in the following snippet

('STM32G0.*:RCC:.*', 'rcc_g0/RCC'),

such mapping assignes the rcc_g0/RCC register block to the RCC peripheral in every device from the STM32G0 family.

The pattern for matching is as follows:

CHIP:PERIPHERAL:PERIPHERAL_KIND

Thanks to this, you can for example match peripherals with the same name, but different versions.

('.*:SPI:spi2s1_v2_2', 'spi_v1/SPI'),
('.*:SPI:spi2s1_v3_2', 'spi_v2/SPI'),

When matching the peripherals using the pattern, the first defined pattern is applied if more of the patterns would match.

('STM32F7.*:TIM1:.*', 'timer_v1/TIM_ADV'),
('STM32F7.*:TIM8:.*', 'timer_v1/TIM_ADV'),
('.*TIM\d.*:gptimer.*', 'timer_v1/TIM_GP16'),

Peripheral versions

The versions of peripherals can be found in the table here.

stm32-data's People

Contributors

bgamari avatar bobmcwhirter avatar ctron avatar dcnick3 avatar dirbaio avatar frozendroid avatar grantm11235 avatar lulf avatar matoushybl avatar mryndzionek avatar thalesfragoso avatar theunkn0wn1 avatar timokroeger avatar tiwalun avatar vasanthakumarv avatar

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.