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>
This commit is contained in:
Jukka Laitinen
2021-09-23 13:57:31 +03:00
parent df0b740710
commit c3992634f1
2 changed files with 23 additions and 0 deletions
@@ -110,6 +110,13 @@ if (NOT DEFINED CONFIG_BUILD_FLAT AND "${PX4_PLATFORM}" MATCHES "nuttx")
)
add_dependencies(px4_board_ctrl nuttx_context nuttx_kernel_builtin_list_target)
add_library(px4_userspace_init
px4_userspace_init.cpp
)
add_dependencies(px4_userspace_init nuttx_context)
add_dependencies(px4_kernel_layer prebuild_targets)
else()
list(APPEND LIBS
@@ -0,0 +1,16 @@
#include <drivers/drv_hrt.h>
#include <lib/parameters/param.h>
#include <px4_platform_common/px4_work_queue/WorkQueueManager.hpp>
#include <uORB/uORB.h>
#include <sys/boardctl.h>
extern "C" void px4_userspace_init(void)
{
hrt_init();
param_init();
px4::WorkQueueManagerStart();
uorb_start();
}