GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Vanderhell/microassert: Unified panic and assert system for embedded C projects (C99), with hook chain, panic history, and configurable severity handling (WARN/ERROR/FATAL/HALT).

BranchesTags
Open more actions menu

Latest commit

 

History

15 Commits
15 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
cmake
cmake
 
 
docs
docs
 
 
include
include
 
 
src
src
 
 
tests
tests
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
SECURITY.md
SECURITY.md
 
 

Repository files navigation

microassert

CI License: MIT C99

microassert is a small assert and panic library for C and C++ consumers. It has no third-party dependencies and formats messages with the standard C library vsnprintf.

Features

  • explicit, status-returning initialization
  • caller-owned hook storage and retained history storage
  • WARN, ERROR, FATAL, and HALT severities
  • copied history entries with bounded text buffers
  • deterministic nested-panic handling and terminal callbacks
  • C99 minimum, C11-compatible source
  • C and C++ header compatibility

Quick Start

#include "massert.h"

static uint32_t clock_ms(void)
{
    return 1234u;
}

static void reset_cb(void *ctx)
{
    (void)ctx;
}

static void halt_cb(void *ctx)
{
    (void)ctx;
}

int main(void)
{
    massert_hook_slot_t hooks[2];
    massert_history_entry_t history[4];
    massert_t ma;
    massert_config_t config = {
        hooks,
        2u,
        history,
        4u,
        clock_ms,
        reset_cb,
        NULL,
        halt_cb,
        NULL
    };

    if (massert_init(&ma, &config) != MASSERT_STATUS_OK) {
        return 1;
    }

    MASSERT_WARN(1 == 1, "not reached");
    MASSERT_MSG(2 == 3, "mismatch: %d", 3);
    MPANIC("fatal condition");
}

Build

Direct Makefile workflow:

mingw32-make test

CMake workflow:

cmake -S . -B build -G Ninja -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++
cmake --build build
ctest --test-dir build --output-on-failure
cmake --install build --prefix /tmp/microassert-install

Public API

  • massert_init() validates caller storage and copies callbacks by value.
  • massert_set_reset() and massert_set_halt() reject mutation while a panic is active.
  • massert_fire() routes WARN and ERROR back to the caller, while FATAL and HALT are terminal.
  • massert_panic_fatal() calls reset, then halt if reset returns, then spins.
  • massert_panic_halt() calls halt, then spins if halt returns.
  • massert_history_at() returns retained copied history, valid until overwritten or reinit.

Notes

  • Hooks are best-effort and do not guarantee logging, persistence, or flushing.
  • The global singleton is deterministic, but the library is not thread-safe.
  • FATAL and HALT do not unwind C frames or run C++ destructors.
  • Hardware fault handling, signals, and power-loss recovery are outside the library contract.

Documentation

  • API reference
  • Cookbook
  • Design notes
  • Porting guide
  • Troubleshooting
  • Verification notes
  • Contributing
  • Security policy
  • Changelog

License

MIT, see LICENSE.

About

Unified panic and assert system for embedded C projects (C99), with hook chain, panic history, and configurable severity handling (WARN/ERROR/FATAL/HALT).

Topics

assertbare-metalcc99diagnosticsembeddederror-handfirmwarelibrarypanic

Resources

Readme
MIT license

Contributing

Contributing

Security policy

Security policy
Activity

Stars

1 star

Watchers

0 watching

Forks

1 fork
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.