stm32-hal

stm32-hal is a skill for Claude Code, Codex from JakubMikolajek/codex-skills-collection. It costs 93 tokens per session (3,441 once invoked), scanned A, original, MIT.

A set of firmware development patterns for STM32 microcontrollers using STM32 HAL and LL drivers. Firmware is software that runs directly on hardware, and HAL provides reusable interfaces for the chip’s peripherals.

In plain words
What is it for?
Use it to write or review STM32 code for GPIO, UART, I2C, SPI, ADC, DMA, interrupts, and low-power modes, with CMake or STM32CubeIDE builds.
Why use it?
It helps structure CubeMX-generated projects and avoid common problems when connecting and controlling hardware devices.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to write or review STM32 code for GPIO, UART, I2C, SPI, ADC, DMA, interrupts, and low-power modes, with CMake or STM32CubeIDE builds.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jakubmikolajek/codex-skills-collection/stm32-hal
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add JakubMikolajek/codex-skills-collection --skill stm32-hal
Clone the repo
git clone --depth 1 https://github.com/JakubMikolajek/codex-skills-collection

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for stm32-hal

README.md
[![agentmods](https://agentmods.dev/badge/skills/jakubmikolajek/codex-skills-collection/stm32-hal/github.svg)](https://agentmods.dev/skills/jakubmikolajek/codex-skills-collection/stm32-hal)
Your own site
<a href="https://agentmods.dev/skills/jakubmikolajek/codex-skills-collection/stm32-hal"><img src="https://agentmods.dev/badge/skills/jakubmikolajek/codex-skills-collection/stm32-hal/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for stm32-hal

Your own site · 80×15
<a href="https://agentmods.dev/skills/jakubmikolajek/codex-skills-collection/stm32-hal"><img src="https://agentmods.dev/badge/skills/jakubmikolajek/codex-skills-collection/stm32-hal.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 93 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,441 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00093 $0.03441
Opus 5 $0.00046 $0.01721
Sonnet 5 $0.00019 $0.00688
Haiku 4.5 $0.00009 $0.00344

Measured 11d ago against content hash 23c024d3d176, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

stm32-hal scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 11d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/stm32-hal/SKILL.md · 362 lines

How it starts

The opening of the file, as written. The whole thing — 362 lines — stays where its author put it; the contents beside it link to each section on GitHub.

STM32 with HAL

STM32 is the dominant microcontroller family in commercial embedded. This skill covers HAL-based development — the recommended starting point for most projects — with notes on where LL (Low-Layer) drivers are preferable for performance.

When to Use

  • Writing firmware for any STM32 microcontroller (F0/F1/F4/F7/H7/G4/L4/WB)
  • Reviewing STM32 HAL driver usage for correctness
  • Adding peripherals to a CubeMX-generated project
  • Debugging HAL timeout, DMA transfer, or interrupt issues

When NOT to Use

  • ESP32 — use esp32-idf
  • RP2040 — different SDK (Pico SDK), different patterns
  • AVR — different toolchain, avr-libc

Project Setup

CubeMX Workflow

CubeMX generates the peripheral initialization code. Your application code goes in the USER CODE BEGIN/END sections — this survives code re-generation.

project/
├── Core/
│   ├── Inc/
│   │   ├── main.h           # CubeMX generated
│   │   └── stm32f4xx_hal_conf.h
│   └── Src/
│       ├── main.c           # Add app code in USER CODE sections
│       ├── stm32f4xx_it.c   # ISR handlers — add your code here
│       └── stm32f4xx_hal_msp.c
├── Drivers/
│   ├── STM32F4xx_HAL_Driver/
│   └── CMSIS/
├── Middlewares/
│   └── Third_Party/FreeRTOS/  # if RTOS enabled in CubeMX
├── CMakeLists.txt              # or .ioc + CubeIDE project
└── STM32F407VGTx_FLASH.ld     # linker script (CubeMX generated)

CMake with arm-none-eabi

# CMakeLists.txt for STM32F4 project
cmake_minimum_required(VERSION 3.22)
project(my_firmware C CXX ASM)

set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)

# MCU-specific flags — adjust for your part
set(CPU_FLAGS
    -mcpu=cortex-m4
    -mthumb
    -mfpu=fpv4-sp-d16
    -mfloat-abi=hard
)

add_compile_options(
    ${CPU_FLAGS}
    -ffunction-sections
    -fdata-sections
    -fno-exceptions      # C++ only
    -fno-rtti            # C++ only
    -Wall
    -Wextra
    -Os
)

add_link_options(
    ${CPU_FLAGS}
    -T${CMAKE_SOURCE_DIR}/STM32F407VGTx_FLASH.ld
    -Wl,--gc-sections
    -Wl,--print-memory-usage
    -specs=nano.specs    # newlib-nano: reduced printf/malloc
    -specs=nosys.specs   # no system calls (bare metal)
)

# Collect sources
file(GLOB_RECURSE SOURCES
    Core/Src/*.c
    Drivers/STM32F4xx_HAL_Driver/Src/*.c
)
# Exclude template files
list(FILTER SOURCES EXCLUDE REGEX ".*_template\\.c")

add_executable(${PROJECT_NAME}.elf ${SOURCES} startup_stm32f407vgtx.s)

target_include_directories(${PROJECT_NAME} PRIVATE
    Core/Inc
    Drivers/STM32F4xx_HAL_Driver/Inc
    Drivers/CMSIS/Device/ST/STM32F4xx/Include
    Drivers/CMSIS/Include
)

target_compile_definitions(${PROJECT_NAME} PRIVATE
    USE_HAL_DRIVER
    STM32F407xx
)

# Generate .bin and .hex
add_custom_command(TARGET ${PROJECT_NAME}.elf POST_BUILD
    COMMAND ${CMAKE_OBJCOPY} -O ihex   $<TARGET_FILE:${PROJECT_NAME}.elf> ${PROJECT_NAME}.hex
    COMMAND ${CMAKE_OBJCOPY} -O binary $<TARGET_FILE:${PROJECT_NAME}.elf> ${PROJECT_NAME}.bin
    COMMAND ${CMAKE_SIZE} $<TARGET_FILE:${PROJECT_NAME}.elf>
)

Read the full file on GitHub · 362 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 11d ago First seen · 362 lines · 93 tokens per session scan A 23c024d3d176

Subscribe to this mod's changes

stm32-hal is a skill published in the GitHub repository JakubMikolajek/codex-skills-collection (5 stars, last pushed 6d ago), licensed MIT. It adds 93 tokens to every session and 3,441 once invoked, about $0.0005 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

doca-argp

Use this skill for hands-on DOCA Arg Parser CLI work on a shipped sample or new DOCA-using app — adding / removing / renaming flags; wiring docaargpinit → register params → docaargpstart → docaargpdestroy in order; picking a parameter type from the full public enum (DOCAARGPTYPESTRING, INT, BOOLEAN, DEVICE, DEVICEREP…

NVIDIA/skills · 267 tokens

embedded-stm32

Best practices for embedded C/C++ development on STM32 microcontrollers using the HAL, covering peripherals, DMA, interrupts, memory constraints, and hardware-focused testing. Use when writing STM32 HAL code, configuring peripherals generated by STM32CubeMX, working with interrupts or DMA, debugging with SWD/JTAG…

Mindrally/skills · 87 tokens

hip-kernel-optimization

This skill should be used when writing or tuning HIP kernels on AMD/NVIDIA GPUs, covering memory coalescing, shared-memory tiling, bank conflict avoidance, warp primitives, occupancy, vectorization, async ops, loop unrolling, and profiling.

AMD-AGI/Apex · 56 tokens

cuda

Use when writing CUDA kernels, managing the thread, block, and grid hierarchy, tiling shared memory, using streams, setting nvcc flags, or using Thrust. Not for kernel debugging: use cuda-debugging.

OutlineDriven/outline-driven-development · 46 tokens

acad-arx-wizard

Agentic ObjectARX project scaffolding for AutoCAD 2027 / Visual Studio 2026. Replaces the broken .vsz VsWizardEngine wizard with a PowerShell script that generates identical C++ project files. Works for new ARX/DBX/CRX projects and add-on class wizards (Jig, Reactors, Custom Object, MFC, .NET Wrapper, COM Wrapper…

autodesk-platform-services/skills · 92 tokens

hls-c2rtl

Translate C / C++ / SystemC algorithmic descriptions into synthesizable RTL via High-Level Synthesis. Use when the user says "HLS", "C to RTL", "C++ to Verilog", "Vitis HLS", "Catapult", "XLS", "algorithmic design", or provides a reference implementation in software and asks for hardware.

vibeic/vibe-ic · 79 tokens