book.derekmolloy.ie
Interactive Textbook

Edge Programming
with C/C++ and Rust

Master physical AI, memory safety, and hardware constraints. A modern guide to bridging the gap between high-level logic and low-level sensor interfaces.

By Prof. Derek Molloy
Dublin City University
10
Border router Router End device
11
4-BIT COUNTER, ONE FLIP-FLOP PER BIT1Q30Q21Q11Q01011 = 11CQ0Q1Q2Q3now
Clock Least significant Most significant
Interactive Demonstrations

Digital & Analogue
Electronics

Circuits you can push rather than read about. Set the inputs, step the logic through one gate at a time, and draw your own waveforms. Every value is worked out from the circuit itself, so the schematic, the truth table and the timing diagram cannot disagree.

EEN1022 at Dublin City University
Run live in lectures

What You Will Learn

Two books on one site, built the same way. Read a little, then drive the circuit or the code yourself and find out whether it does what the text just claimed.

Work in progress: both books are written as the modules run, so pages are added and revised over time.

Edge Programming

Twelve chapters · 90 pages

Modern C++

Object-oriented design, templates, the STL and smart pointers. Four chapters taking C++ from syntax to the idioms an embedded codebase actually leans on.

🦀

Memory Safety

Rust's ownership model, borrowing and lifetimes. A compiler that refuses to build is a great deal cheaper than a fault found on a device already in the field.

Concurrency

Threads, channels, shared state and atomics, then the same guarantees carried over to clients and servers talking across a network.

Real Hardware

Deterministic execution, RTOS scheduling with Zephyr, and Rust on the ESP32, where resource budgets and optimisation stop being theoretical.

Digital & Analogue Electronics

Twelve demonstrations · two crosswords
🧮

Gates and Algebra

What each gate is for, why NAND alone can build every one of them, and the algebra for rearranging a circuit without changing what it does.

🗺

Design and Simplify

Karnaugh maps at two, three and four variables, then a design carried through in full: four bits of BCD in, seven segments out.

💾

Circuits That Remember

Latches, edge triggering, and the SR, D and JK flip-flops. Where outputs stop being a function of the inputs and start depending on what happened earlier.

From the Lab

⚠ Lab Tip

Assert both inputs of an SR latch at once and it is perfectly stable. Release them together and which way it falls depends on which gate is fractionally faster, so two benches will disagree.

ℹ Professor's Note

The borrow checker rejects, in about a second, the aliasing bug that the C++ version will happily compile and then exhibit somewhere inconvenient six months later.

Built for Interactive Learning

Neither book is static text. Chapters carry components you drive yourself: quizzes that say why an answer is wrong rather than just marking it, code to reorder until it compiles, virtual labs, and circuits whose schematic, truth table and timing diagram are all computed from the same logic, so they cannot disagree with each other.

685
Interactive questions
95
Interactive component types
104
Chapter sections
13
Virtual labs