Skip to content

[RTOS] Improved Error Functions #1716

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

Merged
merged 1 commit into from
May 5, 2016
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
7 changes: 3 additions & 4 deletions libraries/rtos/rtx/TARGET_CORTEX_M/RTX_Conf_CM.c
Original file line number Diff line number Diff line change
Expand Up @@ -357,18 +357,17 @@ void os_idle_demon (void) {
extern void error(const char* format, ...);
extern osThreadId svcThreadGetId (void);

#include "stdio.h"

void os_error (uint32_t err_code) {
/* This function is called when a runtime error is detected. Parameter */
/* 'err_code' holds the runtime error code (defined in RTX_Config.h). */
osThreadId err_task = svcThreadGetId();
error("CMSIS RTX error code: 0x%08X, task ID: 0x%08X\n", err_code, (uint32_t)err_task);
error("RTX error code: 0x%08X, task ID: 0x%08X\n", err_code, err_task);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NOTE: err_task doesn't need an explicit cast, since it will be automatically promoted during the variadic function call.

void sysThreadError(osStatus status) {
if (status != osOK) {
mbed_die();
osThreadId err_task = svcThreadGetId();
error("CMSIS-RTOS error status: 0x%08X, task ID: 0x%08X\n", status, err_task);
}
}

Expand Down