diff --git a/src/platforms/posix/px4_layer/px4_log.c b/src/platforms/posix/px4_layer/px4_log.c index b0cfb4c087..074ae8b466 100644 --- a/src/platforms/posix/px4_layer/px4_log.c +++ b/src/platforms/posix/px4_layer/px4_log.c @@ -1,13 +1,16 @@ #include #include +#ifdef __PX4_POSIX #include +#endif __EXPORT int __px4_log_level_current = PX4_LOG_LEVEL_AT_RUN_TIME; -__EXPORT const char *__px4_log_level_str[_PX4_LOG_LEVEL_PANIC+1] = { "INFO", "DEBUG", "WARN", "ERROR", "PANIC" }; +__EXPORT const char *__px4_log_level_str[_PX4_LOG_LEVEL_PANIC + 1] = { "INFO", "DEBUG", "WARN", "ERROR", "PANIC" }; void px4_backtrace() { +#ifdef __PX4_POSIX void *buffer[10]; char **callstack; int bt_size; @@ -16,11 +19,12 @@ void px4_backtrace() bt_size = backtrace(buffer, 10); callstack = backtrace_symbols(buffer, bt_size); - PX4_INFO("Backtrace:", bt_size); + PX4_INFO("Backtrace: %d", bt_size); - for(idx=0; idx < bt_size; idx++) + for (idx = 0; idx < bt_size; idx++) { PX4_INFO("%s", callstack[idx]); + } free(callstack); +#endif } -