System

A hardware independent interface for starting and resetting the system.

Description

The API allows the user to detect whether a debugger is connected, sissue a soft reset, and enumerate the reset causes. The functions are implemented in the MCU specific directories e.g. hal_reset_cause.c, hal_system.c, and hal_system_start.c in /hw/mcu/nordic/nrf52xxx/src/ directory for Nordic nRF52 series of chips.

API

enum hal_reset_reason

Reboot reason.

Values:

enumerator HAL_RESET_POR

Power on Reset.

enumerator HAL_RESET_PIN

Caused by Reset Pin.

enumerator HAL_RESET_WATCHDOG

Caused by Watchdog.

enumerator HAL_RESET_SOFT

Soft reset, either system reset or crash.

enumerator HAL_RESET_BROWNOUT

Low supply voltage.

enumerator HAL_RESET_REQUESTED

Restart due to user request.

enumerator HAL_RESET_SYS_OFF_INT

System Off, wakeup on external interrupt.

void hal_system_reset (void) __attribute((noreturn))

System reset.

void hal_system_start (void *img_start) __attribute((noreturn))

Called by bootloader to start loaded program.

void hal_system_restart (void *img_start) __attribute((noreturn))

Called by split app loader to start the app program.

int hal_debugger_connected(void)

Returns non-zero if there is a HW debugger attached.

enum hal_reset_reason hal_reset_cause(void)

Return the reboot reason.

Return

A reboot reason

const char *hal_reset_cause_str(void)

Return the reboot reason as a string.

Return

String describing previous reset reason

void hal_system_clock_start(void)

Starts clocks needed by system.

void hal_system_reset_cb(void)

Reset callback to be called before an reset happens inside hal_system_reset()