NuttX: fixes for NuttX build

In the upstream tree ringbuffer.h includes the method implementations
in the header file which causes multiple definitions in the link for
other targets. Changed so ringbuffer.cpp is build separately for other
platforms and is included by ringbuffer.h on NuttX.

uORB changes do not link without uORBTest_UnitTest.cpp enabled for
the NuttX build.

px4_getopt was not exported and wasn't visible in NuttX build.

The makefiles were restored to be as close as possible to upstream
so the NuttX build builtin's work again. The code will have to be
refactored after the merge.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-05-15 12:56:18 -07:00
parent a3a0d0612c
commit 9f391b1867
12 changed files with 340 additions and 37 deletions
+2 -3
View File
@@ -41,8 +41,7 @@ SRCS = \
cdev.cpp \
i2c_nuttx.cpp \
pio.cpp \
spi.cpp \
ringbuffer.cpp
spi.cpp
else
SRCS = \
device_posix.cpp \
@@ -51,5 +50,5 @@ SRCS = \
vdev_posix.cpp \
i2c_posix.cpp \
sim.cpp \
ringbuffer.cpp
ringbuffer.cpp
endif
+1 -1
View File
@@ -237,7 +237,7 @@ RingBuffer::force(double val)
// FIXME - clang crashes on this get() call
#ifdef __PX4_QURT
#define __PX4_SBCAP my_sync_bool_compare_and_swap
static bool my_sync_bool_compare_and_swap(volatile unsigned *a, unsigned b, unsigned c)
static inline bool my_sync_bool_compare_and_swap(volatile unsigned *a, unsigned b, unsigned c)
{
if (*a == b) {
*a = c;
+6
View File
@@ -172,3 +172,9 @@ private:
RingBuffer operator=(const RingBuffer&);
};
#ifdef __PX4_NUTTX
// Not sure why NuttX requires these to be defined in the header file
// but on other targets it causes a problem with multiple definitions
// at link time
#include "ringbuffer.cpp"
#endif