The use of std::map and static initialization was an issue.
The code was refactored to not use static initialization.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Reworking toolchain and main.cpp for QuRT to a final link can be
done and the apps.h file is autogenerated.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The posix layer implementations should work on QuRT.
QuRT needs to provide a way for getting the current time.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
ld.gold does not support the -Ur flags and it seems some people have
ld as a link to ld.gold.
Made LD = ld.bfd to avoid confusion.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
GCC was more picky about prototypes for inlines being required.
The generate_listener.py script used incorrect printf formats and
was casting %f params to float, but printf casts all %f params to
double per the spec.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The build fails when modules override this flag with a larger value,
and this lower value is still checked. The new flag seems to be in
addition to the old flag, not a replacement.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
There were some missed calls to open and ioctl that need to be
px4_open and px4_ioctl.
QuRT also does not provide usleep() so px4_time.h has to be included
in files calling usleep.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The variable MAVLINK_SRC was defined and then redefined.
Commented out the first definition and moved beside that overriding
definition for visibility.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The changes to the simulator added an include of
mavlink/include/v1.0/... to simulator.h which was not in the included paths.
The included header file also causes clang to issue a -Wpacked warning that
had to be silenced.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Added simulated tone_alarm class and enabled led class for posix build.
The simulator implements the led_init, led_on, led_off, led_toggle calls.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Removed obsolete porting cruft from px4_XXX.h files and merged the
POSIX changes in PreflightCheck_posix.cpp back to PreflightCheck.cpp
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This patch is required for QuRT. comlpex.h defines "I" and it replaces "I" in the
enum definition without this patch creating an error.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
DSPAL for QuRT is still missing the pthreads exports and there is no
exported sleep function. These functions are stubbed out for the time being.
This is based on the 6.4.05 version of the Hexagon tools.
The Hexagon tools and DSPAL are needed to build the qurt target.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Changed "linux" target to "posix". Most of the changes are shared with
QuRT and with OSX. The Linux specific parts are in for i2c which uses
<linux/i2c.h> and <linux/i2c-dev.h>.
There is also a check for __PX4_LINUX in mavlink for a tty ioctl that is
not supported.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The commander module now compiles for Linux.
state_machine_helper_linux.cpp iterates over the virtual devices vs
all devices under /dev as per NuttX when disabling publishing.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The name of the app was adc but should have been adcsim.
Added a barometer simulator.
This will allow ms56711_linux to depend on real devices and not
simulation.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This is a bug and is unsafe. I am not going to change the code but
it needs to be changed to a cast to int or a <= as it is unsafe to
check for equality with 0.0F.
Disabled warning for GCC 4.9 for now.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The getopt command uses global variables and is not thread safe.
Created a minimal px4_getopt version that supports options with
or without an arg, and random placement of options on the command line.
This version modifies the order of the args in argv as does the
POSIX version of getopt.
This assumes that argv[0] is the program name. Nuttx may not support
that properly in task_spawn.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The simulator satisfies the dependencies for an accelerometer
being present.
The accel code compiles but is not fully functional.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
The build will now fail if clang is not found. To force the use
of GCC, use:
make USE_GCC=1
The toolchain makefile was modified so it no longer checks for
various versions of clang if USE_GCC=1 is passed.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Disabled gcc warnings that are tripped by Eigen.
Removed signal code that is not needed in Linux port and was
causing gcc warnings.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
PX4 uses NuttX data structures throughout so those data structures
were preserved and used to implement high and low priority queues.
A unit test for the work queues was added.
The polling rate of the queues are set in px4_config.h in
CONFIG_SCHED_WORKPERIOD. The units are milliseconds.
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Now run:
make PX4_TARGET_OS=nuttx
or
make PX4_TARGET_OS=linux
To test the linux build and make sure that the required directories
exist, run:
make linuxrun
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
Added linker script to resolve __param_start and __param_end.
Added mc_att_control to list of supported builtins.
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>
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>
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>
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>