Embedded Modern C++: From Bare-Metal to STL
Comprehensive, deep-dive architectural analysis of all 116 course projects across Sections 1 through 12. Complete with fully annotated source code, ARM Cortex-M hardware realities, zero-overhead refactors, and interactive self-checking quizzes.
Track 1: Foundations & Core Language Architecture
Sections 1 through 6 • Projects 1.01 β 6.06 • Cross-Compilers, Data Types, Control Flow, Memory Locality, Calling Conventions & OOP Foundations
1.01 Hello (Visual Studio / MSVC)
Exploring the classic C++ entry point. We deconstruct the 4 stages of the C++ compilation pipeline (Preprocessor,...
1.02 VSC Hello (Cross-Compilation & Toolchains)
Building modern C++ projects using cross-platform toolchains (VS Code, CMake, Ninja). We dissect Host vs Target...
2.01 HelloWorld
Exploring console output via std::cout and std::endl. We analyze why C++ iostreams introduce 20KB-50KB of binary Flash...
2.02 CommentFun
Exploring single-line (//) and multi-line (/* */) comments. We analyze Doxygen documentation tag standards for embedded...
2.03 VariableFun
Exploring fundamental C++ data types (int, double, char, bool). We demonstrate why non-standardized integer widths...
2.04 TextFun
Exploring character types and escape sequences. We examine ASCII encoding tables, character-to-integer conversion, and...
2.05 ArithmeticFun
Analyzing arithmetic operators (+, -, *, /, %). We explore C++ Integer Promotion rules (small integer types are...
2.06 RelationalFun
Exploring relational comparison operators. We demonstrate why exact equality comparisons (==) on floating-point numbers...
2.07 LogicalFun
Exploring logical operators (&&, ||, !). We analyze Short-Circuit Evaluation, demonstrate how short-circuiting provides...
2.08 BooleanFun
Exploring the boolean data type. We analyze why sizeof(bool) occupies a full 8 bits (1 byte) in memory rather than 1...
2.09 ConstantFun
Analyzing constants in C++. We contrast legacy C preprocessor macros (#define) with type-safe const and compile-time...
2.10 KeyboardInput
Exploring keyboard user input via std::cin. We examine the hazards of blocking I/O in real-time systems, stream fail...
2.11 SunnyWarm
Analyzing compound boolean logic and truth tables. We explore De Morgan's Laws for simplifying complex nested...
2.12 Percentages
Calculating percentage ratios from integer variables. We examine the classic beginner integer division pitfall (e.g....
2.13 TipCalculator
Building tip and tax computation utilities. We explore why floating-point types (float, double) are strictly banned in...
2.14 SecretAgentID
Building security identifier formatting and user credential validation. We analyze formatted I/O manipulation, string...
3.01 ControlStatementsIntro
Exploring the foundations of programmatic control flow. We analyze sequential instruction fetching, conditional...
3.02 SelectionFun
Exploring if/else selection statements and multi-branch decision trees. We contrast deeply nested if-else ladders...
3.03 RetiredWomen
Analyzing multi-variable conditional logic (age, gender, employment status). We examine Karnaugh Map boolean logic...
3.04 GradeFun
Exploring multi-case selection via switch statements vs if-else chains. We analyze compiler jump table generation (ARM...
3.05 LeapYearChecker
Implementing Gregorian calendar leap year determination. We examine the exact three-tier leap year algorithm (divisible...
3.06 RockPaperScissors
Building interactive decision trees and win/loss resolution matrices. We model cyclical dominance relationships (Rock...
3.07 RepetitionFun
Exploring loop structures: while (pre-test), do-while (post-test), and for loops. We analyze their assembly generation...
3.08 SumFun
Accumulating numeric series with loops. We contrast iterative $O(N)$ loop summation with Gauss's closed-form arithmetic...
3.09 EvenOnly
Generating even-number sequences. We demonstrate why advancing the loop step size directly (i += 2) executes twice as...
3.10 ContinueBreak
Analyzing loop interruption statements: break (immediate loop exit) and continue (skip to next iteration). We explore...
3.11 DieRolls
Exploring random number generation and dice simulation. We analyze the severe cryptographic and statistical flaws of...
3.12 RandomFun
Exploring the Modern C++ library introduced in C++11. We contrast legacy C rand() with modern random engines (Mersenne...
3.13 StreamingCalculator
Building a streaming arithmetic calculator with continuous input parsing. We analyze character stream tokenization,...
4.01 ArrayFun
Exploring foundational C-style arrays on the CPU stack. We examine array declaration, zero-based indexing, how arrays...
4.02 ArrayFunTest
Analyzing array initialization syntax, calculating element counts via sizeof, and the dangers of uninitialized stack...
4.03 MoreArrayFun
Exploring C++11 range-based for loops over arrays. We inspect compiler assembly generation, loop unrolling...
4.04 TwiceNumbers
Populating arrays through algorithmic generation and mutating elements in place. We explore ARM Cortex-M4/M7 DSP SIMD...
4.05 NamesArray
Comparing arrays of std::string objects with lightweight string_view arrays. We reveal how an array of std::string...
4.06 TemperatureConverter
Converting temperature sensor readings stored in arrays. We explore the memory difference between float (32-bit IEEE...
4.07 2DArrayFun
Deep dive into two-dimensional arrays in C++. We examine row-major contiguous memory layouts, why row-first iteration...
4.08 MoveRatings
Manipulating 2D data grids with nested loops. We explore matrix processing patterns, row vs column accumulation, and...
4.09 VectorFun
Exploring dynamic arrays via std::vector. We analyze capacity vs size, geometric heap reallocation mechanics, pointer...
4.10 VectorPractice
Practicing vector modification operations: push_back, pop_back, and insert. We examine the O(N) element shifting cost...
4.11 ShoppingList
Building dynamic list management with interactive user input. We contrast general-purpose dynamic list manipulation...
5.01 FunctionFun1
Exploring function prototypes, definitions, and execution flow. We analyze the ARM Architecture Procedure Call Standard...
5.02 PassingSchemes
Comprehensive comparative study of the three parameter passing schemes: pass-by-value, pass-by-reference (&), and...
5.03 FunctionOverloading
Analyzing function overloading in C++. We examine compiler name mangling, resolving ambiguous type promotions, and how...
5.04 FactorialFun
Exploring recursive algorithms vs iterative implementations. We demonstrate why unbounded recursion is banned in...
5.05 MathFun
Exploring mathematical functions in (pow, sqrt, abs). We analyze why generic floating-point math libraries cause Flash...
5.06 CountDown
Exploring loop countdowns and delays. We demonstrate why software busy-wait loops (for(volatile int i=0...)) waste...
5.07 CountEvens
Analyzing parity checks and filtering in arrays. We contrast expensive hardware division (num % 2) with single-cycle...
5.08 AverageOfThree
Calculating statistical averages. We explore integer division truncation, precision loss in sensor data processing, and...
5.09 ParameterChallenge
Exploring functions that return multiple values via pass-by-reference out-parameters. We compare legacy out-parameters...
5.10 ProductArrayByReference
Passing fixed arrays by reference (int(&)[N]) to prevent pointer decay. We analyze template-based array references and...
5.11 ProductArrayObject
Using std::array as an object container. We demonstrate how std::array provides STL iterator compatibility (begin/end)...
5.12 ReturnTypeParameterFun
Exploring return types and function side effects. We examine pure functions vs state-mutating functions and demonstrate...
5.13 ScopeFun
Analyzing variable scope and lifetime: local (automatic stack), global, and local static storage. We analyze the memory...
5.14 ScopeChallenge
Practicing scope resolution and diagnosing variable shadowing bugs. We explore anonymous namespaces in C++ vs static...
5.15 TicTacToe
Building a full interactive Tic-Tac-Toe system. We analyze functional modular decomposition, separation of display...
6.01 BookFun
Exploring foundational C++ classes: access specifiers (public vs private), member functions, constructors, and...
6.02 RectangleFun
Building geometric classes with constructors and member initializer lists. We analyze why member initializer lists are...
6.03 Houses
Instantiating and managing multiple distinct class objects. We examine memory footprints of multiple instances in SRAM,...
6.04 LibraryCardProject
Designing classes that enforce strict data validation rules through encapsulation. We analyze invariant preservation in...
6.05 SundaeProject
Building composite objects through composition (HAS-A relationships). We examine constructor and destructor execution...
6.06 TriangleProject
Building validated geometric triangle classes enforcing the Triangle Inequality Theorem. We explore how global object...
Track 2: Advanced Systems, Real-Time Hardware & Memory
Sections 7 through 12 • Projects 7.01 β 12.10 • Fault Handlers, Memory-Mapped I/O, Flash File Systems, Polymorphism & CRTP, Modern STL & Data Structures
7.01 BugFun
Exploring the taxonomy of bugs: syntax errors, runtime faults, and subtle logic errors. In bare-metal systems, logic...
7.02 CustomExceptions
Building domain-specific exception hierarchies by inheriting from std::runtime_error and std::exception. We analyze how...
7.03 DogFun
Enforcing domain invariants through constructor validation and member validation methods. We examine the classic C++...
7.04 ExceptionFun1
Foundational try, throw, and catch mechanics in C++. We examine standard runtime exceptions (std::runtime_error), how...
7.05 FuelMonitorProject
Building a safety-critical fuel level monitoring system with custom exception triggers. We analyze how embedded systems...
7.06 LogicErrorFun
Analyzing std::logic_error and std::out_of_range exceptions in C++. We explore how out-of-bounds memory accesses...
7.07 MonthNameProject
Validating user input ranges and mapping integer IDs to string representations. We contrast exception-based validation...
7.08 PersonFun
Deep dive into throwing exceptions from class constructors. We examine the classic C++ memory leak hazard when...
7.09 RethrowFun1
Examining multi-layered exception handling and exception rethrowing with throw;. We contrast standard C++ exception...
8.01 PointerFun
Exploring the fundamentals of pointers: memory addresses, the address-of operator (&), and dereferencing (*). In...
8.02 ConstCorrectness
Mastering the four permutations of const with pointers: mutable pointer to mutable data, pointer to const data, const...
8.03 DynamicFun
Analyzing dynamic memory allocation via new and delete, pointer resets to nullptr, and dangling pointer hazards. We...
8.04 DynamicDogs
Exploring object member access via pointer: the arrow operator (->) vs explicit dereferencing (*ptr).member. We analyze...
8.05 DynamicArrayTest
Analyzing dynamic array allocation with new[] and deallocation with delete[]. We explain the undefined behavior of...
8.06 DroneFleet
Analyzing dynamic fleet management using double pointer indirection (Drone**). We contrast pointer-to-pointer...
8.07 ExhibitTracker
Tracking museum exhibits via a fixed array of heap pointers (Exhibit* exhibitPtrs[COUNT]). We explore the cleanup...
9.01 FileInputFun
Exploring file reading via std::ifstream. We analyze file stream opening, buffer extraction, EOF detection, and...
9.02 FileOutputFun
Exploring file writing via std::ofstream. We analyze write buffering, explicit stream flushing, the severe hazard of...
9.03 TwiceFile
Building read-transform-write file pipelines. We analyze streaming mathematical transformation of files and compare...
9.04 NamesAges
Synchronizing parallel file streams (names.txt and ages.txt). We analyze stream synchronization, detecting mismatched...
9.05 MovieGenres
Analyzing category frequency distributions and histograms from file streams. We explore fixed-size category binning,...
9.06 EmployeeSalaryReport
Generating formatted tabular text reports using (std::setw, std::setprecision, std::fixed). We analyze table column...
9.07 StudentRoster
Building class object serialization and roster persistence. We compare text-based serialization with raw binary struct...
10.01 EnumFun
Explores the transition from legacy C-style unscoped enum to modern C++11 enum class. Examines type safety, namespace...
10.02 AnimalFun
Exploring abstract classes, pure virtual functions, and dynamic polymorphism. We analyze the underlying VTable and VPtr...
10.03 RPGProject
Building complete class hierarchies with character progression systems. We analyze constructor member initialization...
11.01 SmartPointerFun
Deep dive into deterministic memory ownership via std::unique_ptr. Explores move semantics, zero-overhead memory...
11.02 RuleOfThreeFiveZeroApp
Mastering resource management under C++11/14. We analyze the Rule of Three, the Rule of Five (move semantics), and the...
11.03 MapVsUnorderedMappApp
Comparing ordered Red-Black Trees (std::map) against bucket-based Hash Tables (std::unordered_map). We explore time...
11.04 QueueProjects
Exploring FIFO queue operations and why std::queue (backed by std::deque) is replaced in embedded firmware by bounded,...
11.05 RemoveEraseIdiomApp
Understanding the separation of algorithms from containers in C++. We dissect why std::remove does not alter container...
11.06 Templates
Exploring generic function and class templates. We examine compile-time monomorphization, compare zero-overhead...
11.07 RulesChallenge
Hands-on implementation of a custom dynamic buffer class adhering to the Rule of Three. We inspect deep copy...
11.08 AlgorithmFun
Exploring the standard algorithm library. We demonstrate why C++ templates and lambdas outperform traditional C qsort()...
11.09 STLFun1
Dissecting std::vector mechanics. We explore geometric capacity doubling, sudden heap reallocations during push_back(),...
11.10 AdvancedSTLApp
Comparing non-contiguous containers (std::deque, std::list) against contiguous arrays. We examine CPU cache lines, L1...
11.11 AdvancedSTLChallengeApp
Hands-on challenge manipulating STL containers, demonstrating selection guidelines based on insertion patterns, search...
11.12 CarProject
Demonstrating class encapsulation, private data invariants, and composition to model automotive subsystems.
11.13 ContactsFun
Using associative mappings for key-value pair storage, with focus on lookup mechanics and embedded ROM alternative...
11.14 CropHybridizationSimulator
Exploring value types and operator overloading in simulation modeling.
11.15 FriendFun
Understanding the friend keyword to grant privileged internal access to helper classes without exposing raw registers...
11.16 LanguageTranslatorProject
Building dictionary lookups and evaluating Flash ROM constexpr lookup tables for embedded systems.
11.17 OverloadingFun
Exploring operator overloading (+, ==, <<). We show how embedded systems use operator overloading to build type-safe...
11.18 StackFun
Understanding LIFO stack adapters. We compare data structure stacks with the hardware MCU execution stack, explore...
11.19 SwapperTest
Implementing generic swap templates using reference passing without heap allocations.
12.01 ArrayQueueApp
Deep dive into circular array queue data structures. We examine index wrapping using modulo arithmetic, full/empty...
12.02 ArrayListApp
Building a custom dynamic array list implementing an abstract List interface. We analyze growth factors, amortized...
12.03 ArrayStackApp
Implementing a bounded array stack. We explore top index manipulation, push/pop mechanics, and deterministic execution.
12.04 LinkedChainFun
Exploring explicit node pointer linking and traversing heap-allocated structures.
12.05 LinkedListApp
Building a full linked list data structure implementing List<T>. We examine insertion/deletion at arbitrary positions,...
12.06 LinkedQueueProject
Implementing a node-based FIFO queue with front and rear pointers, contrasting its memory footprint with array ring...
12.07 LinkedStackApp
Implementing a node-based dynamic stack, analyzing push/pop pointer manipulation and cleanup.
12.08 ListStackProject
Demonstrating the Adapter design pattern by implementing a Stack interface over an underlying LinkedList.
12.09 TemplatedArrayStackApp
Implementing a generic templated array stack. We explore type-safe compile-time instantiations, bounded memory...
12.10 _for-proj12-2-files
Comparative architectural review of custom data structure implementations across performance, footprint, and...