Commit Graph

12312 Commits

Author SHA1 Message Date
Mark Charlebois cf71db74d7 Support to specify build time OS target
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>
2015-04-20 11:16:26 -07:00
Mark Charlebois aedf6fe628 Linux: Added preliminary work queue support
Based on NuttX work queue code.

Not yet functional.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:16:26 -07:00
Mark Charlebois 056d5f9075 Linux: Added wqueue files from NuttX
Import copies of work queue releated filed from NuttX.

These are the original files.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:16:26 -07:00
Mark Charlebois 340beac672 Linux: I2C virtual device
Create and open I2C virtual device and support I2C_RDWR ioctl

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:16:26 -07:00
Mark Charlebois 192d70e570 Linux: removed separate path for dataman file for Linux
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:16:26 -07:00
Mark Charlebois bb7c8163b9 Linux: commented out tests
The src/platform/linux/tests modules were commented out in the
config file.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:16:26 -07:00
Mark Charlebois 31edc08cea Linux: added missing -pthread flag
LDFLAGS was missing -pthread

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:16:26 -07:00
Mark Charlebois 2cd44a24ea Linux: Added linker script support for param and added mc_att_control
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>
2015-04-20 11:16:26 -07:00
Mark Charlebois 977036faf9 Linux: changed param to nit use errx or exit
Thread based implementaton can't call errx or exit

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:16:26 -07:00
Mark Charlebois 526b0e68eb Linux: modified shell to not show _main suffix
The builtin commands all have _main suffix by convention so
no need to show _main. Also nsh calls the commmands without the
_main suffix.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:15:13 -07:00
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