Morse Micro IoT SDK  2.10.4

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_MAX_FAILURE_RECORDS   4
 Maximum number of failure records to buffer (must be a power of 2). 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...
 
#define MMOSAL_DEV_ASSERT(x)   ((void)(x))
 Assertions that are only enabled for debug builds. More...
 
#define MMOSAL_DEV_ASSERT_LOG_DATA(x, ...)   ((void)(x))
 Assertions that are only enabled for debug builds (with support for up to 4 uint32_t's to be logged). 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 934 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 955 of file mmosal.h.

◆ MMOSAL_DEV_ASSERT

#define MMOSAL_DEV_ASSERT (   x)    ((void)(x))

Assertions that are only enabled for debug builds.

Definition at line 982 of file mmosal.h.

◆ MMOSAL_DEV_ASSERT_LOG_DATA

#define MMOSAL_DEV_ASSERT_LOG_DATA (   x,
  ... 
)    ((void)(x))

Assertions that are only enabled for debug builds (with support for up to 4 uint32_t's to be logged).

Definition at line 985 of file mmosal.h.

◆ MMOSAL_FILEID

#define MMOSAL_FILEID   0

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

Definition at line 862 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:862
Data structure used to store information about a failure that can be preserved across reset.
Definition: mmosal.h:875
uint32_t lr
Content of the LR register at assertion.
Definition: mmosal.h:879

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

Definition at line 903 of file mmosal.h.

◆ MMOSAL_MAX_FAILURE_RECORDS

#define MMOSAL_MAX_FAILURE_RECORDS   4

Maximum number of failure records to buffer (must be a power of 2).

Defaults to 4 if no platform-specific definition exists.

Definition at line 870 of file mmosal.h.

Function Documentation

◆ mmosal_impl_assert()

void mmosal_impl_assert ( void  )

Assertion handler implementation.

Note
This function does not return.

Definition at line 108 of file mmosal_shim_bootloader.c.

◆ 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.

Definition at line 115 of file mmosal_shim_bootloader.c.