Skip to content

Vanderhell/microboot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

microboot

CI License: MIT C99

Boot and recovery manager for embedded systems.

C99 | Zero dependencies | Zero allocations | Callback-driven | Portable

Why microboot

Without a startup orchestrator, devices can get stuck in crash loops: boot, fail, reset, repeat.

microboot tracks boot history, detects crash loops, and lets you switch into a recovery strategy before a device gets stuck permanently.

Features

  • Boot reason detection (cold, watchdog, crash dump, brownout, user)
  • Crash loop detection with configurable threshold
  • Boot mode decision (NORMAL, RECOVERY, SAFE, FACTORY)
  • Persistent CRC-protected boot record
  • Clean shutdown tracking
  • Boot confirmation hook to reset crash counter
  • Last uptime tracking for diagnostics

Quick start

mboot_t boot;
mboot_init(&boot, &flash_io, HAL_GetTick);
mboot_start(&boot);

switch (mboot_mode(&boot)) {
case MBOOT_MODE_NORMAL:
    start_application();
    mboot_confirm(&boot);
    break;
case MBOOT_MODE_RECOVERY:
    start_recovery_server();
    break;
case MBOOT_MODE_FACTORY:
    load_factory_defaults();
    start_application();
    break;
default:
    break;
}

Build and test

Linux/macOS:

cd tests
make

Windows (MSYS2/MinGW shell):

cd tests
make

Configuration

Macro Default Description
MBOOT_CRASH_LOOP_THRESHOLD 3 Crashes before recovery mode
MBOOT_CRASH_WINDOW_MS 30000 Time window for crash counting
MBOOT_MAGIC 0x424F4F54 Record validation magic

Repository structure

  • include/mboot.h: public API
  • src/mboot.c: implementation
  • tests/test_all.c: test suite
  • docs/: design and integration docs

Documentation

CI

GitHub Actions workflow runs build and tests on each push and pull request to master.

License

MIT License, Copyright (c) 2026 Vanderhell. See LICENSE.

About

Boot and recovery manager for embedded systems (C99), focused on crash-loop detection, startup mode selection, and portable callback-based integration.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors