If the topic has not been published, orb_copy returns a
negative number which causes update() to memset the data
contents to zero.
In some instances data is a null pointer. This causes a
segment violation crash.
Added a check for data != 0
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
I2C class derives from CDev class which requires a devname
but in at least some instances, a nullptr is passed for devname.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
When printing a uint64_t type using %llu, this works on a 32bit
system, but on a 64bit machine uint64_t is an unsigned long.
The compiler complains about unmatching types.
The time times in PX4 should likely have been unsigned long long
and not uint64_t as that type changes per architecture.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
For now it uses the bus number as the id. Not sure how this should
actually be mapped.
Seems like the I2C devices come up in random order and have random
id but that a specific device can be found in the /sys/bus/i2c
interface.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
if termios.h is included before mathlib.h then BO is undefined.
Since mathlib.h is not needed it was removed but I still don't
know why this error occurs.
Also added -lrt to link flags for clock_gettime
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Not yet functional. Full implementation will provide an IOCTL interface to
do bi-directional transfer. will model the interface after Linux.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
When running the process without sufficient privilege to use
real time scheduling, warn the user and run with SCHED_OTHER.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
ms5611 uses getopt to parse args but the static variable
optind was not being properly updated.
Replaced use of external getopt call with simple parser;
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Added more queue support to linux/px4_layer.
Use virt char devices for ms5611, and mavlink.
Added more HRT functionality. uORB latency test
now fails. Likely due to bad HRT impl for Linux.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The dataman module now works under linux using /tmp/dataman as the
file path. Two files from NuttX were added to the Linux impl for
single linked queue handling.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The previous name implied some kind of daemon. AppState is
aggregated state of an application's running state and interfaces
to request app termination, and check app state.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The High Resilution Timer functions are stubbed out for now.
Certain queue functions are required to compile uORB so adding
the queue.c from NuttX.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Moved posix-like functions to vcdev_posix.cpp and updated the
copyright notice.
Added test case to make sure poll unblocks when a write occurs.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Modified uint32_t casts of pointers to unsigned long for portability.
It otherwise breaks on x86_64.
Added _PX4_IOC to handle the conflice between _IOC on Linux and NuttX.
Removed use of px4::ok() because it cannot be used in a thread based
implementation. Changed to use px4::AppMgr which uses ok() on ROS.
Removed up_cxxinitialize.c from Linux build.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The following libs can now be built under Linux:
lib/mathlib
lib/geo
lib/geo_lookup
The constants used for ROS are now shared with Linux in
px4_defines.h
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Keep existing API use in code. Bind the use of the OS independent
implementation in the systemlib layer.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Calls to task_delete and task_spawn_cmd are now
px4_task_delete and px4_task_spawn_cmd respectively.
The px4_tasks.h header was added to the affected files
and incusions of nuttx/config.h were removed.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Moved checksubmodules target back to Makefile.
NuttX download still done for Linux as it would require
too much surgery to remove it.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Uncomment the following line in setup.mk and comment out the line above
to enable the Linux build.
export PX4_TARGET_OS = linux
The build uses the clang compiler by default. The final bundled executable
is mainapp located in:
Build/linux_default.build/mainapp
When you run mainapp it will provide a list of the built-in apps. You can
type in the commands to run such as:
hello_main start
Because the Linux build is threaded and does not support tasks or processes,
it cannot call errx, exit() _exit(), etc. It also requires unique scoped
variables to test if a thread is running or if an application should exit.
The px4::AppMgr class was added in px4_app.h for this purpose. The
hello sample app demonstrates how this is used.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Moved the NuttX specific board files to makefiles/nuttx and added
a makfiles/linux directory with sample config and board files.
Created a makefiles/toolchain_native.mk file for building for Linux
with the native system compiler. GCC or clang can be used by setting
a flag in the file.
The Linux build creates an archive file and will build the tasks as
threads. Other code changes are required to support both task based
and thread based builds.
The NuttX source should not be required for the Linux build. The
target OS (NuttX or Linux) is selected by commenting out the desired
line in setup.mk
Signed-off-by: Mark Charlebois <charlebm@gmail.com>