Commit Graph

1000 Commits

Author SHA1 Message Date
Julian Oes 9eda5b373c posix: add fuzz testing using MAVLink messages
This adds the env option PX4_FUZZ which runs the LLVM libFuzzer which
throws random bytes at mavlink_receiver using MAVLink messages over UDP.

The MAVLink messages that are being sent are valid, so the CRC is
calculated but the payload and msgid, etc. are generally garbage, unless
the fuzzing gets a msgid right by chance.

As I understand it, libFuzzer watches the test coverage and will try to
execute as much of the code as possible.
2022-01-07 10:17:12 -05:00
David Sidrane eac92ec671 imxrt:ADC fix timeouts 2022-01-03 06:02:19 -08:00
Daniel Agar f76aa0e772 cmake: NuttX ARMV7M_STACKCHECK skip ekf2
- px4_fmu-v5_stackcheck switch from icm20689 -> bmi055 (lower rate)
 - this is to make performance tolerable
2022-01-01 18:43:27 -05:00
Daniel Agar 03371f8522 NuttX with bch flush backport 2021-12-31 10:59:56 -08:00
Daniel Agar 6d0339ba0c I2CSPIDriverBase: sensor start failure ERROR if internal, WARN if external 2021-12-28 11:05:35 -05:00
Daniel Agar d94767ef88 cmake: NuttX use cygwin friendly path for linker script 2021-12-27 12:19:12 -05:00
Beat Küng fe1b726b62 ScheduledWorkItem: do not call ScheduleClear() if not init in destructor
This avoids that unit tests trying to access a wq hang.
It still fails with an error currently.
2021-12-24 20:06:13 -05:00
Beat Küng 590239dedb work_queue: increase rate_ctrl stack size by 150 B
WARN  [load_mon] wq:rate_ctrl low on stack! (172 bytes left)
2021-12-24 20:06:13 -05:00
Daniel Agar 38731662c6 parameters use bitset for mark_unsaved 2021-12-24 14:32:40 -05:00
PX4 BuildBot a069a47d50 Update submodule nuttx to latest Thu Dec 23 18:11:37 UTC 2021
- nuttx in PX4/Firmware (d0ce5705359f8beeb9faf7fa0d12279e03bb7ac7): d4c06e9dfb
    - nuttx current upstream: 378032a44b
    - Changes: d4c06e9dfb...378032a44b

    378032a44b 2021-12-15 David Sidrane - [BACKPORT] stm32f7:sdmmc invalidate before DMA to avoid eviction overwrite
2021-12-23 14:50:47 -05:00
Daniel Agar a4040f7afd px4io_serial: always perform full abort DMA on error
- enable DMA error perf count
2021-12-23 12:48:42 -05:00
Beat Küng e29759d877 WorkQueueManager: explicitly convert PTHREAD_STACK_MIN to int
fixes a compiler error on GCC 11.2.1:
error: no matching function for call to ‘max(long int, int)’
2021-12-22 08:47:33 -05:00
Igor Mišić 298a8c4637 boards/fmu-v5x: allocating PPS pin
- start pps_capture before pwm_out
2021-12-17 07:56:08 +01:00
Igor Mišić 60a212f717 px4_arch: add PX4_MAKE_GPIO_EXTI 2021-12-17 07:56:08 +01:00
Jukka Laitinen ce6147f570 uORB: Remove transfer of memory allocation ownership to CDev
- Allocate and free the node name in uORBDeviceNode.
- Add protected build support by de-allocating the name with kmm_free, when
  running in kernel side. strdup allocates from the kernel heap in NuttX kernel
  space.
- Remove the CDev::unregister_driver_and_memory(), it is no longer used

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-12-13 22:52:36 -05:00
Jukka Laitinen 77af102cab px4_work_queue: Use px4_task_spawn_cmd for WorkQueueRunner in NuttX protected
In NuttX protected build there are separate work queues in kernel and user sides.

pthreads are only available in user side, so use tasks and kthreads for
memory protected builds.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-12-09 20:42:28 -05:00
Jukka Laitinen 3aab4d2daf px4_task_spawn_cmd: launch kernel thread in protected/kernel build on kernel side
Also task name is accessible only in kernel side for protected/kernel build

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-12-09 20:42:28 -05:00
Jukka Laitinen d0d7f29422 platforms/common/shutdown.cpp: Enable boardctl functions for shutdown and poweroff
Shutdown and poweroff must go through boardctl in NuttX protected build

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-12-07 09:24:53 -05:00
Daniel Agar 9db5bc0755 px4_mtd: increase retries, wait inbetween, try decreasing frequency 2021-12-06 09:37:08 -05:00
Daniel Agar f63a7642d6 NuttX debug helper improvements
- use NuttX gdb script for nxthreads and thread backtrace
 - update jlink_gdb_backtrace and jlink_debug_gdb helper targets to use
NuttX gdb script
 - Debug/PX4 fix "perf" divide by zero
 - Debug/PX4 add "dmesg"
2021-12-05 19:18:56 -05:00
Beat Küng cbd6e735ad fix console_buffer: avoid potential deadlock when using dmesg over MAVLink shell
dmesg was locking the console buffer, then writing to stdout (a pipe in
the case of the MAVLink shell).
This might block, waiting for mavlink to read from the pipe. If however
mavlink tries to write to the console at that time, the lock is already
taken.
This patch avoids nested locking by using a separate buffer.
2021-11-30 08:49:52 -05:00
Daniel Agar bc7001ba49 NuttX apps with [REJECTED] mkfatfs DMA memory change 2021-11-29 21:49:35 -05:00
Jukka Laitinen 929820136a Move sw_crypto and stub_keystore under src/drivers
This is more logical place for the "backend" implementation than
directly under platform.

This also allows making other implementations as "real" drivers, as well as proper configuration via Kconfigs

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-29 11:09:51 -05:00
David Sidrane 7393a68e28 NuttX with ramtron and BCH backports 2021-11-26 19:27:29 -05:00
Daniel Agar 51da169ccb cmake: nuttx apps build depend .c and .h files 2021-11-25 17:24:23 -05:00
Daniel Agar 7d985ec7c5 NuttX with Backports for SD fixes 2021-11-25 13:11:45 -05:00
David Sidrane 3cf901b29c NuttX Apps with backport CONFIG_MKFATFS_BUFFER_ALIGMENT 2021-11-24 09:46:23 -05:00
Jukka Laitinen b66270f8a8 Inline uORBDeviceNode::copy for performance improvement
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-24 09:11:45 +01:00
Jukka Laitinen 3f884c5d24 Inline deviceNodeExists and getDeviceNode in uORB DeviceMaster
This gives a small performance improvement

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-24 09:11:45 +01:00
Jukka Laitinen bb307cd462 Fix comparing orb_metadata in uORB::DeviceNode::publish
Don't compare pointers to metadata, but the metadata contents.

In protected/kernel build there are two sets of metadata, on on kernel
side and another in user side. Thus the comparison of pointers would just
always fail. Compare orb_id instead

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-24 09:11:45 +01:00
Jukka Laitinen 0b9505453d Clean up interfaces towards uORB
Proxy all calls to the DeviceNode through Manager;
- This hides the DeviceNode from publishers and subscribers
- Manager can be made an interface class between user and kernel spaces in protected build
- This doesn't increase code size or harm the performance on flat build

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-24 09:11:45 +01:00
Beat Küng bcba3dfe52 control_allocator,angular_velocity_controller: run on rate_ctrl wq 2021-11-23 12:40:22 -05:00
Daniel Agar 3140bf167c
NuttX submodule update with work_usrthread.c fixes 2021-11-22 17:41:49 -05:00
Daniel Agar 7653bd1757 cmake fix NuttX config import for 0 values 2021-11-21 12:33:29 -05:00
Jani Paalijarvi 02336acd61 Improve SPI bus implementation
Make possible to define chip-select pin for internal SPI.
By defining chip-select pin, it's possible to start specific SPI device only.
This allows to have several same type of sensors on the same bus with different orientation.
2021-11-19 07:47:18 +01:00
Daniel Agar f5d9b01f5c
NuttX build in place
- cmake NuttX build wrapper compile in place instead of copying source tree to build directory
    - slightly faster skipping necessary copying (depending on system)
    - allows debugging in place
    - easier to work directly in NuttX following official documentation
    - simplifies overall build which should make it easier to resolve any remaining NuttX dependency issues in the build system
 - the downside is switching back and forth between different builds always require rebuilding NuttX, but I think this is worth the improved developer experience
 - also no longer builds px4io and bootloader in every single build, for most users these rarely change and we're wasting a lot of build time
2021-11-15 18:47:38 -05:00
Daniel Agar 7b7b7acd36 i2c_spi_buses: respect CONFIG_I2C and CONFIG_SPI
- bmp280, dps310, and ms5611 barometers support boards without I2C
2021-11-15 15:57:33 -05:00
Jukka Laitinen 356de6ccf1 Factor cdc_acm_init away from px4_init
In protected build, this needs to go to user-space initialization as it
calls apps (sercon) and launches mavlink.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-09 21:28:28 -05:00
Jukka Laitinen 39c0c68167 print_load: Remove reference to CONFIG_MAX_TASKS
This is already removed from nuttx, and in posix the size of s->last_times
can be just checked with sizeof()

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-09 21:25:10 -05:00
Jukka Laitinen 9299a5c3f6 hrt: Add interface functions for latency counters
Add interface functions for fetching latency buckets and counters and use
those in perf_counter.cpp. This cleans up the usage of perf counters, when variables defined in hrt_drv are not referenced directly from perf.

This also enables implementing kernel-userspace interface for those for
nuttx protected/kernel build.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-11-09 21:24:25 -05:00
Guilherme Lawless 47a191489e
cmake: sitl_gazebo build use memory information from the system to estimate the parallel jobs
Using cmake_host_system_information, grabs AVAILABLE_PHYSICAL_MEMORY and adds another job for every 1.5GB of available memory.

This is tested on a single system with 16 logical cores and 16GB RAM (~11.5GB available, reported correctly by cmake).
2021-11-07 15:37:48 -05:00
David Sidrane 96101a9c11 NuttX backports of imxrt dcache fixes to support WB & USB 2021-11-05 13:50:02 -04:00
David Sidrane e2b4e435a9 Build system:Board level control of no-unaligned-access 2021-11-05 13:50:02 -04:00
David Sidrane af9f8f08c6 NuttX PX4 build - capture log in VERBOSE=True|1 2021-11-05 13:50:02 -04:00
Daniel Agar 9c15be22d6 mc_autotune_attitude_control: add new MC_AT_EN parameter to enable
- only enabled by default on boards that aren't memory constrained
2021-11-05 09:52:07 -04:00
Vatsal Asitkumar Joshi ea1ae73526
Support for Raspberry PI RP2040 MCU (#18083) 2021-11-03 12:14:30 -04:00
David Sidrane 38e2e6a01f
Use NuttX MPU Reset (#18283)
* NuttX with MPU reset backports

* Use NuttX MPU reset
2021-10-25 18:05:31 -04:00
Landon Haugh 24cd0c6fa3 Enablement of PX4 SPI driver for UCANS32K146 2021-10-25 08:36:54 -07:00
Daniel Agar 17328bef69 Jenkins attach GDB and print back trace on failure 2021-10-21 14:04:33 -04:00
Beat Küng c0f75b1c79
dshot: add missing '#pragma GCC diagnostic push' 2021-10-20 08:11:07 +02:00