Mistake on this page?
Report an issue in GitHub or email us
Static Public Member Functions
ResetReason Class Reference

A platform-independent method of checking the cause of the last system reset. More...

#include <ResetReason.h>

Static Public Member Functions

static reset_reason_t get ()
 Get the platform independent reason code for the last system reset. More...
 
static uint32_t get_raw ()
 Get the platform specific reason code for the last system reset. More...
 

Detailed Description

A platform-independent method of checking the cause of the last system reset.

When the system restarts, the reason for the restart is contained in the system registers at boot time in a platform specific manner. This API provides a generic method of fetching the reason for the restart.

Definition at line 39 of file ResetReason.h.

Member Function Documentation

static reset_reason_t get ( )
static

Get the platform independent reason code for the last system reset.

Returns
enum containing the last reset reason for the board.

Example:

if (reason == RESET_REASON_WATCHDOG) {
printf("Watchdog reset\n");
rollback();
}
static uint32_t get_raw ( )
static

Get the platform specific reason code for the last system reset.

Platform specific reasons that are not covered by the reset_reason_t enum will cause the ResetReason::get() function to return RESET_REASON_PLATFORM. In order to get the actual reason the register value must be fetched directly using this function and interpreted in a platform specific manner.

Returns
value containing the reset reason register for the given platform. If the platform contains reset reasons across multiple registers they will be concatenated here.

Example:

const uint32_t platform_reason = ResetReason::get_raw();
}
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.