skills/baremetal/gpio-baremetal/SKILL.md
Bare-metal GPIO skill for pin configuration and interrupts. Use when configuring GPIO modes, alternate functions, pull resistors, or EXTI interrupts on STM32/nRF/ESP32-class MCUs. Activates on queries about GPIO MODER, alternate function, pin interrupt, or LED/button bare-metal setup.
npx skillsauth add mohitmishra786/low-level-dev-skills gpio-baremetalInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Configure and use GPIO without HAL: input/output modes, alternate function mapping, pull-up/down, speed/slew, and pin-change interrupts for LEDs, buttons, and peripheral pin mux.
/* Enable GPIOA clock */
RCC->AHB1ENR |= RCC_AHB1ENR_GPIOAEN;
/* PA5 output — MODER[11:10] = 01 */
GPIOA->MODER &= ~(3U << (5 * 2));
GPIOA->MODER |= (1U << (5 * 2));
/* Toggle via BSRR — atomic set/reset */
GPIOA->BSRR = (1U << 5); /* set */
GPIOA->BSRR = (1U << (5+16)); /* reset */
Alternate function (e.g., USART2 TX on PA2):
GPIOA->MODER &= ~(3U << (2*2));
GPIOA->MODER |= (2U << (2*2)); /* AF mode */
GPIOA->AFR[0] &= ~(0xFU << (2*4));
GPIOA->AFR[0] |= (7U << (2*4)); /* AF7 = USART2 */
/* PC13 input, pull-up */
GPIOC->MODER &= ~(3U << (13*2)); /* input mode 00 */
GPIOC->PUPDR &= ~(3U << (13*2));
GPIOC->PUPDR |= (1U << (13*2)); /* pull-up */
int pressed = !(GPIOC->IDR & (1U << 13)); /* active low */
/* SYSCFG: map EXTI13 to PC13 */
SYSCFG->EXTICR[3] = (SYSCFG->EXTICR[3] & ~0xFU) | 0x2; /* port C */
EXTI->IMR |= (1U << 13);
EXTI->FTSR |= (1U << 13); /* falling edge */
NVIC_EnableIRQ(EXTI15_10_IRQn);
ISR: check EXTI->PR, clear with write-1.
| Platform | Pattern |
|----------|---------|
| nRF52 | NRF_P0->PIN_CNF[n] — direction, pull, drive |
| ESP32 | GPIO.out_w1ts, GPIO.enable; IO_MUX for function |
Always enable peripheral clock / power domain before pin config.
/gpio-baremetal Configure PA2 as USART2 TX alternate function on STM32F4
| Symptom | Cause | Fix | |---------|-------|-----| | Pin stuck | Wrong MODER / not AF | Re-read RM pin table | | EXTI storm | No debounce / floating input | Enable pull; debounce in software | | AF mismatch | Wrong AFR nibble | Pin-specific AF table in RM | | No toggle visible | Wrong port bit / LED active low | Check schematic |
skills/baremetal/mmio-and-bit-manipulation — BSRR/MODER masksskills/baremetal/peripherals-from-datasheet — RM pinout tablesskills/baremetal/uart-serial-baremetal — AF mux for serialdevelopment
QEMU/KVM skill for virtualization and kernel development. Use when running qemu-system-x86_64 with KVM, configuring virtio devices, VFIO passthrough, QMP monitor, libvirt, or booting custom kernels. Activates on queries about QEMU, KVM, virtio, VFIO, virsh, virt-install, or -kernel -append.
development
Hardware virtualization internals skill for Intel VT-x and AMD-V. Use when studying VMCS/VMCB, EPT/NPT page tables, VMEXIT handling, APIC virtualization, or building minimal hypervisors. Activates on queries about VMX, SVM, VMCS, EPT, NPT, VMEXIT, or type-1 hypervisor.
testing
Linux containers internals skill for namespaces, cgroups, and OCI. Use when understanding clone/unshare namespaces, cgroups v2 limits, overlayfs, runc, seccomp profiles, capabilities, or escape mitigations. Activates on queries about namespaces, cgroups, overlayfs, runc, seccomp-bpf, OCI spec, or container escape.
tools
Reverse engineering skill for binary analysis. Use when decompiling with Ghidra, analyzing with radare2, scripting RE tools, triaging with strings/file/xxd, or diffing binaries. Activates on queries about Ghidra, radare2, r2, decompiler, Binary Ninja, Diaphora, or stripped binary analysis.