Skip to content
Snippets Groups Projects
Commit 246b879a authored by Daniel Agar's avatar Daniel Agar
Browse files

require MODULE_NAME

parent 8d15da37
No related branches found
No related tags found
No related merge requests found
...@@ -212,7 +212,10 @@ function(px4_add_module) ...@@ -212,7 +212,10 @@ function(px4_add_module)
if(INCLUDES) if(INCLUDES)
target_include_directories(${MODULE}_original PRIVATE ${INCLUDES}) target_include_directories(${MODULE}_original PRIVATE ${INCLUDES})
endif() endif()
target_compile_definitions(${MODULE}_original PRIVATE PX4_MAIN=${MAIN}_app_main)
target_compile_definitions(${MODULE}_original PRIVATE MODULE_NAME="${MAIN}_original")
# unity build
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp
COMMAND cat ${SRCS} > ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp COMMAND cat ${SRCS} > ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp
DEPENDS ${MODULE}_original ${DEPENDS} ${SRCS} DEPENDS ${MODULE}_original ${DEPENDS} ${SRCS}
......
...@@ -46,7 +46,7 @@ namespace px4 ...@@ -46,7 +46,7 @@ namespace px4
void init(int argc, char *argv[], const char *process_name) void init(int argc, char *argv[], const char *process_name)
{ {
PX4_WARN("process: %s", process_name); printf("process: %s\n", process_name);
} }
uint64_t get_time_micros() uint64_t get_time_micros()
......
...@@ -75,6 +75,7 @@ ...@@ -75,6 +75,7 @@
#include "px4_daemon/server.h" #include "px4_daemon/server.h"
#include "px4_daemon/pxh.h" #include "px4_daemon/pxh.h"
#define MODULE_NAME "px4"
static const char *LOCK_FILE_PATH = "/tmp/px4_lock"; static const char *LOCK_FILE_PATH = "/tmp/px4_lock";
......
...@@ -52,6 +52,7 @@ add_library(px4_layer ...@@ -52,6 +52,7 @@ add_library(px4_layer
drv_hrt.c drv_hrt.c
${SHMEM_SRCS} ${SHMEM_SRCS}
) )
target_compile_definitions(px4_layer PRIVATE MODULE_NAME="px4")
target_link_libraries(px4_layer PRIVATE work_queue) target_link_libraries(px4_layer PRIVATE work_queue)
target_link_libraries(px4_layer PRIVATE px4_daemon) target_link_libraries(px4_layer PRIVATE px4_daemon)
......
...@@ -347,7 +347,7 @@ hrt_tim_init(void) ...@@ -347,7 +347,7 @@ hrt_tim_init(void)
ret = sam_tc_clockselect(frequency, &cmr, &actual); ret = sam_tc_clockselect(frequency, &cmr, &actual);
if (ret < 0) { if (ret < 0) {
PX4_PANIC("ERROR: Failed no divisor can be found (%d),for timer channel %d\n", ret, HRT_TIMER_CHANNEL); printf("ERROR: Failed no divisor can be found (%d),for timer channel %d\n", ret, HRT_TIMER_CHANNEL);
return; return;
} }
...@@ -386,7 +386,7 @@ hrt_tim_init(void) ...@@ -386,7 +386,7 @@ hrt_tim_init(void)
hrt_tch = sam_tc_allocate(HRT_TIMER_CHANNEL, cmr); hrt_tch = sam_tc_allocate(HRT_TIMER_CHANNEL, cmr);
if (!hrt_tch) { if (!hrt_tch) {
PX4_PANIC("ERROR: Failed to allocate timer channel %d\n", HRT_TIMER_CHANNEL); printf("ERROR: Failed to allocate timer channel %d\n", HRT_TIMER_CHANNEL);
return; return;
} }
......
...@@ -37,11 +37,9 @@ ...@@ -37,11 +37,9 @@
* Programmable multi-channel mixer library. * Programmable multi-channel mixer library.
*/ */
#include <px4_config.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <systemlib/err.h>
#include "mixer_load.h" #include "mixer_load.h"
...@@ -54,7 +52,7 @@ int load_mixer_file(const char *fname, char *buf, unsigned maxlen) ...@@ -54,7 +52,7 @@ int load_mixer_file(const char *fname, char *buf, unsigned maxlen)
fp = fopen(fname, "r"); fp = fopen(fname, "r");
if (fp == NULL) { if (fp == NULL) {
warnx("file not found"); printf("file not found\n");
return -1; return -1;
} }
...@@ -100,7 +98,7 @@ int load_mixer_file(const char *fname, char *buf, unsigned maxlen) ...@@ -100,7 +98,7 @@ int load_mixer_file(const char *fname, char *buf, unsigned maxlen)
/* if the line is too long to fit in the buffer, bail */ /* if the line is too long to fit in the buffer, bail */
if ((strlen(line) + strlen(buf) + 1) >= maxlen) { if ((strlen(line) + strlen(buf) + 1) >= maxlen) {
warnx("line too long"); printf("line too long\n");
fclose(fp); fclose(fp);
return -1; return -1;
} }
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#include <cstdlib> #include <cstdlib>
#define MODULE_NAME "px4"
extern "C" { extern "C" {
${builtin_apps_decl_string} ${builtin_apps_decl_string}
......
...@@ -50,6 +50,7 @@ if (NOT "${OS}" MATCHES "nuttx") ...@@ -50,6 +50,7 @@ if (NOT "${OS}" MATCHES "nuttx")
work_queue.c work_queue.c
work_thread.c work_thread.c
) )
target_compile_definitions(work_queue PRIVATE MODULE_NAME="work_queue")
add_dependencies(work_queue prebuild_targets) add_dependencies(work_queue prebuild_targets)
endif() endif()
...@@ -168,11 +168,6 @@ __END_DECLS ...@@ -168,11 +168,6 @@ __END_DECLS
#define __px4__log_printcond(cond, ...) if (cond) printf(__VA_ARGS__) #define __px4__log_printcond(cond, ...) if (cond) printf(__VA_ARGS__)
#define __px4__log_printline(level, ...) printf(__VA_ARGS__) #define __px4__log_printline(level, ...) printf(__VA_ARGS__)
#ifndef MODULE_NAME
#define MODULE_NAME "Unknown"
#endif
#define __px4__log_timestamp_fmt "%-10" PRIu64 " " #define __px4__log_timestamp_fmt "%-10" PRIu64 " "
#define __px4__log_timestamp_arg ,hrt_absolute_time() #define __px4__log_timestamp_arg ,hrt_absolute_time()
#define __px4__log_level_fmt "%-5s " #define __px4__log_level_fmt "%-5s "
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment