Fixes for qurt HIL build

Workaround required Eigen downgrade to 3.2. Hexagon toolchain does
not support C++11 features of newest version of Eigen.

Running make qurt_fixup will downgrade and patch Eigen for qurt.
Running make restore will revert the patch and do a git submodule update
to restore the expected Eigen version.

Added a "restore" target to undo qurt_fixup

Before doing a qurt build run:

    make qurt_fixup

That will downgrade Eigen to 3.2 and apply the require patch.
To build another target after downgrading:

    make restore

Them make the desired target (other than qurt).

Fixed type used in orb_priority to be consistent with the code
(int* was used in declaration but int32_t* used in code)

Removed unused class member variable in sensors.cpp

Added cmake fix for unit tests. The location of px4_log.c changed.

Fixed the qurt drv_hrt.c implementation to use us instead of ms for time resolution

Added px4_led.c to nuttx platform layer
Use the posix version of px4_led.c for nuttx so we don't end up with
duplicate files. It was moved out of common because it is not used by qurt.

Changed PX4_DEBUG to PX4_WARN when checking for the error condition for store_poll_waiter in vdev.cpp

Updated the px4_log.h file to make calls to the qurt_log functions.
The qurt_log function is defined in the platforms/qurt layer.

Added an option to control starting the commander module in HIL mode.

Moved the flight specific drivers to the configuration file instead of adding them
to the common tool chain file because HIL mode does not need them.

Added the uorb Subscriber and Publisher classes

Call PX4_ISFINITE macro instead of isfinite().

Added px4_led.c to nuttx platform layer
Use the posix version of px4_led.c for nuttx so we don't end up with duplicate files.
It was moved out of common because it is not used by qurt.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-08-25 21:59:01 -07:00
parent 9e1713eb9f
commit 3a47434749
30 changed files with 484 additions and 97 deletions
+80 -15
View File
@@ -38,6 +38,24 @@
#pragma once
#define _PX4_LOG_LEVEL_ALWAYS 0
#define _PX4_LOG_LEVEL_DEBUG 1
#define _PX4_LOG_LEVEL_WARN 2
#define _PX4_LOG_LEVEL_ERROR 3
#define _PX4_LOG_LEVEL_PANIC 4
// Used to silence unused variable warning
static inline void do_nothing(int level, ...)
{
(void)level;
}
/****************************************************************************
* __px4_log_omit:
* Compile out the message
****************************************************************************/
#define __px4_log_omit(level, FMT, ...) do_nothing(level, ##__VA_ARGS__)
#if defined(__PX4_ROS)
#include <ros/console.h>
@@ -47,6 +65,54 @@
#define PX4_INFO(...) ROS_WARN(__VA_ARGS__)
#define PX4_DEBUG(...)
#elif defined(__PX4_QURT)
#include "qurt_log.h"
/****************************************************************************
* Messages that should never be filtered or compiled out
****************************************************************************/
#define PX4_LOG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_INFO(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#if defined(TRACE_BUILD)
/****************************************************************************
* Extremely Verbose settings for a Trace build
****************************************************************************/
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#elif defined(DEBUG_BUILD)
/****************************************************************************
* Verbose settings for a Debug build
****************************************************************************/
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_DEBUG(FMT, ...) qurt_log(_PX4_LOG_LEVEL_DEBUG, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#elif defined(RELEASE_BUILD)
/****************************************************************************
* Non-verbose settings for a Release build to minimize strings in build
****************************************************************************/
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_WARN(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_WARN, FMT, ##__VA_ARGS__)
#define PX4_DEBUG(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__)
#else
/****************************************************************************
* Medium verbose settings for a default build
****************************************************************************/
#define PX4_PANIC(FMT, ...) qurt_log(_PX4_LOG_LEVEL_PANIC, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_ERR(FMT, ...) qurt_log(_PX4_LOG_LEVEL_ERROR, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_WARN(FMT, ...) qurt_log(_PX4_LOG_LEVEL_WARN, __FILENAME__, __LINE__, FMT, ##__VA_ARGS__)
#define PX4_DEBUG(FMT, ...) __px4_log_omit(_PX4_LOG_LEVEL_DEBUG, FMT, ##__VA_ARGS__)
#endif
#define PX4_LOG_NAMED(name, FMT, ...) qurt_log( _PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, "%s " FMT, name, ##__VA_ARGS__)
#define PX4_LOG_NAMED_COND(name, cond, FMT, ...) if( cond ) qurt_log( _PX4_LOG_LEVEL_ALWAYS, __FILENAME__, __LINE__, "%s " FMT, name, ##__VA_ARGS__)
#else
#define __STDC_FORMAT_MACROS
@@ -59,18 +125,6 @@
__BEGIN_DECLS
__EXPORT extern uint64_t hrt_absolute_time(void);
// Used to silence unused variable warning
static inline void do_nothing(int level, ...)
{
(void)level;
}
#define _PX4_LOG_LEVEL_ALWAYS 0
#define _PX4_LOG_LEVEL_PANIC 1
#define _PX4_LOG_LEVEL_ERROR 2
#define _PX4_LOG_LEVEL_WARN 3
#define _PX4_LOG_LEVEL_DEBUG 4
__EXPORT extern const char *__px4_log_level_str[5];
__EXPORT extern int __px4_log_level_current;
@@ -107,11 +161,22 @@ __EXPORT extern int __px4_log_level_current;
* Use these to implement the code level macros below
****************************************************************************/
/****************************************************************************
* __px4_log_omit:
* Compile out the message
* __px4_log_named_cond:
* Convert a message in the form:
* PX4_LOG_COND(__dbg_enabled, "val is %d", val);
* to
* printf("%-5s val is %d\n", "LOG", val);
* if the first arg/condition is true.
****************************************************************************/
#define __px4_log_omit(level, FMT, ...) do_nothing(level, ##__VA_ARGS__)
#define __px4_log_named_cond(name, cond, FMT, ...) \
__px4__log_startcond(cond)\
"%s " \
FMT\
__px4__log_end_fmt \
,name, ##__VA_ARGS__\
__px4__log_endline
/****************************************************************************
* __px4_log_named_cond: