Commit Graph

11897 Commits

Author SHA1 Message Date
Mark Charlebois 1f84c348fc fix for segv if topic has not been published
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>
2015-04-20 11:15:12 -07:00
Mark Charlebois 653c14fcbb Linux: Handle nullptr passed to I2C constructor
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>
2015-04-20 11:15:12 -07:00
Mark Charlebois 1b4b8bb856 Linux: in printf cast uint64_t to unsigned long long
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>
2015-04-20 11:15:12 -07:00
Mark Charlebois 83df879f90 Linux: fixes for compilation with gcc-4.8 on IFC6410
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:15:12 -07:00
Mark Charlebois 62eb403e4d Linus: print format fixes to build with clang on IFC6410
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:15:12 -07:00
Mark Charlebois 5f3496353c Linux: added support for sdlog2
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:15:12 -07:00
Mark Charlebois 13d84ef17b Linux: I2C opens /dev/i2c-x
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>
2015-04-20 11:13:24 -07:00
Mark Charlebois df53defca6 Linux: Add support for blinkm to test I2C layering
Running the blinkm device to test I2C

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:13:24 -07:00
Mark Charlebois cd30b4d5ca Linux: added I2C class
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:13:24 -07:00
Mark Charlebois 90818363eb Linux: fix for undefined BO in mavlink_main_linux.cpp
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>
2015-04-20 11:13:24 -07:00
Mark Charlebois 1cdc44828d Linux - revert to preferentially use clang over gcc
Removed hardcoded requirement to use gcc

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:13:24 -07:00
Mark Charlebois 11e971eaa0 Linux: min gcc version is 4.8.1
PX4 will not build with gcc-4.6.

If you are running Ubuntu 12.04 still (you poor old sod) follow the directions at

http://ubuntuhandbook.org/index.php/2013/08/install-gcc-4-8-via-ppa-in-ubuntu-12-04-13-04/

to install gcc-4.8.1

Alternatively you can install clang 3.4.1 for Ubuntu 12.04 from

http://llvm.org/releases/3.4.1/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04.tar.xz

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:13:24 -07:00
Mark Charlebois 2feeecdab1 Linux: Added config and stubs to compile I2C device for Linux
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>
2015-04-20 11:13:24 -07:00
Mark Charlebois 598b05fcba Linux: run threads without SCHED_FIFO if not privileged
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>
2015-04-20 11:07:00 -07:00
Mark Charlebois 4a6bd4ddc0 Linux: replaced getopt in ms5611_linux.cpp
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>
2015-04-20 11:07:00 -07:00
Mark Charlebois ac0df5c61d Linux: added HRT test, moved tests to linux/tests
Also fixed naming of mavlink files for NuttX build.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:07:00 -07:00
Mark Charlebois 99399115f2 Linux: Minor fixes of error caught by gcc-4.9.1
- Missing static declarations for functions not used outside a file.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:07:00 -07:00
Mark Charlebois 88a0081112 Linux: Added support for gcc-4.9.1
Fixed bug with missing quote in #error found by gcc 4.9.1

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:07:00 -07:00
Mark Charlebois d013ac0927 Support for building more modules with Linux
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>
2015-04-20 11:07:00 -07:00
Mark Charlebois 2abfb7a5be Linux: added queue files for dataman support
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>
2015-04-20 11:00:18 -07:00
Mark Charlebois fd7863270e Nuttx: fixed missing changes from AppMgr to AppState
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:00:18 -07:00
Mark Charlebois 7b0783a070 Added MuORB based on virtual CDev implementation
uORB module now compiles and runs for Linux using the
virtual CDev implementation.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:00:18 -07:00
Mark Charlebois 938751993d Changed AppMgr to AppState
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>
2015-04-20 11:00:18 -07:00
Mark Charlebois 5259f1c861 Linux: add queue functions from NuttX and HRT stubs
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>
2015-04-20 11:00:18 -07:00
Mark Charlebois 9718404d7f Added new file for virt dev posix-like functions and test case
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>
2015-04-20 11:00:17 -07:00
Mark Charlebois 97a72563b8 Fixes to compile again for NuttX
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:00:17 -07:00
Mark Charlebois 4016ad2ff5 Revert uORB to previous version
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:00:17 -07:00
Mark Charlebois f3596e555b Added
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:00:16 -07:00
Mark Charlebois 0553a68a1a Fixed usage string for hello app
hello should have been hello_main

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:00:16 -07:00
Mark Charlebois a25ae71f99 Linux: support ld.gold
The -Ur option is not supported in gold

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:00:16 -07:00
Mark Charlebois aeb65702a2 Fixed support for clang 3.5
"clang-3.5 -dumpversion" returns 4.2.1 as the GCC version.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:00:16 -07:00
Mark Charlebois a68f025ff9 Added support for other clang on Ubuntu 12.04
A Ubuntu 12.04 compatible version of clang-3.4.1 can be downloaded from
http://llvm.org/releases/3.4.1/clang+llvm-3.4.1-x86_64-unknown-ubuntu12.04.tar.xz

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:00:16 -07:00
Mark Charlebois 672ba1a43b Linux: support gcc-4.6 and c++0x
GCC 4.6 is too old for -std=c++11 but it supports -std=c++0x

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:00:16 -07:00
Mark Charlebois 35e00f0ba1 Added missing _PX4_IOC substitutions
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:00:16 -07:00
Mark Charlebois 5084a61f0e Abstractions to compile systemlib for Linux and Nuttx
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>
2015-04-20 11:00:16 -07:00
Mark Charlebois 89e1b454af Linux: added support for gcc 4.6
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 10:57:01 -07:00
Mark Charlebois 4a4fcb5d75 Linux: fixes for gcc
Fixes to compile with gcc

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 10:57:01 -07:00
Mark Charlebois 566c3ed3c3 Linux: Autodetect clang-3.5 toolchain
Use clang-3.5 if found, otherwise gcc

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 10:57:01 -07:00
Mark Charlebois 62f8bd6679 Linux build support for some libs
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>
2015-04-20 10:57:01 -07:00
Mark Charlebois e3f152b5c1 Changed main_t to px4_main_t in systemlib.h
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 10:55:41 -07:00
Mark Charlebois 9758112e31 Use px4_config.h instead of nuttx/config.h
Modified code to use OS independent header file for config settings.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 10:55:41 -07:00
Mark Charlebois 82a7fd5115 Code uses px4_config.h instead of nuttx/config.h
Use OS independent header file for config info.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 10:49:44 -07:00
Mark Charlebois bf429188b4 Reverted: Use OS independent API for task creation/deletion
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>
2015-04-20 10:49:44 -07:00
Mark Charlebois ddb32742eb Use OS independent API for task creation/deletion
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>
2015-04-20 10:49:44 -07:00
Mark Charlebois 51a71d54c6 checksubmodules target needed for Linux build
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>
2015-04-20 10:46:44 -07:00
Mark Charlebois 520459062d Initial Linux support including execution shell
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>
2015-04-20 10:46:43 -07:00
Mark Charlebois 838e9fc769 Refactoring for multiplatform support
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>
2015-04-20 10:46:43 -07:00
Roman Bapst 2f5239c17a fixed name of generic firefly mixer 2015-04-20 17:09:09 +02:00
Roman Bapst 851a66135f fixed syntax of auxiliary mixer file 2015-04-20 17:05:59 +02:00
Roman Bapst de3a914521 fixed firefly6 configuration file 2015-04-20 17:03:11 +02:00