Browse Source

require MODULE_NAME

sbg
Daniel Agar 7 years ago
parent
commit
246b879aea
  1. 3
      cmake/common/px4_base.cmake
  2. 2
      platforms/nuttx/src/px4_layer/px4_nuttx_impl.cpp
  3. 1
      platforms/posix/src/main.cpp
  4. 1
      platforms/posix/src/px4_layer/CMakeLists.txt
  5. 4
      src/drivers/samv7/drv_hrt.c
  6. 6
      src/lib/mixer/mixer_load.c
  7. 2
      src/platforms/apps.cpp.in
  8. 1
      src/platforms/common/work_queue/CMakeLists.txt
  9. 5
      src/platforms/px4_log.h

3
cmake/common/px4_base.cmake

@ -212,7 +212,10 @@ function(px4_add_module) @@ -212,7 +212,10 @@ function(px4_add_module)
if(INCLUDES)
target_include_directories(${MODULE}_original PRIVATE ${INCLUDES})
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
COMMAND cat ${SRCS} > ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp
DEPENDS ${MODULE}_original ${DEPENDS} ${SRCS}

2
platforms/nuttx/src/px4_layer/px4_nuttx_impl.cpp

@ -46,7 +46,7 @@ namespace px4 @@ -46,7 +46,7 @@ namespace px4
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()

1
platforms/posix/src/main.cpp

@ -75,6 +75,7 @@ @@ -75,6 +75,7 @@
#include "px4_daemon/server.h"
#include "px4_daemon/pxh.h"
#define MODULE_NAME "px4"
static const char *LOCK_FILE_PATH = "/tmp/px4_lock";

1
platforms/posix/src/px4_layer/CMakeLists.txt

@ -52,6 +52,7 @@ add_library(px4_layer @@ -52,6 +52,7 @@ add_library(px4_layer
drv_hrt.c
${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 px4_daemon)

4
src/drivers/samv7/drv_hrt.c

@ -347,7 +347,7 @@ hrt_tim_init(void) @@ -347,7 +347,7 @@ hrt_tim_init(void)
ret = sam_tc_clockselect(frequency, &cmr, &actual);
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;
}
@ -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);
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;
}

6
src/lib/mixer/mixer_load.c

@ -37,11 +37,9 @@ @@ -37,11 +37,9 @@
* Programmable multi-channel mixer library.
*/
#include <px4_config.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <systemlib/err.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");
if (fp == NULL) {
warnx("file not found");
printf("file not found\n");
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 ((strlen(line) + strlen(buf) + 1) >= maxlen) {
warnx("line too long");
printf("line too long\n");
fclose(fp);
return -1;
}

2
src/platforms/apps.cpp.in

@ -10,6 +10,8 @@ @@ -10,6 +10,8 @@
#include <cstdlib>
#define MODULE_NAME "px4"
extern "C" {
${builtin_apps_decl_string}

1
src/platforms/common/work_queue/CMakeLists.txt

@ -50,6 +50,7 @@ if (NOT "${OS}" MATCHES "nuttx") @@ -50,6 +50,7 @@ if (NOT "${OS}" MATCHES "nuttx")
work_queue.c
work_thread.c
)
target_compile_definitions(work_queue PRIVATE MODULE_NAME="work_queue")
add_dependencies(work_queue prebuild_targets)
endif()

5
src/platforms/px4_log.h

@ -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_printline(level, ...) printf(__VA_ARGS__)
#ifndef MODULE_NAME
#define MODULE_NAME "Unknown"
#endif
#define __px4__log_timestamp_fmt "%-10" PRIu64 " "
#define __px4__log_timestamp_arg ,hrt_absolute_time()
#define __px4__log_level_fmt "%-5s "

Loading…
Cancel
Save