File syn_boot.c¶
FileList > src > syntropic > system > syn_boot.c
Go to the source code of this file
Boot manager implementation.
#include "../system/syn_errlog.h"#include "../util/syn_assert.h"#include "syn_boot.h"#include <string.h>
Public Functions¶
| Type | Name |
|---|---|
| SYN_Status | syn_boot_clear_safe_mode (SYN_Boot * boot) Force clear safe mode and reset fail counter. |
| SYN_Status | syn_boot_init (SYN_Boot * boot, SYN_ParamStore * store, uint16_t safe_threshold) Initialize the boot manager. |
| void | syn_boot_log_events (SYN_Boot * boot) Log boot events to errlog. |
| SYN_Status | syn_boot_mark_healthy (SYN_Boot * boot) Mark this boot as healthy. |
| void | syn_boot_set_errlog (SYN_Boot * boot, SYN_ErrLog * errlog) Set the errlog instance for boot event recording. |
| void | syn_boot_set_reset_reason (SYN_Boot * boot, uint8_t reason) Set the reset reason for the current boot. |
Macros¶
| Type | Name |
|---|---|
| define | SYN_BOOT_ERR_CRASH_LOOP 0x0300 |
| define | SYN_BOOT_ERR_SAFE_MODE 0x0301 |
Public Functions Documentation¶
function syn_boot_clear_safe_mode¶
Force clear safe mode and reset fail counter.
Use from CLI to recover from safe mode.
Parameters:
bootBoot manager.
Returns:
SYN_OK on success.
function syn_boot_init¶
Initialize the boot manager.
Loads boot data from flash, increments boot counter, checks for crash loops. Call this very early in boot.
Parameters:
bootBoot manager instance.storeInitialized parameter store for boot data.safe_thresholdNumber of consecutive failed boots before safe mode. Set to 0 to disable safe mode detection.
Returns:
SYN_OK on normal boot, SYN_ERROR on first-ever boot (no data).
function syn_boot_log_events¶
Log boot events to errlog.
Records crash-loop (non-healthy previous boot) and safe-mode entry events. Call after syn_boot_set_errlog().
Parameters:
bootBoot manager.
function syn_boot_mark_healthy¶
Mark this boot as healthy.
Call after your application has started successfully (e.g., after all peripherals initialized, comms established). Resets the fail counter.
Parameters:
bootBoot manager.
Returns:
SYN_OK on success.
function syn_boot_set_errlog¶
Set the errlog instance for boot event recording.
Call after both boot and errlog are initialized, then call syn_boot_log_events() to retroactively log boot-related events.
Parameters:
bootBoot manager.errlogInitialized error log instance.
function syn_boot_set_reset_reason¶
Set the reset reason for the current boot.
Call before saving (or it gets saved on next boot_init).
Parameters:
bootBoot manager.reasonReset reason code (SYN_ResetReason or custom).
Macro Definition Documentation¶
define SYN_BOOT_ERR_CRASH_LOOP¶
Repeated crash detected.
define SYN_BOOT_ERR_SAFE_MODE¶
Entered safe mode.
The documentation for this class was generated from the following file src/syntropic/system/syn_boot.c