nRF5 SDK for Mesh v5.0.0
Macros | Functions
Assert API

Allows the framework to propagate errors that can't be recovered from. More...

Macros

#define NRF_MESH_ASSERT(cond)
 Run-time assertion. More...
 
#define NRF_MESH_ASSERT_DEBUG(cond)   NRF_MESH_ASSERT(cond)
 Run-time assertion for debug use. More...
 
#define NRF_MESH_ERROR_CHECK(err)   NRF_MESH_ASSERT(err == NRF_SUCCESS)
 Asserts if an error code is not NRF_SUCCESS. More...
 
#define NRF_MESH_STATIC_ASSERT(...)   STATIC_ASSERT(__VA_ARGS__)
 Compile-time assertion.
 

Functions

void mesh_assertion_handler (uint32_t pc)
 
#define HARD_FAULT()   __breakpoint(0)
 Produces a hardfault. More...
 
#define GET_PC(pc)
 Gets the current value of the program counter. More...
 
#define HARD_FAULT()   __asm__ volatile(".inst.n 0xde00\n")
 Produces a hardfault. More...
 
#define GET_PC(pc)   __asm__ volatile("mov %0, pc\n\t" : "=r" (pc))
 Gets the current value of the program counter. More...
 
#define HARD_FAULT()   abort()
 Produces a hardfault. More...
 
#define GET_PC(pc)   pc = 0xffffffff
 Gets the current value of the program counter. More...
 

Detailed Description

Allows the framework to propagate errors that can't be recovered from.

Macro Definition Documentation

◆ NRF_MESH_ASSERT

#define NRF_MESH_ASSERT (   cond)
Value:
do \
{ \
if (!(cond)) \
{ \
uint32_t pc; \
GET_PC(pc); \
mesh_assertion_handler(pc); \
} \
} while (0)

Run-time assertion.

Will trigger the assertion handler if the specified condition evaluates to false.

Parameters
[in]condCondition to evaluate.

Definition at line 69 of file nrf_mesh_assert.h.

Referenced by sensor_property_id_supported().

◆ NRF_MESH_ASSERT_DEBUG

#define NRF_MESH_ASSERT_DEBUG (   cond)    NRF_MESH_ASSERT(cond)

Run-time assertion for debug use.

Debug assertions are only run if the stack is compiled in debug mode.

Definition at line 87 of file nrf_mesh_assert.h.

◆ NRF_MESH_ERROR_CHECK

#define NRF_MESH_ERROR_CHECK (   err)    NRF_MESH_ASSERT(err == NRF_SUCCESS)

Asserts if an error code is not NRF_SUCCESS.

Parameters
[in]errError code to check.

Definition at line 94 of file nrf_mesh_assert.h.

◆ HARD_FAULT [1/3]

#define HARD_FAULT ( )    __breakpoint(0)

Produces a hardfault.

Definition at line 60 of file nrf_mesh_assert_armcc.h.

◆ HARD_FAULT [2/3]

#define HARD_FAULT ( )    __asm__ volatile(".inst.n 0xde00\n")

Produces a hardfault.

Definition at line 69 of file nrf_mesh_assert_gcc.h.

◆ HARD_FAULT [3/3]

#define HARD_FAULT ( )    abort()

Produces a hardfault.

Definition at line 58 of file nrf_mesh_assert_lint.h.

◆ GET_PC [1/3]

#define GET_PC (   pc)
Value:
do { \
pc = __current_pc(); \
} while (0)

Gets the current value of the program counter.

Parameters
[out]pcVariable to assign the obtained value to.

Definition at line 66 of file nrf_mesh_assert_armcc.h.

◆ GET_PC [2/3]

#define GET_PC (   pc)    __asm__ volatile("mov %0, pc\n\t" : "=r" (pc))

Gets the current value of the program counter.

Parameters
[out]pcVariable to assign the obtained value to.

Definition at line 75 of file nrf_mesh_assert_gcc.h.

◆ GET_PC [3/3]

#define GET_PC (   pc)    pc = 0xffffffff

Gets the current value of the program counter.

Parameters
[out]pcVariable to assign the obtained value to.

Definition at line 64 of file nrf_mesh_assert_lint.h.


Documentation feedback | Developer Zone | Subscribe | Updated