agentsclimarketplace

Registers

Skill erwinkooiman/stm32_svd/skills/registers

Look up ARM Cortex-M / STM32 hardware register definitions — addresses, bit positions, masks, field encodings, reset values, NVIC interrupt numbers — from CMSIS-SVD data. Also decodes a raw register value read from a debugger into named fields, and builds a read-modify-write statement from field names. Use whenever writing, reviewing or debugging bare-metal register access (`TIMx->CR1`, `RCC->CFGR`, `GPIOx->MODER`, `ADCx->SMPR1`, peripheral init, a value from `-r32` / a watch expression, a fault address), or when asked what a bit does or where a register lives.From its SKILL.md

Install
npx -y skills add erwinkooiman/stm32_svd --skill registers

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.5 KB, as published. Nobody here has run it

Hardware register lookup

Never write a register address, bit position, mask, or reset value from memory. Look it up with svdq first. If a peripheral, register or field is not in the data, say so — do not invent it, and do not infer it by analogy to another MCU.

This applies to review as much as to authoring: verify the bit positions already in the code against svdq output rather than assuming the code is right.

Commands

svdq is on PATH. Run svdq --help for the full list.

NeedCommand
Which devices are loadedsvdq devices
Find a peripheralsvdq periph tim
Every register of a peripheralsvdq TIM1
Full bit layout of a registersvdq TIM1.CR1
One field and its legal valuessvdq RCC.CFGR.SW
Search names and descriptionssvdq find OSPEED
Explain a value read from hardwaresvdq decode TIM1.SR 0x81
Build a value from field namessvdq encode TIM1.CR1 CMS=2 CEN=1
Identify an address (e.g. from a fault)svdq addr 0x40012C04
NVIC / interrupt numberssvdq irq usb
Raw JSON, for parsingsvdq raw TIM1.CR1

decode is the fast way to interpret a value from a debugger or a STM32_Programmer_CLI -r32 read; it warns when bits are set outside any documented field. encode prints a ready read-modify-write C statement.

Register naming is inconsistent in vendor SVDs (TIM1_CR1 but plain MODER); svdq accepts either form. Add -d <name> to restrict to one device when several are loaded — without it, results identical across devices print once, and a <DEVICE> marker means the item exists only there.

Other MCUs

The bundled data covers STM32G473/G474/G491 and works offline. Any of the 196 other STM32 devices can be downloaded on request:

svdq available f4              # list what can be fetched (regex)
svdq fetch STM32F411           # download + convert, once
svdq -d STM32F411 TIM1.CR1     # then query it normally

Fetched devices are cached per-user and stay available. Note that ST groups some families under wildcard names — the F0 SVDs are STM32F0x0/F0x1/F0x2/F0x8, so there is no STM32F070; fetch suggests the real names when a lookup misses.

For non-STM32 parts, point svdq at any SVD file:

svdq --svd path/to/nRF52840.svd TIMER0    # one-off, cached after first use
svdq add path/to/nRF52840.svd             # ingest permanently

SVDs for most ARM Cortex-M parts are at github.com/cmsis-svd/cmsis-svd-data (25 vendors), or from the vendor directly.

fetch and available are the only commands that touch the network; everything else is local. When several devices are loaded, a register that differs between families reports which devices actually have the field you asked for.

Trusting the output

The tool is exactly as good as the SVD behind it, and vendor SVDs contain real errors. It flags what it can:

  • A WARNING on a reset value means bits are set that no documented field covers. Sometimes that is genuine; sometimes the vendor is wrong. Verify in the reference manual before relying on it. (Known case: ST gives RCC_CR on the STM32G4 a reset value of 0x00000063; RM0440 §7.4.1 says 0x00000500.)
  • Bits reported reserved / undocumented have no field in the SVD. Preserve them on read-modify-write; do not assume they are writable as zero.
  • A multi-bit field with no value encodings is reported as such rather than shown blank — the vendor omitted them, so get the encoding from the reference manual. The ADC SMPx sample-time fields are the common case.
  • An enable bit is not proof a peripheral exists. Vendors define clock-enable and debug-freeze bit maps family-wide, so RCC.APB1ENR1.TIM5EN can exist on a part with no TIM5. Confirm the peripheral itself with svdq periph.
  • Field descriptions are the vendor's own text. They summarize but do not replace the reference manual — go there for procedures, timing and ordering constraints.

Keep looking

Skills are one crate of 607,533. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.