Skip to main content

cmsis_posmsk_codegen

Build Status

cmsis_posmsk_codegen is a small utility to generate Pos and Msk definitions for registers, particularly for CMSIS projects. It can be used for any project but the Pos and Msk definitions are compatible with other definitions in CMSIS v5.

Installation

$ pip install cmsis_posmsk_codegen

then use:

$ cmsis_posmsk_codegen reg.yaml

Register Definition (yaml)

One or more registers are defined in a yaml file like this:

REG_1:
  - FIELD_1: 2
  - FIELD_2: 3
  - RESERVED: 27
REG_2
  - RESERVED: 3
  - RESERVED: 5
  - FIELD_1: 24

The field names are taken as it is for code generation. Since the generated code is C definitions, you probably want to write both register and field names in upper case.

The number next to field name after colon is the number of bits of this field. It is assumed registers are 32-bit, so the total of bits of all fields in a register definiiton has to be 32-bit. If it is not, an error is generated and no output is given.

If a field name is called RESERVED, no definition is generated, and its bits are skipped. Since this field is not generated, there can be more than one field named RESERVED. However, any other name (both registers and fields) has to be unique. If you want to keep a reserved field, name it with a number like RESERVED0.

In addition to register and field names, a prefix is added to each definition. This prefix is the filename without extension of the input file given. Prefix is implicitly converted to uppercase.

A yaml file named test.yaml with the contents above generates a Pos and Msk definition pair like this one for each field (so in total 3 pairs for example above, omitting the ones called RESERVED):

#define TEST_REG_1_FIELD_1_Pos   2U
#define TEST_REG_1_FIELD_1_Msk   (3UL << ETM_REG_1_FIELD_1_Pos)

An example yaml, etm.yaml, is given in github repo (but not in PyPI package). It describes ARM ETM registers.

test.yaml and test.expected in the repo are used at travis build.

Metadata

Release files for cmsis-posmsk-codegen 2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cmsis-posmsk-codegen 2
File Size Uploaded Provenance Actions
cmsis_posmsk_codegen-2.tar.gz 3.0 kB Without provenance Details for cmsis_posmsk_codegen-2.tar.gz

Release files / cmsis_posmsk_codegen-2.tar.gz

Download URL cmsis_posmsk_codegen-2.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
989d5081fdf5c304c77080e60d143d6d141205428e844f50a6ba1dd5cd85a19a
BLAKE2b-256 checksum
How to use checksums
c6ad4a7930805199e88d8ec6c89c4b33cb462ad8496edf31e63812001a219427
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.44.1 CPython/3.6.9

Security for cmsis-posmsk-codegen 2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page