mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-30 23:31:35 +08:00
QuRT logging improvements (#24462)
- Made general improvements to the QURT platform message logging so that module name is printed both in mini-dm and on apps side terminal
This commit is contained in:
@@ -37,6 +37,10 @@
|
||||
#include <stdint.h>
|
||||
#include <px4_platform_common/defines.h>
|
||||
|
||||
#define BASE_BUFFER_SIZE 256
|
||||
#define MAX_MODULE_NAME_SIZE 32
|
||||
#define MODULE_BUFFER_SIZE (BASE_BUFFER_SIZE + MAX_MODULE_NAME_SIZE)
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern void qurt_log_to_apps(int level, const char *message);
|
||||
@@ -44,22 +48,27 @@ extern void qurt_log_to_apps(int level, const char *message);
|
||||
// Defining hap_debug
|
||||
void HAP_debug(const char *msg, int level, const char *filename, int line);
|
||||
|
||||
static __inline void qurt_log(int level, const char *file, int line,
|
||||
const char *format, ...)
|
||||
static __inline void qurt_log_module(int level, const char *module, const char *file, int line,
|
||||
const char *format, ...)
|
||||
{
|
||||
char buf[256];
|
||||
char buf[BASE_BUFFER_SIZE];
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(buf, sizeof(buf), format, args);
|
||||
va_end(args);
|
||||
HAP_debug(buf, level, file, line);
|
||||
|
||||
qurt_log_to_apps(level, buf);
|
||||
char module_buf[MODULE_BUFFER_SIZE];
|
||||
snprintf(module_buf, MAX_MODULE_NAME_SIZE, "[%s] ", module);
|
||||
strcat(module_buf, buf);
|
||||
|
||||
HAP_debug(module_buf, level, file, line);
|
||||
|
||||
qurt_log_to_apps(level, module_buf);
|
||||
}
|
||||
|
||||
static __inline void qurt_log_raw(const char *format, ...)
|
||||
{
|
||||
char buf[256];
|
||||
char buf[BASE_BUFFER_SIZE];
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
vsnprintf(buf, sizeof(buf), format, args);
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <drivers/device/qurt/uart.h>
|
||||
#include <drivers/drv_hrt.h>
|
||||
|
||||
#define MODULE_NAME "SerialImpl"
|
||||
|
||||
namespace device
|
||||
{
|
||||
|
||||
|
||||
@@ -43,6 +43,8 @@
|
||||
|
||||
#include "hrt_work.h"
|
||||
|
||||
#define MODULE_NAME "drv_hrt"
|
||||
|
||||
static constexpr unsigned HRT_INTERVAL_MIN = 50;
|
||||
static constexpr unsigned HRT_INTERVAL_MAX = 50000000;
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@
|
||||
|
||||
#include "apps.h"
|
||||
|
||||
#define MODULE_NAME "main"
|
||||
|
||||
#define MAX_ARGS 8 // max number of whitespace separated args after app name
|
||||
|
||||
__BEGIN_DECLS
|
||||
|
||||
@@ -41,6 +41,8 @@
|
||||
#include <pthread.h>
|
||||
#include "hrt_work.h"
|
||||
|
||||
#define MODULE_NAME "tasks"
|
||||
|
||||
#define PX4_TASK_STACK_SIZE 8192
|
||||
#define PX4_TASK_MAX_NAME_LENGTH 32
|
||||
#define PX4_TASK_MAX_ARGC 32
|
||||
@@ -129,7 +131,7 @@ static px4_task_t px4_task_spawn_internal(const char *name, int priority, px4_ma
|
||||
int task_index = 0;
|
||||
char *p = (char *)argv;
|
||||
|
||||
PX4_INFO("Creating pthread %s\n", name);
|
||||
PX4_INFO("Creating pthread %s", name);
|
||||
|
||||
if (task_mutex_initialized == false) {
|
||||
task_mutex_initialized = true;
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <qurt_alloc.h>
|
||||
#include <termios.h>
|
||||
|
||||
#define MODULE_NAME "unresolved_symbols"
|
||||
|
||||
__attribute__((visibility("default"))) void free(void *ptr)
|
||||
{
|
||||
qurt_free(ptr);
|
||||
|
||||
Reference in New Issue
Block a user