
Learn to build reusable embedded C modules and test them on the host with unit tests, using buffers, queues, state machines, and a dispatcher for an event-driven system.
Test embedded C logic on a host PC without hardware using GCC, Unity, and Seedling. Focus on modules like ring buffers, state machines, and bit manipulation with automated unit tests.
Set up the development environment by installing Ruby and the Emsys 2 toolchain, add them to your path, and initialize a Seedling project for Unity and Cmock unit testing.
Learn a repeatable unit testing methodology for embedded C reusable modules, covering happy path, boundary, invalid inputs, state validation, integration and use case tests, plus AI-assisted test generation.
Explore bit and field helpers that encapsulate single-bit operations and field masks for embedded code. Test reusable modules with host-based unit tests, enforcing no dynamic memory and no hidden state.
Develop bit operations by implementing single-bit helpers (set, clear, toggle, is_set) and field helpers (insert, extract) in header and source files, and run unit tests.
Demonstrates unit testing of bit operations and field helpers in embedded C with the Unity framework, covering bit set, clear, toggle, is set, bit 31 edge cases, and field insert/extract.
Explore a simple bit and field helpers use case for a 32-bit device control register, using read-modify-write patterns and Unity-based tests to verify enable, mode field, and isolated changes.
Explore a byte-based ring buffer for embedded systems using a single-producer, single-consumer model. Reject data when full, use external storage, offer constant-time push/pop, and test on the host.
Implement a byte-based ring buffer for embedded systems with external storage and no dynamic memory, for a single producer and consumer, with constant-time push and pop and one slot empty.
Explore ring buffer unit tests in embedded C, covering initialization, push and pop, FIFO order, wraparound, full and empty state checks, and invalid input handling.
Demonstrate how a ring buffer enables safe, in-order data transfer between an interrupt and a task in an embedded system, with overflow tracking and burst handling.
Design a fixed-size event queue for embedded systems, separating producer (interrupt) and consumer (main loop) to ensure predictable, non-allocating data handling, with tests and integration.
Build a fixed size event queue in embedded C with a ring-buffer approach, one empty slot, enqueue-dequeue of structured events for a single-producer, single-consumer system, with unit-tests, no dynamic allocation.
Explore fixed-size event queue testing by validating initialization, capacity as size-1, wraparound, enqueue, dequeue, and FIFO order with robust input checks.
Simulate a cue shared by a producer and a consumer to model event buffering, track drops when full, and verify deterministic overflow with temperature events and a drop counter.
Learn to model behavior with a table-driven finite state machine using states and events, separating transitions as data from execution, building an FSM engine, and verifying with tests.
Implement a table-driven finite state machine in C with fsm.h and fsm.c, using a transition table, a dispatch engine, and optional on-entry, on-exit, and action callbacks, plus unit tests.
Summarize table-driven FSM unit tests that validate states, transitions, and callback order for monitoring, alert, and acknowledged; with threshold high, acknowledge, and threshold normal events, 11 tests pass.
This lecture demonstrates a queue-driven integration of a table-driven FSM, testing state transitions and edge cases with unit tests and an event-driven loop.
Implement a reusable event dispatcher to route events from the queue to modules, decoupling production from handling. Test routing with Unity and integrate with the FSM for an event-driven architecture.
Summarize the dispatcher implementation, including header and source files, status codes, and a table-based routing mechanism with unit and integration tests validating handler calls, context, event, and default handling.
Implement and test an event dispatcher in embedded c, routing events to the correct handlers, applying a default fallback, handling not-found cases, and validating initialization and dispatch safety.
End-to-end integration tests connect the queue, dispatcher, and FSM to show an event-driven workflow, routing events to the FSM, log handlers, or default handlers.
Assemble reusable modules—queue, dispatcher, FSM, and ring buffer—into a complete, deterministic environmental monitor system with host testability. Learn end-to-end event flow from simulated producers to the dispatcher, FSM, and logging.
Explore capstone environmental monitor system implementation in embedded c, using a queue, dispatcher, fsm, and ring buffer to handle threshold high, threshold normal, and acknowledge events.
Demonstrate end-to-end testing of environmental monitor system in embedded c capstone, validating the happy path, unknown-event handling, and logging through ring buffer while exercising the dispatcher, fsm, and unity.
Integrate reusable components into an stm32f446 project using cube ide, and demonstrate event flow from the internal temperature sensor through the event queue, dispatcher, fsm, and log buffering to uart.
Debug STM32 reusable modules by tracing the event flow from the temperature producer through the queue, dispatcher, and FSM transitions, with logging via a ring buffer and UART output.
This course contains the use of artificial intelligence.
(Used only for minor visual assistance such as slide layout. All instruction, code, and narration are created by the instructor.)
Course Description
Most embedded systems start simple, but quickly become harder to test, harder to scale, and harder to maintain.
This course focuses on solving that by building reusable embedded C modules and validating them using host-based unit testing.
What this course is about
You’ll build a set of practical embedded components and see how they fit together in a clean, event-driven system.
The focus is on:
Reusable design
Predictable behavior
Proper verification
All testing is done on the host using Unity and Ceedling, so you can validate firmware logic without hardware.
What you’ll build
Throughout the course, you’ll work with core embedded building blocks, including:
Bit and register field helpers
Ring buffer (deterministic, stream-safe)
Fixed-size queue (no dynamic allocation)
Event dispatcher (ID to handler routing)
Table-driven finite state machine
Integrated event-driven mini system
Each module is:
Statically allocated
Deterministic
Tested with edge cases
Designed for reuse
Testing approach
Every component is verified with unit tests on the host.
This includes:
Validating normal behavior
Handling edge cases
Testing failure conditions
Verifying integration between components
You’ll also see use-case style tests and system-level flows, so it’s clear how each piece behaves in a working application.
How this course is different
This is not a “type along” coding course.
The focus is on:
Understanding real implementations
Testing behavior properly
Seeing how components interact in a system
The goal is not just to write code, but to build components you can reuse and trust.
Why host-based testing matters
Most embedded logic does not require hardware to verify.
By testing on your PC, you can:
Iterate faster
Catch edge cases early
Improve code quality before deployment
This workflow is widely used in professional embedded development and is often missing from traditional courses.
What you’ll walk away with
By the end of this course, you’ll be able to:
Design reusable embedded C modules with clean APIs
Structure firmware using event-driven patterns
Write and run unit tests using Unity and Ceedling
Validate behavior, including edge cases, on the host
Integrate components into a complete working system