How to use this module
This module is curated — the teaching is a top free university course (linked in the card above); our job is to point you at the right things, make you practice them, and certify you.
The plan
- Take the course (the card above — pick Audit the course to do it free). You don't need every lecture memorised — aim to understand the ideas below.
- Focus on these — they're what the check tests and what firmware actually stands on:
- Fixed-width types —
uint8_t,uint16_t,uint32_tfrom<stdint.h>, and why plainintis risky when a value must match a register. - Pointers — a pointer holds an address;
*preads/writes the value there. This is how you reach memory-mapped hardware. - Arrays vs pointers — an array is a fixed block that decays to a pointer to its first element, but is not a reassignable pointer (
sizeofdiffers). - Bit manipulation — set
REG |= (1 << n), clearREG &= ~(1 << n), testREG & (1 << n). This is register programming. volatile— for hardware registers and ISR-shared data, so the compiler never caches a stale value or optimises the access away.structregister maps — overlay a struct ofvolatilefields on a peripheral base address so you writeGPIOA->ODRinstead of a raw pointer.- Memory — flash vs RAM, stack vs heap, and why firmware usually avoids
mallocon a tiny device. constand functions — read-only data, and pass-by-value vs passing a pointer to modify the caller's variable.
- Fixed-width types —
- Practice in the browser (next section) — write and run real embedded C with nothing to install.
- Take the K-Check to earn your certificate.
Why this connects to building real products
This is the firmware layer of every product you design in Forge. When Forge picks a microcontroller and wires a sensor to it, the code that makes it do anything is exactly this: pointers into memory-mapped registers, bits set and cleared to configure a pin or a peripheral, volatile reads of an input, structs mapping a chip's datasheet onto named registers. Knowing embedded C is what lets you go from a design with an orderable parts list to a board that actually runs.
How to practice — write embedded C in the browser
The fastest way to make embedded C stick is to write and run it — and you can do that free in your browser, with no toolchain to install. Open Wokwi, a free online Arduino/ESP32 simulator: start a new Arduino Uno or ESP32 project, edit the C/C++ in the code pane, press Run, and watch a real simulated board react (LEDs, the serial monitor, wired-up buttons and sensors). For pure C bit-twiddling with no hardware, an online C compiler works too — print the result of REG |= (1 << 3) and friends and confirm the bits land where you expect.
For a first exercise, wire an LED and a push-button in Wokwi and drive them with bit manipulation instead of the tidy Arduino helpers: read the button by masking its port bit (if (PIND & (1 << 2))), and toggle the LED with PORTB ^= (1 << 5) (or set/clear it with |= and &= ~). Declare any flag you share with an interrupt as volatile, and notice how a uint8_t mask maps directly onto the register. Once blink-and-read works at the register level, you've done in the browser exactly what the course teaches on real silicon — the same pointers, masks, and registers, just simulated.