Morse Micro IoT SDK  2.6.4-esp32

Detailed Description

Provides support for assertions and logging failure data.

Data Structures

struct  mmosal_failure_info
 Data structure used to store information about a failure that can be preserved across reset. More...
 

Macros

#define MMOSAL_FILEID   0
 File identifier: if not provided by compiler then define to zero. More...
 
#define MMOSAL_LOG_FAILURE_INFO(...)
 Initialize a mmosal_failure_info struct based on current state and invoke mmosal_log_failure_info(). More...
 
#define MMOSAL_ASSERT(expr)
 Assert that the given expression evaluates to true and abort execution if not. More...
 
#define MMOSAL_ASSERT_LOG_DATA(expr, ...)
 Assert that the given expression evaluates to true and abort execution if not. More...
 

Functions

void mmosal_log_failure_info (const struct mmosal_failure_info *info)
 Log failure information in a way that it is preserved across reboots so that it can be available for postmortem analysis. More...
 
void mmosal_impl_assert (void)
 Assertion handler implementation. More...
 

Macro Definition Documentation

◆ MMOSAL_ASSERT

#define MMOSAL_ASSERT (   expr)
Value:
do { \
if (!(expr)) { \
MMOSAL_LOG_FAILURE_INFO(0); \
mmosal_impl_assert(); \
while (1) \
{} \
} \
} while (0)

Assert that the given expression evaluates to true and abort execution if not.

Parameters
exprExpression to evaluation. If it evaluates to false then the assertion handler will be triggered.

Definition at line 967 of file mmosal.h.

◆ MMOSAL_ASSERT_LOG_DATA

#define MMOSAL_ASSERT_LOG_DATA (   expr,
  ... 
)
Value:
do { \
if (!(expr)) { \
MMOSAL_LOG_FAILURE_INFO(__VA_ARGS__); \
mmosal_impl_assert(); \
while (1) \
{} \
} \
} while (0)

Assert that the given expression evaluates to true and abort execution if not.

Parameters
exprExpression to evaluation. If it evaluates to false then the assertion handler will be triggered.
...Up to 4 32-bit unsigned integers to log.

Definition at line 986 of file mmosal.h.

◆ MMOSAL_FILEID

#define MMOSAL_FILEID   0

File identifier: if not provided by compiler then define to zero.

Definition at line 904 of file mmosal.h.

◆ MMOSAL_LOG_FAILURE_INFO

#define MMOSAL_LOG_FAILURE_INFO (   ...)
Value:
do { \
void *pc; \
struct mmosal_failure_info info = { \
.lr = (uint32_t)MMPORT_GET_LR(), \
.fileid = MMOSAL_FILEID, \
.line = __LINE__, \
.platform_info = { __VA_ARGS__ }, \
}; \
MMPORT_GET_PC(pc); \
info.pc = (uint32_t)pc; \
mmosal_log_failure_info(&info); \
} while (0)
#define MMOSAL_FILEID
File identifier: if not provided by compiler then define to zero.
Definition: mmosal.h:904
Data structure used to store information about a failure that can be preserved across reset.
Definition: mmosal.h:909
uint32_t lr
Content of the LR register at assertion.
Definition: mmosal.h:913

Initialize a mmosal_failure_info struct based on current state and invoke mmosal_log_failure_info().

Definition at line 937 of file mmosal.h.

Function Documentation

◆ mmosal_impl_assert()

void mmosal_impl_assert ( void  )

Assertion handler implementation.

Note
This function does not return.

◆ mmosal_log_failure_info()

void mmosal_log_failure_info ( const struct mmosal_failure_info info)

Log failure information in a way that it is preserved across reboots so that it can be available for postmortem analysis.

Parameters
infoFailure information to log.