144 Commits

Author SHA1 Message Date
Konrad
50f1abaef1 dataman: extend for double storage geofence and safe points 2024-01-30 11:25:37 -05:00
Konrad
dfa56d474a mission: renaming dataman_id to mission_dataman_id 2024-01-30 11:25:37 -05:00
Konrad
cac858cb24 dataman: use correct size for dataman compat key 2024-01-30 11:25:37 -05:00
muramura
3c444c2f2a dataman: Move before using variable definitions 2024-01-30 11:19:29 -05:00
Konrad
36f0c0f0bf mavlink-mission: Add support for opaque ids and replace update counter with it 2023-11-29 11:10:40 -05:00
Konrad
e2cbf5be94 [RTL] Update MAVLINK Mission logic to send optional loiter points to mission rally points. 2023-10-31 14:16:02 +01:00
Daniel Agar
3476831246
dataman: explicitly check file existence to init
- on NuttX if the SD card was just cleared (quick format) it's possible for the newly created uninitialized dataman file to still have the previous compatibility key, which causes the initialization to be skipped
2023-09-08 10:16:24 -04:00
Beat Küng
72955221cb fix dataman: treat 0 as valid return for read & ensure to init buffer
This can happen e.g. when the item is cleared.
2023-07-24 13:10:31 +02:00
Igor Mišić
3d6c376b47 dataman: add guards for max item value 2023-07-24 13:10:31 +02:00
Igor Mišić
b6b32c5a94 dataman: update compat version
A version update is needed since the dataman is showing errors if data doesn't exist or if it is wrongly stored. This will force default data to be initialized.
2023-07-24 13:10:31 +02:00
Igor Mišić
57f11c8149 dataman: add perf_counter 2023-07-24 13:10:31 +02:00
Igor Mišić
c40a38bd88 dataman: remove locking mechanism 2023-07-24 13:10:31 +02:00
Igor Mišić
208552fdab dataman: add DatamanClient with sync functions
Rework of dataman
2023-07-24 13:10:31 +02:00
Igor Mišić
c67af1479f dataman: refactoring _file_initialize
clear dataman file and init initial value on creation
2023-07-24 13:10:31 +02:00
Daniel Agar
45912066d2 fix copyright header year range 2023-01-14 09:16:16 -05:00
Ville Juven
d4cce452cf modules/dataman: Increase stack size by 100B
Fixes:
WARN  [load_mon] dataman low on stack! (276 bytes left)

Seen on px4_fmu-v5_protected target.
2022-09-07 20:02:26 -04:00
Beat Küng
f22dc80ecc system: add missing includes (added indirectly via visibility.h for normal builds) 2022-07-20 01:14:04 -04:00
Igor Mišić
3c09448daf dataman: add silence flag for _file_initialize 2022-02-21 08:36:36 +01:00
Jukka Laitinen
9449ed6e66 Add support for protected build in drivers, systemcmds and modules Kconfig
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2022-02-18 07:58:58 +01:00
Daniel Agar
986cf288da
dataman: remove obsolete persistence and reset reason 2021-12-12 12:06:35 -05:00
Daniel Agar
ca3f6f59f9 dataman: add SYS_DM_BACKEND parameter 2021-12-10 09:10:02 -05:00
Daniel Agar
08b0ac9654 dataman: retry file read/write failures and report seek errors 2021-12-07 17:03:07 -05:00
Daniel Agar
8cd517f533 dataman: PX4_ERR on create_work_item failure 2021-12-06 10:23:42 -05:00
Peter van der Perk
4e4aabc03f Update Kconfig after rebasing 03-05-21 2021-10-07 10:09:01 -04:00
Beat Küng
1b0bfd6381 dataman: remove nonexisting SYS_RESTART_TYPE param 2021-09-25 19:15:05 -04:00
Jukka Laitinen
8cf121fc9d Increase dataman stack size for 64 bit targets
Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
2021-08-24 10:16:27 -04:00
David Sidrane
350e43f02c dataman:fix types 2021-06-16 17:07:47 +02:00
Daniel Agar
fd1fff89d4 dataman: remove flash backend 2021-02-26 00:28:48 +01:00
Daniel Agar
45b32b5eaa
dataman: add read and write perf counters 2019-11-21 11:10:35 -05:00
David Sidrane
e847698c9f PX4 System changes Supporting STM32H7
stm32:ToneAlarmInterfacePWM TIM15-TIM17 have a BDTR Register

common:board_crashdump Add H7 support

stm32/board_mcu_version:Support H7

PX4 ADC:Use 32 interface and resoution abstraction

Added PX4 stm32h7 ADC driver

stm32h7:adc fix ADC ready check

fmu: handle BOARD_HAS_PWM==5

cmake: improve error handling for NuttX olddefconfig failures

WorkQueueManager:Quiet loadmon stack warning

camera_trigger:GPIO support < 6 GPIO

Adjust stack sizes (under hw stack check)

PX4 System changes Supporting STM32H7 PX4IO Driver

aerotenna_ocpoc:ADC add px4_arch_adc_dn_fullcount

init.cmake:Track Upstream change needing Make.def at config time

PX4 System changes Supporting STM32H7

NuttX CMakeLists.txt Track upstream changes

Common board_crashdump add header and px4 config

NuttX simplify callinb make libapps

Use UINT32_MAX for error return

drivers:uavcannode NuttX chip is now hardware

drivers:uavcanesc NuttX chip is now hardware

px4io:Avoid Race on AP to PX4 IO upgrade
2019-11-16 11:43:42 +01:00
Beat Küng
3198610f85 src/platforms: move all headers to platforms/common/include/px4_platform_common
and remove the px4_ prefix, except for px4_config.h.

command to update includes:
for k in app.h atomic.h cli.h console_buffer.h defines.h getopt.h i2c.h init.h log.h micro_hal.h module.h module_params.h param.h param_macros.h posix.h sem.h sem.hpp shmem.h shutdown.h tasks.h time.h workqueue.h; do for i in $(grep -rl 'include <px4_'$k src platforms boards); do sed -i 's/#include <px4_'$k'/#include <px4_platform_common\/'$k/ $i; done; done
for in $(grep -rl 'include <px4_config.h' src platforms boards); do sed -i 's/#include <px4_config.h/#include <px4_platform_common\/px4_config.h'/ $i; done

Transitional headers for submodules are added (px4_{defines,log,time}.h)
2019-10-30 11:48:47 +01:00
Silvan Fuhrer
99dd229d71 Rally Point: fix typo of save to safe in mission_safe_point_s
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
2019-10-28 09:54:59 +01:00
Beat Küng
884621415d dataman: fix invalid use of px4_sem_timedwait
px4_sem_timedwait expects an absolute time (from CLOCK_REALTIME), but a
relative time was provided.

This is only relevant if FLASH_BASED_DATAMAN is set (only on Intel aero).
2019-10-16 18:29:26 +02:00
Daniel Agar
78ef8aab2d STACK_MAIN increase default 1024 -> 2048 2019-08-30 19:11:51 -07:00
Julian Oes
bf32ff32f8 dataman: make _file_write more readable
This should not be any functional change. The only difference are the
variable scopes, and early return versus nested ifs.
2019-04-24 11:15:43 -04:00
Daniel Agar
b35d048566 cmake enable -Wcast-align and disable per module 2019-03-16 11:47:15 -04:00
bazooka joe
922c19aa9c using only px4_getopt() and never the unsafe getopt()
using only <px4_getopt.h> as include, cleanup related includes
added check that all the option are valid (myoptind >= argc). if there are invalid options on some script that might now lead not to run commands
2019-02-21 09:45:45 +01:00
Daniel Agar
8185334994 navigation.h handle mission item structure padding explicitly
- also applies to mission_stats_entry_s, mission_fence_point_s,
   mission_save_point_s
 - -Wpadded warning is disabled by default because the snapdragon
   toolchain doesn't respect the pragma pop
2019-02-13 08:08:01 +01:00
David Sidrane
f00d633196 flashfs:Upstream renamed up_progmem_erasepage to up_progmem_eraseblock 2019-01-25 06:32:37 -08:00
Julian Oes
09595a1de9 dataman: left FIXME comment
We shouldn't be using module here.
2018-12-22 10:32:18 +01:00
Beat Küng
c0cac0594e file paths: add PX4_STORAGEDIR & use it where appropriate 2018-08-08 21:09:39 +02:00
Julian Oes
0c5c741b1a add posix shell
squashed & rebased version, not including:
- listener changes
- src/firmware renaming

Commits:

tag_to_version.py: fix Python3 error

subprocess.communicate returns bytes instead of a str which is not the
same for Python3. Therefore, we need to decode the bytes.

cmake: remove folder src/firmware

The folder src/firmware was not intuitive. Why would the binaries for
SITL be inside a src and why even inside a src/firmware folder. Also,
the rootfs was put there which made it even more confusing.

The CMakeLists.txt files are moved into cmake/ and get now called from
the main CMakeLists.txt.

qshell: support for return value

Instead of just sending commands, qshell will now also wait until
the command has finished on QURT and sent back a return value. This will
allow all modules on the DSP side to be spawned from the Linux side
meaning that we only need one config/startup file instead of two.

adb_upload: create folders before pushing

Previously the script failed if the folder on the destination was not
already existing. This therefore makes pushing easier.

posix: spawn PX4 modules in bash

This adds the possibility to spawn PX4 modules out of bash. Basically,
the main executable can now be started as a server/daemon or as a
client.
The server replaces the existing functionality of the main exe with
the pxh shell, however, it also opens a pipe that clients can talk to.

Clients can run or spawn PX4 modules or commands by connecting to the
server over the pipe. They clients will get the stdout and return value
of their commands via a client specific pipe back.

This work will allow to start all modules using a bash script similar to
the way it is done in NuttX where the NuttShell scripts the startup
scripts and starts the modules.

SITL: use new client shell in SITL

This is a first step to use the new shell capabilities for SITL.
The new startup bash script rcS merges (and therefore replaces) the two
existing scripts rcS_gazebo_iris and rcS_jmavsim_iris.

More cleanup will be necessary for the rest of the SITL startup scripts.

Snapdragon: use new shell to start all modules

Instead of different mainapp.config and px4.config files, we can now use
a unified rcS bash script which starts all the modules based on
parameters, mainly the SYS_AUTOSTART param.

Snapdragon: fix the airframe description

pxh: argv needs to end with a nullptr

The comment was wrong that argv needs an additional 0 termination.
Instead it needs a nullptr at the end.

px4_posix_tasks: variable cleanup

The px4_task_spawn_cmd function got a cleanup while debugging, however,
no functional changes.

Snapdragon: move some drivers to 4100 config

These drivers are supported by the community, so they go into the 4100
config.

Snapdragon: update 210qc platform

px4_daemon: use doxygen comments

apps.h_in: fix string printf: use .c_str()

px4_daemon: \b -> \n in printf

px4_daemon: handle error in generate_uuid (close the file on error)

posix main: some clarifications in comment (it's the symlinks not the script aliases)

cmake: remove new install command again

This one was probably wrong and untested. Installing needs revisiting.

POSIX: remove argument USES_TERMINAL

POSIX: copy init and mixer files for SITL

Instead of using non-working install commands, the mixer and startup
files are now copied as part of the build in cmake.

adb_upload.sh: remove leftover commented printf

POSIX main: just the pointer instead of memmove

POSIX main: remove chroot

chroot is removed because it hasn't been used anywhere and seems
untested.

px4_daemon: remove client pipe when cleaning up

px4_daemon: fail if the client pipe already exists

The client pipe is supposed to be specific (by UUID), so the path
shouldn't exist already.

history: limit the number of history entries

This is a protection to avoid filling the memory if we are entering a
lot of commands (e.g. auto-generated).

px4_daemon: add a threadsafe map and use it

px4_daemon: whitespace

px4_daemon: fix client parsing

Sometimes the client ends up reading more than one packet in one read.
The parsing is not made for this and would require a (ring)buffer for
it.

The solution of this commit just reads as much as needed from the pipe
which avoids having to do buffering and parsing.

posix: changes sitl_run.sh and main.cpp cleanup

This changes the paths in sitl_run.sh quite a bit to allow the px4
binary to run in the rootfs directory which should make it convenient
and very close to the NuttX variant.

Also main.cpp got a big cleanup after the big rebase with some
conflicts. Quite some functionality was removed but it has yet to be
seen if it needs to be re-added.

px4_log: cleanup log levels, now they make sense

Before DEBUG and INFO log levels where inverted which didn't make much
sense in my eyes.

dataman: fix path for bash shell

logger: fix paths for bash shell

mavlink: fix paths for bash shell

param: fix path for bash shell

inav: fix paths for bash shell

sdlog2: fix paths for bash shell

ROMFS: add forgotten mixer to list

SITL init: more models, more options

- Support for different models using the unified startup
script rcS.
- Support to choose the estimator by setting the environment variable
  PX4_ESTIMATOR.
- Support to choose the logger by setting the environment variable
  PX4_LOGGER.

rcS: fix string comparison

listener: use template file

Instead of having all of the C++ code inside the Python file it is
nicer to have a separate template file with the C++ headers, etc.

px4_log: add PX4_INFO_RAW for raw printfs

This allows to do custom formatting but is still transported over
sockets to clients.

topic_listener: use PX4_INFO_RAW instead of printf

commander: use PX4_INFO_RAW for status

listener: rewrite to classes and factory

posix: fix some argument warnings

generate_listener.py: by accident changed shebang

listener: big refactor of the generator

Hopefully this makes it easier to read and change in the future.

rcS: manually take over rebase changes

listener: remove leftover try

listener: properly clean up topic instance

rcS: take over some vehicle specific changes

posix-configs: vehicle specifics to separate files

posix-configs: remove leftover lines

uORBDevices: new PX4_INFO_RAW instead of printf

px4_log: just use printf on NuttX

listener: use less binary space, strip on NuttX

generate_listener.py: remove commented code

cmake: fix syntax error from merge

px4_daemon: fixes after rebase of apps.h/cpp fix

px4_daemon: namespace missing

posix: only create stub for fsync on QURT

unitests: reduce dependencies of param test

This makes the unit test compile and link again after the bash changes.

QURT: some compile fixes after a rebase

SITL: arg change for sitl_run.sh to use rcS_test

This allows to use a custom startup file for testing.

SITL: add the folder test_data

SITL: implement shutdown command as systemcmd

The shutdown command needs to be a proper systemcmd, otherwise the alias
and symlink generation doesn't work and we end up calling shutdown of
the host computer which is to be avoided.

px4fmu_test: same IO_pass mixer as px4fmu_default

px4fmu_test: use normal quad x mixer

There is no good reason to use a specific test mixer, except more cmake
code around it. Therefore just use the same mixer as default, and at
some point px4fmu_test and px4fmu_default can get merged

POSIX: cleanup, dir and symlink fixes

This cleans up the logic behind the symlinking and creating directories.

POSIX: correct arg order in usage info

tests: fix paths for SITL tests

POSIX: printf fix

sitl_run.sh: try to make this run on Mac as well

cmake: try to make jenkins happier

Path cleanup, the bin is no longer in src/firmware

POSIX: fix symlink logic

SITL: prefix all exported env variables

cmake: fix path for ROS tests

integrationtests: fix log path

launch: try to make tets with ROS working again

px4_defines: fix after wrong merge deconflicting

px4_defines: get paths for POSIX correct

cmake: fix cmake arguments

This was fine with cmake 3.6 but did not work with cmake 3.2.2

cmake: use cp instead of cmake -E copy

cmake -E copy does not support copying multiple files with versions <
3.5. Therefore, just use cp for now.

ROMFS: fix build error after rebase

cmake: fix paths in configs

launch: use `spawn_model` again

cmake: various fixes after big rebase

param: path fixes after rebase

posix platform: fixes after rebase

test_mixer: fix screwed up rebase
2018-08-08 21:09:39 +02:00
Daniel Agar
9ce83f2208 fix all sign-compare warnings 2018-07-01 09:36:55 +00:00
Daniel Agar
cf74166801 double promotion warning fix or ignore per module 2018-07-01 09:36:55 +00:00
Daniel Agar
2f553b956d dataman file read fixed size buffer 2018-05-18 08:03:56 +02:00
Daniel Agar
ea3acb7121 cmake remove circular linking and reorganize
- px4_add_module now requires MAIN
 - px4_add_library doesn't automatically link
2018-04-29 21:48:54 -04:00
Daniel Agar
450229c2a4 dataman operations table is constexpr 2018-04-03 18:37:51 -04:00
Daniel Agar
916d6a15fd Mission merge offboard + onboard and simplify 2018-01-14 12:53:53 +01:00
José Roberto de Souza
239de7191f dataman: Prevent database corruption
The size in g_per_item_size[item] is the real struct size
+ DM_SECTOR_HDR_SIZE bytes of header and the backend functions were
not taking in care it. So a call to dm_write() with more bytes than
the real struct is allowed, causing corruption in the header of the
next item.

Kudos to jeonghwan-lee for finding it. https://github.com/PX4/Firmware/issues/7927
2017-10-16 23:38:03 +02:00
Beat Küng
c82deaf26f dataman: fix test for return value of px4_task_spawn_cmd
And destroy the semaphore if startup fails.

Credits for finding this go to @jeonghwan-lee
2017-09-11 02:04:27 -07:00