Commit Graph

38103 Commits

Author SHA1 Message Date
Jukka Laitinen 597408c7aa param: Add also a kernel-side kparam module for protected build
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:48 +03:00
Jukka Laitinen ba19abd1db uORB: Create separate systemcmds for kernel and userspace in protected build
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:48 +03:00
Jukka Laitinen 4b6e3f3822 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-09-23 13:57:48 +03:00
Jukka Laitinen 1d79f5d134 Add a simple way to launch kernel side modules
Add px4_insmod command to start/execute px4 modules in kenel space
in NuttX protected build

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:48 +03:00
Jukka Laitinen 5a3ecb0094 Auto-generate a list of kernel-side built-in modules(drivers)
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:48 +03:00
Jukka Laitinen 07ea1e3e8b 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-09-23 13:57:48 +03:00
Jukka Laitinen 4751869cc0 Add console buffer stub for userspace
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:48 +03:00
Jukka Laitinen 04ccb26483 Initialize cxx static variables also in kernel side
For protected/kernel builds the cxx static initializations
needs to be done also in kernel side, since px4 creates
c++ objects in kernel

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:48 +03:00
Jukka Laitinen aeeb4e47a5 Fix parameters building for nuttx protected/kernel builds
- Don't link to px4_layer
- Don't link to flashparams; flashparams would work only in kernel side
- Add missing link to px4_platform

TODO: Make flashparams to work also in protected/kernel build. This would require using some real
OS interface to the flash

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>

fix: bc2f28a68479e4f41017a7d254a263e9e3db5c1e    Fix parameters building for nuttx protected/kernel builds

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:48 +03:00
Jukka Laitinen 01d20ba392 link drivers__device to nuttx_karch instead of nuttx_arch in protected build
On protected/kernel build the library would be karch.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:48 +03:00
Jukka Laitinen f6421ac359 nuttx/stm io_pins: link to drivers_board for timer_io_channels dependency
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:48 +03:00
Jukka Laitinen c5e4e0a267 arch_board_reset: link to nuttx_arch / nuttx_karch for up_systemreset dependency
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:48 +03:00
Jukka Laitinen c63c945eb8 Remove px4_work_queue linking to px4_platform
Remove linking to px4_plaform in here; this breaks linking for nuttx protected build

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:48 +03:00
Jukka Laitinen 557af7e63d Don't link px4_platform directly to uORB
Since uORB is split into kernel and userspace parts, it is no longer possible to just
link uORB into px4_platform, which is used in both kernel and user side.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:43 +03:00
Jukka Laitinen 93f6863bf2 Link arch_spi with drivers_board
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:43 +03:00
Jukka Laitinen dbf7d08c23 Add support for compiling modules into kernel side
Define __KERNEL__ macro during compilation and place the module in separate library

Remove default library linking to m or libc on NuttX. Add these in platform layer instead, since
they are different on kernel and user side

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:37 +03:00
Jukka Laitinen 2a40fcc23c EKF2: Allocate distance sensor subscriptions as member variables
Just create the subscriptions and keep them, instead of
re-creating them continuously

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:37 +03:00
Jukka Laitinen e3b024c15d Modify uORB.cpp main file and CMakeLists.txt for NuttX protected build
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:37 +03:00
Jukka Laitinen 92877e1f35 Add IOCTL interface to uORBManager for nuttx protected/kernel build split
When building uORB for NuttX flat build, or for some other target, everything
works as before.

When building uORB for NuttX protected or kernel build, this does the following:
- The kernel side uORB library reigsters a boardctl handler for calls from userspace
  and services the boardctl_ioctls by calling the actual uORB functions
- For user mode binaries, the uORBManager acts as a proxy, making boardctl_ioctl calls to the
  kernel side
- The uORBDeviceNodes are always allocated in user heap for protected build, so that they
  are accessible from both kernel and user side. This is only for optimization, a few
  functions such as "is_advertised" get really heavy when called frequently via ioctl

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen f54e56d6a8 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-09-23 13:57:31 +03:00
Jukka Laitinen 8d9afdab63 lib/version: Don't link to drivers_board in PROTECTED/KERNEL build
The needed version specific things come from px4 layer in userspace

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen 8497dbb2b5 Add a generic nuttx hrt driver userspace interface
This adds a nuttx userspace interface for hrt driver, communicating with
the actual hrt driver upper half via BOARDCTL IOCTLs

This is be used when running PX4 in NuttX protected or kernel builds

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen 8bb6cc07de 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 and
enables implementing kernel-userspace interface for those for
nuttx protected/kernel build.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen f43b9fe5d6 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-09-23 13:57:31 +03:00
Jukka Laitinen 340c765a14 logger/watchdog: Disable watchdog for NuttX protected/kernel builds
It accesses kernel internal structures directly; this needs to be
worked out with some proper userspace-kernel interface

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen fceb4eaa3f uORB: Change cpuload topic int vehicle_cpuload
This avoids clashes with NuttX cpuload_s datatype.

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen fc6b2d8122 loadmon: Stub away cpuload() for nuttx protected build
CPU load monitoring needs to be in kernel, and some proper interface
to be used in here

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen d17fa568d0 px4 posix: print_load.cpp: Fix build error when building on nuttx
This could be further developed to work also on nuttx in protected/kernel builds

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen 68a4c31a76 Add nuttx userspace reset and reboot request functions
Add functions for reset and reboot, which can be called
from user space in nuttx kernel and protected build

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen c3992634f1 Add a separate library for initializing px4 userspace in protected build
The px4_userspace_init function in this library is called from userspace
entrypoint before starting NSH

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen df0b740710 Split px4_layer into kernel and userspace parts for nuttx protected build
Split the px4_layer into user and kernel space libraries. Add some stubs for
user-space (e.g. version) where an interface to the kernel needs to be added

Use posix-versions for cpuload.cpp and print_load.cpp for userspace; these link to nuttx internals. This functinality could be built on top of posix (e.g. procfs) interfaces

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen 4def01178d Fix px4_impl_os for protected build
For NuttX protected or kernel build, the prebuilds can't contain libraries which are
different for kernel and user-space in protected/kerenl builds

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen 81f24b0a27 px4_fmuv5: Remove BOARD_INDICATE_EXTERNAL_LOCKOUT_STATE in protected/kernel build
Gpios are not directly accessible from userspace, so it should not be
controlled from within Commander directly

There is a need for a proper userspace interface via /dev/leds or such

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:31 +03:00
Jukka Laitinen 69fc3cbde0 NuttX Cmake changes to build combined kernel+userspace image in nuttx protected build
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-23 13:57:25 +03:00
Jukka Laitinen 08f83367ac Add linker scripts for kernel-userspace split
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-22 13:19:47 +03:00
Jukka Laitinen 7c94bc8f02 Add kernel/userspace and nuttx_syscall libraries to build
Build NuttX proxies, stubs and separate user space and kernel space libraries

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-22 13:19:47 +03:00
Jukka Laitinen 169eb616c6 Add px4_fmu-v5_protected target
Add a target for nuttx protected build development

Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-09-22 13:19:42 +03:00
Hamish Willee f41e5985e8 vehicle_local_position: clarify origin of system 2021-09-22 10:14:23 +02:00
Thomas Debrunner 43ece74fa0 ina238: Do not expose raw adc config to user, make specific to ina238 2021-09-22 10:02:17 +02:00
Thomas Debrunner b8d0bb44c4 ina23X: Support for ina23X power monitors 2021-09-22 10:02:17 +02:00
Daniel Agar cf5da66e9f Jenkins: hardware disable gyro auto cal and FFT before running tests 2021-09-21 19:13:30 -04:00
Daniel Agar 87db18c1a0 Jenkins: hardware don't allow board cleanup commands to fail build 2021-09-21 19:13:30 -04:00
Daniel Agar a92e44c90e Tools/HIL/run_nsh_cmd.py: echo success cmd twice to avoid missing dropouts 2021-09-21 19:13:30 -04:00
Julian Oes faca2b17d0 camera_trigger: only get param if available 2021-09-17 12:23:30 +02:00
Daniel Agar 7af5a33ff3 commander: don't play failsafe tune if disarmed 2021-09-16 09:17:00 -04:00
Matthias Grob ecb1264832 vscode: do not disable autocomplete on enter 2021-09-16 09:11:52 -04:00
Julian Oes c779946e05 setup: Use available Java version for Ubuntu 20.04
14 was not available for me, 16 would have been.
2021-09-16 13:59:27 +02:00
Julian Oes addb978364 setup: Let's not ignore errors
Otherwise the script finishes and you don't know if it worked.
2021-09-16 13:59:27 +02:00
Daniel Agar 3d56836850 boards: nxp_fmurt1062-v1 disable extra barometers to save flash 2021-09-15 12:59:36 -04:00
Thomas Stauber 2b80a6958a fix disable airspeed check with negative ASPD_FS_INTEG (#18186)
* fix disable airspeed check with negative ASPD_FS_INTEG

* improve logic when nav velocity data is not good

* simplify logic. Reset integrator state when the check is not run.
2021-09-14 12:13:56 +02:00