6622 Commits

Author SHA1 Message Date
Mark Charlebois
639afeb28f Fixed issue with argc check
Was checking if argc < 1 and then accessing argv[1]. Fixed by
checking if argc < 2.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:48 -07:00
Mark Charlebois
edf8677c37 Linux: use string to store task name
Converted px4_linux_tasks to C++ so the task struct can use a
string. Sometimes the name string was in the stack of the calling
function and goes out of scope.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:48 -07:00
Mark Charlebois
87a8289a22 Linux: changed adc to adcsim and add barosim
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>
2015-04-20 11:35:48 -07:00
Mark Charlebois
ddf75dd55a Linux: added ADC simulator
The sensor module is now able to run after the simulation modules are
started.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:48 -07:00
Mark Charlebois
2eaa2f06e7 Linux: fised printf param to work on 32 and 64 bit targets
Use %zd instead of %d or %ld for sizeof(x).

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:48 -07:00
Mark Charlebois
410f86b767 Linux: Added simulated gyro
The code is based on mpu6000.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:48 -07:00
Mark Charlebois
ec1b77c9e1 Linux: GCC static data is 16byte aligned, messes up param
GCC 4.8 and higher implement 16 byte static data alignment on 64-bit.
This means that the 24-byte param_info_s variables are 16 byte aligned
by GCC and that messes up the assumption that the address of the second
parameter is at &param[0]+sizeof(param[0]).
When compiled with clang it is true, with gcc is is not true.

See https://llvm.org/bugs/show_bug.cgi?format=multiple&id=18006

The fix is needed for GCC >=4.8 only. Clang works fine without this.

Added __attribute__((aligned(16))) to first member of param_info_s.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:48 -07:00
Mark Charlebois
d264273d21 ACCELSIM: fixed calls to open, close, ioctl
The calls to open, close, ioctl should have been px4_open, px4_close
and px4_ioctl.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:48 -07:00
Mark Charlebois
d137c09b0b Linux: removed debug output for task creation
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:48 -07:00
Mark Charlebois
a6950eb7d3 Linux: fixed bad return value
Function was always returning -ENOTTY instead of the "ret" variable.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:48 -07:00
Mark Charlebois
400b9ebc20 Linux: fixed registration of a class of device
Previously it created 4 instances instead of the next available slot.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:47 -07:00
Mark Charlebois
f0312d2da0 Linux: Added commands to show threads and devices
The list_tasks and list_devices commands will show
lists of running px4 threads and created virtual device nodes.

The list_builtins command was removes and the list of commands
will be shown if return is pressed.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:47 -07:00
Mark Charlebois
1d676b2e10 Moved linux/drivers/accel to linux/drivers/accelsim
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:47 -07:00
Mark Charlebois
c6498de3e1 SIM: pushed transfer stub for ms5611_sim
The MS5611_SIM class is supposed to simulate data from a real
ms5611. An externl simulator could provide an interface to
call to get data that would be returned from a transfer() call.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:47 -07:00
Mark Charlebois
892012aa15 SIM: made transfer a virtual method
Drivers simulating HW can implement specific behavior for calls to
transfer.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:47 -07:00
Mark Charlebois
eab32572f4 Linux: Added thread safe getopt
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>
2015-04-20 11:35:47 -07:00
Mark Charlebois
b86b334c2f Linux: Updated copyright on simulated accelrometer source
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:47 -07:00
Mark Charlebois
440fc306a9 Added accelerometer simulator
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>
2015-04-20 11:35:47 -07:00
Mark Charlebois
76a6f19476 Linux: Added device simulator to simulate an I2C or SPI device
The simulated device satisfies the factory pattern used by
MS5611 to create a specific I2C or SPI device instance.

For now the functions just return true, but should/could
return simulated data.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:35:47 -07:00
Mark Charlebois
4780353cd8 ms5611_i2c: don't create with nullptr for devname
I have not been able to unravel why nullptr is passed as the device
path to the constructor of ms5611_i2c.

This crashes the VDev code as it expects to create a virtual driver
with the device path passed as devname. It causes VDev to do a
strncmp with null.

Using /vdev/ms5611_i2c as the name for the now.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:34:12 -07:00
Mark Charlebois
92d90f7780 Linux: ms5611 open, close changed to px4_open, px4_close
Calls to open and close were used instead of px4_open and px4_close.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:34:12 -07:00
Mark Charlebois
f62ea8aeae Linux: added read and write function overrides for i2c
Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:34:12 -07:00
Mark Charlebois
894611df04 Linux: Fixed argc check in sensors_main
Was checking for argc < 1, and should be argc < 2.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:34:12 -07:00
Mark Charlebois
058d4408cc Linux: removed debug output from shell
The command shell was spewing debug infor about the command and
parameters. Removed the debug output.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:34:12 -07:00
Mark Charlebois
e3efe71444 Linux: I2C implementation with simulator stub
If PX4_I2C_SIMULATE is set to 1, then the actual I2C device will
not be opened and all transfers will succeed.

If PX4_I2C_SIMULATE is false and transfer() is called, then the
appropriate ioctl is make on the actual device.

if I2C::ioctl is called via px4_ioctl() then the command fails and
a warning is printed to use I2C::transfer

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:34:12 -07:00
Mark Charlebois
78dd177e86 Linux: removed documentation of parameter
The parameter is not present in the linux implementation so removed
the documentation for the parameter.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:34:12 -07:00
Mark Charlebois
ccd18929fc Linux: changed CDev to VDev for virtual device implementation
To avoid confusion when a real device and a virtual device is
being used, changed CDev to VDev for Linux.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:34:12 -07:00
Mark Charlebois
8c8f57b5b4 Fixed std::isfinite vs isfinite differences
Added PX4_ISFINITE(x) to px4_defines.h to handle the differences on
NuttX and Linux.

This change also picked up some file renaming for virtual character devices

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:34:12 -07:00
Lorenz Meier
7bdaec9ff0 att + pos EKF: Enable execution on Linux 2015-04-20 11:27:17 -07:00
Lorenz Meier
b4d52327e8 att EKF: Enable execution on Linux 2015-04-20 11:21:52 -07:00
Lorenz Meier
a2a113ee28 Ported mc_att_control 2015-04-20 11:18:43 -07:00
Mark Charlebois
3ab76caa78 Linux: Changed non-fatal px4_errx to warnx
px4_errx kills the process, so if possible we want to end the thread
but not the process. Using warnx and return exits gracefully.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:17:21 -07:00
Mark Charlebois
994065ef47 Linux: dont check stacksize in sdlog2
stacksize check in sdlog2 fails for x86_64

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
2015-04-20 11:17:21 -07:00
Mark Charlebois
e3f137ce23 Fixed gcc 4.8 warnings
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>
2015-04-20 11:16:26 -07:00
Mark Charlebois
eabc44afbe Linux: Added work queue support and unit test
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>
2015-04-20 11:16:26 -07:00
Mark Charlebois
dffb8bb62c MuORB: handle case on no args passed
if only uorb is called with no other args it crashes.

Handle the case where no args are passed.

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
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