SpeyTech/c-from-scratch
Tentang
Pelajari cara membangun sistem yang kritis bagi keselamatan dengan C. Buktikan terlebih dahulu, baru tulis kodenya.
Pembelajaran dan pendidikanPertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- 0
- dalam 15 hari
- 0
- dalam 1 bulan
- Mengumpulkan riwayat
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliC From Scratch
Learn to build safety-critical systems in C.
Not "Hello World". Real kernels. Mathematical rigour. Zero dependencies.
"Math → Struct → Code → Test"
📘 The Book
C From Scratch: Learn Safety-Critical C the Right Way
The complete guide to writing C that doesn't just work — it provably works.
What you'll learn:
- The MATH → STRUCT → CODE → TEST methodology
- Fixed-width integers and why
intkills rockets (Ariane 5) - Contracts, preconditions, and invariants
- State machines that can't enter invalid states
- Memory safety without garbage collection
- The path from learning to DO-178C / IEC 62304 / ISO 26262 certification
What you won't find:
- "It works on my machine"
- Undefined behaviour swept under the rug
mallocin safety-critical code- Tutorials that teach bad habits
Philosophy
Most tutorials teach you to write code that seems to work.
This course teaches you to write code that provably works.
The method:
- Define the problem mathematically
- Prove correctness formally
- Design structs that embody the proof
- Transcribe the math into C
- Test against the contracts
┌─────────────────────────────────────────────────────────────┐
│ THE APPROACH │
├─────────────────────────────────────────────────────────────┤
│ │
│ Problem ──► Math Model ──► Proof ──► Structs │
│ │ │
│ ▼ │
│ Verification ◄── Code │
│ │
└─────────────────────────────────────────────────────────────┘
The Seven Foundation Modules
| Module | Question | Role | Tests |
|---|---|---|---|
| Pulse | Does it exist? | Sensor | ✓ |
| Baseline | Is it normal? | Sensor | 18/18 |
| Timing | Is it regular? | Sensor | ✓ |
| Drift | Is it trending toward failure? | Sensor | 15/15 |
| Consensus | Which sensor to trust? | Judge | 17/17 |
| Pressure | How to handle overflow? | Buffer | 16/16 |
| Mode | What do we do about it? | Captain | 17/17 |
Plus: Integration Example — All modules working together.
The Safety Stack
┌─────────────────────────────────────────────────────────────────────┐
│ MODULE 7: MODE MANAGER │
│ "The Captain" │
│ Decides: What mode? What actions allowed? │
└─────────────────────────────────────────────────────────────────────┘
↑
┌─────────────────────────────────────────────────────────────────────┐
│ MODULE 6: PRESSURE │
│ "The Buffer" │
└─────────────────────────────────────────────────────────────────────┘
↑
┌─────────────────────────────────────────────────────────────────────┐
│ MODULE 5: CONSENSUS │
│ "The Judge" │
└─────────────────────────────────────────────────────────────────────┘
↑
┌───────────────────┼───────────────────┐
▼ ▼ ▼
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ CHANNEL 0 │ │ CHANNEL 1 │ │ CHANNEL 2 │
│ Pulse → Base │ │ Pulse → Base │ │ Pulse → Base │
│ → Timing │ │ → Timing │ │ → Timing │
│ → Drift │ │ → Drift │ │ → Drift │
│ "Sensors" │ │ "Sensors" │ │ "Sensors" │
└─────────────────┘ └─────────────────┘ └─────────────────┘
Core Properties
Every module is:
- Closed — No external dependencies at runtime
- Total — Handles all possible inputs
- Deterministic — Same inputs → Same outputs
- O(1) — Constant time, constant space
- Contract-defined — Behaviour is specified, not implied
Getting Started
# Clone
git clone https://github.com/SpeyTech/c-from-scratch.git
cd c-from-scratch
# Try any module
cd projects/pulse
make && make test && make demo
# Or run the full integration
cd projects/integration
make run
Start with Pulse Lesson 1: The Problem.
Specification
See SPEC.md for the complete framework specification:
- Core principles
- Module structure
- Contract definitions
- Composition rules
- Certification alignment (DO-178C, IEC 62304, ISO 26262)
Related Projects
This course is part of the SpeyTech ecosystem for deterministic, certifiable systems:
| Project | Description |
|---|---|
| Fixed-Point Fundamentals | Free course on fixed-point arithmetic |
| certifiable-* | Deterministic ML pipeline with cryptographic verification |
| C-Sentinel | Semantic security monitoring in pure C |
Who This Is For
- Developers building safety-critical software
- Systems programmers who want provable correctness
- Students learning C the rigorous way
- Anyone tired of "it works on my machine"
Prerequisites
- Basic C syntax (variables, functions, structs)
- Comfort with command line
- Willingness to think before coding
Author
William Murray — 30 years UNIX systems engineering
- GitHub: @SpeyTech
- LinkedIn: William Murray
- Website: speytech.com
License
MIT — See LICENSE
"Sensors report. The Captain decides."
Jelajahi proyek terkait
Memuat…