Jide Oyelayo
CV

Lab / STM32 microcontroller lab

STM32 microcontroller lab

What this demonstrates: Step through an editable ARM assembly program in WebAssembly; inspect integer, DSP and floating-point state, control GPIO/timers, and explore calls and explicit waits.

An instruction changes a register. A memory-mapped write changes an output. Follow that path without a physical microcontroller board.

Screenshot of STM32 microcontroller lab: the FPU inspector showing single-precision results and raw integer-conversion bits.

Try seven teaching examples

  1. Light the LEDs: configure GPIOA and drive PA3/PA4 high. Step through each register write.
  2. Read a button: run a loop, toggle PB0, and watch PA3 follow the input. Pause to inspect the state.
  3. Explore timers and PWM: configure TIM1 channel 1 on PA8 with a 25% duty cycle, and inspect TIM7's counter and update flag.
  4. Call a function: follow BL, saved return addresses and POP through nested calls; inspect the restored stack pointer.
  5. Explore DSP saturation: compare packed arithmetic and saturating results, then inspect sticky Q and GE flags.
  6. Inspect floating-point rounding: view S-register bits, change FPSCR rounding, and compare integer conversions.
  7. Wake a waiting program: signal an event or interrupt, then resume after an explicit service-call pause.

The lab includes an assembly editor, Run/Pause/Step/Reset, integer, FPU and system-register inspectors, a memory inspector, and virtual input and wake controls. It runs locally in the browser without a sign-in. The first visit downloads the .NET WebAssembly runtime.

Why I built it

I built the original Windows emulator to help Warwick engineering students learn about microcontrollers when access to physical boards was difficult. It exposed registers, memory, assembly execution and simulated GPIO interfaces. The browser lab extends that teaching purpose with examples visitors can edit and inspect.

One C# core, two frontends

The Windows Forms application and Blazor WebAssembly lab share one C# core with 229 canonical ARMv7E-M / FPv4-SP-D16 source mnemonics. It includes integer registers, N/Z/C/V/Q/GE flags, a typed assembly parser, code addresses, sparse SRAM, floating-point register state, and selected RCC, GPIOA/B, TIM1 and TIM7 behavior. A single execution controller owns cancellation and the run limit; timer state advances in simulated ticks rather than independent background loops.

I separated that core from the Windows UI and repaired register parsing, flags, branch/BX destinations, byte access, PB0 toggling, timer rollover and execution lifecycle behavior. The expanded interpreter adds stack/calls, memory addressing forms, DSP operations, explicit traps/waits, and floating-point arithmetic with software rounding and flags. Regression tests check expected machine state and independent QEMU/SoftFloat reference results. The maintained code uses C# and .NET 10; the original project file targeted .NET 6, despite the older README saying .NET Framework 4.8.

What the demo does and does not verify

This is an educational assembly interpreter with selected peripheral simulation. It does not decode firmware binaries, reproduce hardware instruction timing, execute exception handlers, or emulate every STM32 peripheral. Service calls pause explicitly; event and interrupt signals wake waits without dispatching a handler. Double-precision arithmetic and instructions from other ARM profiles are outside the model. The displayed waveform illustrates configured duty; it is not a measured hardware trace.

The supported syntax and register subset are documented in the lab and repository. Unsupported input produces source-line diagnostics. Source is bounded to 64 KiB and 2,000 executable instructions; Run pauses after 100,000 steps and can be resumed. These are regression checks of the documented model, not a hardware conformance suite or performance benchmark.