Hello, when reading the source code for a mesh node provisionee, I stumbled upon this MACRO function:
NRF_MESH_ASSERT
Edit: it is in ble_mesh_v0.9.1-Alpha\mesh\src\core\packet_mgr.c
it is defined as:
#define NRF_MESH_ASSERT(cond) if (!(cond)) \
{ \
uint32_t pc; \
GET_PC(pc); \
if (m_assertion_handler) \
{ \
m_assertion_handler(pc); \
} \
else \
{ \
HARD_FAULT(); \
} \
}
There are quite a few lines of and within this function which confuse me due to their difficulties (and in any case, I'm not a huge fan of MACRO functions) but I'll just ask about 2 places which puzzles me the most:
#Question #1:
the
GET_PC(pc);
is defined as:
#define GET_PC(__pc) do { \
__pc = __current_pc(); \
} while (0)
Would I be correct in assuming that
__current_pc()
is some sort of compiler function or lower-level library function which returns the realtime/ during run-time PC counter value?
#Question #2:
What is the purpose of this function? To make sure last_block_size is actually greater than 0?
Please provide help, thank you!