Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add parameter to force a failed assert #1295

Merged
merged 1 commit into from
Jun 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/modules/src/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ static bool isInit;

static char nrf_version[16];
static uint8_t testLogParam;
static uint8_t doAssert;

STATIC_MEM_TASK_ALLOC(systemTask, SYSTEM_TASK_STACKSIZE);

Expand Down Expand Up @@ -408,6 +409,12 @@ void vApplicationIdleHook( void )
#endif
}

static void doAssertCallback(void) {
if (doAssert) {
ASSERT_FAILED();
}
}

/**
* This parameter group contain read-only parameters pertaining to the CPU
* in the Crazyflie.
Expand Down Expand Up @@ -456,6 +463,13 @@ PARAM_ADD(PARAM_UINT8, assertInfo, &dumpAssertInfo)
*/
PARAM_ADD(PARAM_UINT8, testLogParam, &testLogParam)

/**
* @brief Set to non-zero to trigger a failed assert, useful for debugging
*
*/
PARAM_ADD_WITH_CALLBACK(PARAM_UINT8, doAssert, &doAssert, doAssertCallback)


PARAM_GROUP_STOP(system)

/**
Expand Down