Epicardium Internal APIs

Core OS APIs

Panic

Panicking should be used in situations where no automatic recovery is possible of where a fatal bug was detected. Calling panic() will show a message on the screen and serial console and then reboot the device.

Keep in mind that screen space is limited and thus the message should be as concise as possible.

void panic(const char *format, ...)

Trigger a firmware panic.

This function will not return but instead reboot the device. No synchronization of e.g. the filesystem is done so this could potentially lead to data loss.

Logging

All logging macros take a “subsystem” and a log message. This subsystem argument should be used to uniquely identify where a message came from.

Example:

LOG_ERR("pmic",
        "Failed reading battery voltage: %s (%d)",
        strerror(-res),
        res);
LOG_INFO(subsys, format, ...)
LOG_WARN(subsys, format, ...)
LOG_ERR(subsys, format, ...)
LOG_CRIT(subsys, format, ...)
LOG_DEBUG(subsys, format, ...)

Only prints when debug logging is enabled in the meson configuration.