mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-14 15:51:35 +08:00
src/lib/paramters: Add a new interface library for protected build user side
Implement an interface for protected build to access parameters. The implementation only does IOCTL calls to the kernel, where the parameters live. Signed-off-by: Jukka Laitinen <jukkax@ssrc.tii.ae>
This commit is contained in:
committed by
Beat Küng
parent
41a7ae3db2
commit
0d31aadcc3
@@ -150,6 +150,7 @@ add_custom_command(OUTPUT px4_parameters.hpp
|
||||
set(SRCS)
|
||||
|
||||
list(APPEND SRCS parameters.cpp)
|
||||
|
||||
if(BUILD_TESTING)
|
||||
list(APPEND SRCS param_translation_unit_tests.cpp)
|
||||
else()
|
||||
@@ -158,6 +159,14 @@ endif()
|
||||
|
||||
if(${PX4_PLATFORM} STREQUAL "nuttx")
|
||||
add_subdirectory(flashparams)
|
||||
|
||||
# build user-side interface for protected build
|
||||
if(NOT CONFIG_BUILD_FLAT)
|
||||
list(APPEND SRCS parameters_ioctl.cpp)
|
||||
add_library(usr_parameters usr_parameters_if.cpp px4_parameters.hpp)
|
||||
add_dependencies(usr_parameters prebuild_targets)
|
||||
target_compile_definitions(usr_parameters PRIVATE -DMODULE_NAME="usr_parameters")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# TODO: find a better way to do this
|
||||
@@ -169,7 +178,7 @@ if (NOT "${PX4_BOARD}" MATCHES "px4_io")
|
||||
|
||||
target_link_libraries(parameters PRIVATE perf tinybson px4_platform)
|
||||
|
||||
target_compile_definitions(parameters PRIVATE -DMODULE_NAME="parameters")
|
||||
target_compile_definitions(parameters PRIVATE -DMODULE_NAME="parameters" -D__KERNEL__)
|
||||
target_compile_options(parameters
|
||||
PRIVATE
|
||||
#-DDEBUG_BUILD
|
||||
@@ -181,8 +190,8 @@ else()
|
||||
endif()
|
||||
add_dependencies(parameters prebuild_targets)
|
||||
|
||||
if(${PX4_PLATFORM} STREQUAL "nuttx" AND CONFIG_BUILD_FLAT)
|
||||
target_link_libraries(parameters PRIVATE flashparams tinybson)
|
||||
if(${PX4_PLATFORM} STREQUAL "nuttx")
|
||||
target_link_libraries(parameters PRIVATE flashparams)
|
||||
endif()
|
||||
|
||||
px4_add_functional_gtest(SRC ParameterTest.cpp LINKLIBS parameters)
|
||||
|
||||
Reference in New Issue
Block a user