create PX4 platform layer initialization helper (#11269)

- starts requirements for PX4 modules (hrt, param, etc)
This commit is contained in:
Daniel Agar 2019-01-22 14:13:20 -05:00 committed by GitHub
parent 65fe3ce5d3
commit 320d2e9383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
62 changed files with 327 additions and 560 deletions

View File

@ -417,7 +417,7 @@ add_library(parameters_interface INTERFACE)
include(px4_add_library) include(px4_add_library)
add_subdirectory(src/lib EXCLUDE_FROM_ALL) add_subdirectory(src/lib EXCLUDE_FROM_ALL)
add_subdirectory(src/platforms/common EXCLUDE_FROM_ALL) add_subdirectory(src/platforms EXCLUDE_FROM_ALL)
add_subdirectory(src/modules/systemlib EXCLUDE_FROM_ALL) # TODO: split into libraries in platform layer add_subdirectory(src/modules/systemlib EXCLUDE_FROM_ALL) # TODO: split into libraries in platform layer
add_subdirectory(src/modules/uORB EXCLUDE_FROM_ALL) # TODO: platform layer add_subdirectory(src/modules/uORB EXCLUDE_FROM_ALL) # TODO: platform layer
add_subdirectory(src/drivers/boards EXCLUDE_FROM_ALL) add_subdirectory(src/drivers/boards EXCLUDE_FROM_ALL)

View File

@ -43,8 +43,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
parameters # param_init px4_layer
) )

View File

@ -54,7 +54,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -72,12 +71,7 @@
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <px4_init.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <parameters/param.h>
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
@ -238,26 +232,7 @@ static struct sdio_dev_s *sdio;
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
px4_platform_init();
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -265,11 +240,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
message("DMA alloc FAILED"); message("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;
struct timespec ts; struct timespec ts;

View File

@ -44,8 +44,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
parameters # param_init px4_layer
) )

View File

@ -54,7 +54,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -74,11 +73,8 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <parameters/param.h> #include <px4_init.h>
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
@ -237,24 +233,8 @@ __EXPORT int board_app_initialize(uintptr_t arg)
/* configure power supply control/sense pins */ /* configure power supply control/sense pins */
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -262,11 +242,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
message("DMA alloc FAILED"); message("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* initial LED state */ /* initial LED state */
drv_led_start(); drv_led_start();

View File

@ -42,6 +42,5 @@ px4_add_library(drivers_board
) )
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
nuttx_apps # up_cxxinitialize px4_layer
parameters # param_init
) )

View File

@ -52,7 +52,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -68,8 +67,7 @@
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/cpuload.h> #include <px4_init.h>
#include <parameters/param.h>
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) #if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
#endif #endif
@ -162,24 +160,8 @@ __EXPORT int board_app_initialize(uintptr_t arg)
{ {
int result = OK; int result = OK;
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;

View File

@ -42,8 +42,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
parameters # param_init px4_layer
) )

View File

@ -54,7 +54,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -72,11 +71,8 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <parameters/param.h> #include <px4_init.h>
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
@ -255,24 +251,8 @@ static struct sdio_dev_s *sdio;
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -280,11 +260,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
message("DMA alloc FAILED"); message("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;
struct timespec ts; struct timespec ts;

View File

@ -41,8 +41,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
parameters # param_init px4_layer
) )

View File

@ -55,7 +55,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -75,11 +74,8 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <parameters/param.h> #include <px4_init.h>
#include <px4_i2c.h> #include <px4_i2c.h>
#include "up_internal.h" #include "up_internal.h"
@ -209,13 +205,7 @@ stm32_boardinitialize(void)
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -223,11 +213,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
PX4_ERR("DMA alloc FAILED"); PX4_ERR("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;
struct timespec ts; struct timespec ts;

View File

@ -41,6 +41,5 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize px4_layer
parameters # param_init
) )

View File

@ -54,7 +54,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/analog/adc.h> #include <nuttx/analog/adc.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
@ -68,9 +67,7 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h> #include <px4_init.h>
#include <systemlib/err.h>
#include <parameters/param.h>
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
@ -149,29 +146,8 @@ stm32_boardinitialize(void)
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;

View File

@ -42,8 +42,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
parameters # param_init px4_layer
) )

View File

@ -53,7 +53,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -68,11 +67,8 @@
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <parameters/param.h> #include <px4_init.h>
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
@ -206,24 +202,7 @@ static struct spi_dev_s *spi4;
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) px4_platform_init();
/* run C++ ctors before we go any further */
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -231,11 +210,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
message("DMA alloc FAILED"); message("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;
struct timespec ts; struct timespec ts;

View File

@ -41,7 +41,6 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize px4_layer
parameters # param_init modules__dataman # dm_flash_sector_description_set # TODO: fix this
modules__dataman # dm_flash_sector_description_set
) )

View File

@ -55,7 +55,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/analog/adc.h> #include <nuttx/analog/adc.h>
@ -70,9 +69,7 @@
#include <dataman/dataman.h> #include <dataman/dataman.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h> #include <px4_init.h>
#include <systemlib/err.h>
#include <parameters/param.h>
# if defined(FLASH_BASED_PARAMS) # if defined(FLASH_BASED_PARAMS)
# include <parameters/flashparams/flashfs.h> # include <parameters/flashparams/flashfs.h>
@ -175,29 +172,8 @@ __EXPORT int board_app_initialize(uintptr_t arg)
/* the interruption subsystem is not initialized when stm32_boardinitialize() is called */ /* the interruption subsystem is not initialized when stm32_boardinitialize() is called */
stm32_gpiosetevent(GPIO_FORCE_BOOTLOADER, true, false, false, _bootloader_force_pin_callback, NULL); stm32_gpiosetevent(GPIO_FORCE_BOOTLOADER, true, false, false, _bootloader_force_pin_callback, NULL);
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;

View File

@ -45,9 +45,8 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
drivers__led # drv_led_start drivers__led # drv_led_start
parameters # param_init px4_layer
) )

View File

@ -53,7 +53,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -73,9 +72,8 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h> #include <px4_init.h>
#include <systemlib/err.h>
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
@ -278,24 +276,8 @@ __EXPORT int board_app_initialize(uintptr_t arg)
VDD_ETH_EN(true); VDD_ETH_EN(true);
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
param_init();
/* configure the high-resolution time/callout interface */
hrt_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -303,11 +285,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
message("DMA alloc FAILED"); message("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
#ifdef SERIAL_HAVE_DMA #ifdef SERIAL_HAVE_DMA
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;

View File

@ -42,8 +42,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
parameters # param_init px4_layer
) )

View File

@ -54,7 +54,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -72,11 +71,8 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <parameters/param.h> #include <px4_init.h>
# if defined(FLASH_BASED_PARAMS) # if defined(FLASH_BASED_PARAMS)
# include <parameters/flashparams/flashfs.h> # include <parameters/flashparams/flashfs.h>
@ -260,24 +256,8 @@ static struct spi_dev_s *spi3;
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -285,11 +265,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
message("DMA alloc FAILED"); message("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;
struct timespec ts; struct timespec ts;

View File

@ -41,9 +41,8 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
drivers__led # drv_led_start drivers__led # drv_led_start
parameters # param_init px4_layer
) )

View File

@ -52,7 +52,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -68,8 +67,7 @@
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/cpuload.h> #include <px4_init.h>
#include <parameters/param.h>
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) #if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
#endif #endif
@ -161,24 +159,8 @@ __EXPORT int board_app_initialize(uintptr_t arg)
{ {
int result = OK; int result = OK;
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;

View File

@ -39,7 +39,6 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
nuttx_apps # up_cxxinitialize
drivers__led # drv_led_start drivers__led # drv_led_start
parameters # param_init px4_layer
) )

View File

@ -52,7 +52,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -68,8 +67,7 @@
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/cpuload.h> #include <px4_init.h>
#include <parameters/param.h>
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) #if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
#endif #endif
@ -156,24 +154,8 @@ __EXPORT int board_app_initialize(uintptr_t arg)
int result = OK; int result = OK;
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;

View File

@ -45,8 +45,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
parameters # param_init px4_layer
) )

View File

@ -55,7 +55,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -73,11 +72,8 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <parameters/param.h> #include <px4_init.h>
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
@ -385,14 +381,6 @@ static struct sdio_dev_s *sdio;
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */
up_cxxinitialize();
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* Ensure the power is on 1 ms before we drive the GPIO pins */ /* Ensure the power is on 1 ms before we drive the GPIO pins */
px4_usleep(1000); px4_usleep(1000);
@ -454,10 +442,7 @@ __EXPORT int board_app_initialize(uintptr_t arg)
/* configure SPI interfaces */ /* configure SPI interfaces */
stm32_spiinitialize(); stm32_spiinitialize();
/* configure the high-resolution time/callout interface */ px4_platform_init();
hrt_init();
param_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -465,11 +450,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
message("DMA alloc FAILED"); message("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;
struct timespec ts; struct timespec ts;

View File

@ -45,8 +45,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
parameters # param_init px4_layer
) )

View File

@ -54,7 +54,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -72,11 +71,8 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <parameters/param.h> #include <px4_init.h>
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
@ -384,14 +380,6 @@ static struct sdio_dev_s *sdio;
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */
up_cxxinitialize();
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* Ensure the power is on 1 ms before we drive the GPIO pins */ /* Ensure the power is on 1 ms before we drive the GPIO pins */
usleep(1000); usleep(1000);
@ -453,10 +441,7 @@ __EXPORT int board_app_initialize(uintptr_t arg)
/* configure SPI interfaces */ /* configure SPI interfaces */
stm32_spiinitialize(); stm32_spiinitialize();
/* configure the high-resolution time/callout interface */ px4_platform_init();
hrt_init();
param_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -464,11 +449,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
message("DMA alloc FAILED"); message("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;
struct timespec ts; struct timespec ts;

View File

@ -43,8 +43,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
parameters # param_init px4_layer
) )

View File

@ -54,7 +54,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -73,11 +72,8 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <parameters/param.h> #include <px4_init.h>
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
@ -271,35 +267,13 @@ static struct sdio_dev_s *sdio;
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
px4_platform_init();
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
// Run C++ ctors before we go any further.
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
// Configure the high-resolution time/callout interface.
hrt_init();
param_init();
// Configure the DMA allocator. // Configure the DMA allocator.
if (board_dma_alloc_init() < 0) { if (board_dma_alloc_init() < 0) {
message("DMA alloc FAILED"); message("DMA alloc FAILED");
} }
// Configure CPU load estimation.
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
// Set up the serial DMA polling. // Set up the serial DMA polling.
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;
struct timespec ts; struct timespec ts;

View File

@ -42,8 +42,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
parameters # param_init px4_layer
) )

View File

@ -54,7 +54,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -73,11 +72,8 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <parameters/param.h> #include <px4_init.h>
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
@ -296,19 +292,6 @@ static struct sdio_dev_s *sdio;
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* Bring up the Sensor power */ /* Bring up the Sensor power */
@ -319,10 +302,7 @@ __EXPORT int board_app_initialize(uintptr_t arg)
stm32_spiinitialize(); stm32_spiinitialize();
/* configure the high-resolution time/callout interface */ px4_platform_init();
hrt_init();
param_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -330,11 +310,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
message("DMA alloc FAILED"); message("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;
struct timespec ts; struct timespec ts;

View File

@ -35,17 +35,17 @@ px4_add_library(drivers_board
#stm32_can.c # WIP #stm32_can.c # WIP
init.c init.c
led.c led.c
manifest.c
sdio.c sdio.c
spi.c spi.c
timer_config.c timer_config.c
usb.c usb.c
manifest.c
) )
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
drivers__led # drv_led_start drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
parameters # param_init px4_layer
) )

View File

@ -55,7 +55,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -75,11 +74,8 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <parameters/param.h> #include <px4_init.h>
#include "up_internal.h" #include "up_internal.h"
/**************************************************************************** /****************************************************************************
@ -273,22 +269,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
VDD_5V_RC_EN(true); VDD_5V_RC_EN(true);
VDD_5V_WIFI_EN(true); VDD_5V_WIFI_EN(true);
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
if (OK == board_determine_hw_info()) { if (OK == board_determine_hw_info()) {
PX4_INFO("Rev 0x%1x : Ver 0x%1x %s", board_get_hw_revision(), board_get_hw_version(), board_get_hw_type_name()); PX4_INFO("Rev 0x%1x : Ver 0x%1x %s", board_get_hw_revision(), board_get_hw_version(), board_get_hw_type_name());
@ -297,7 +277,7 @@ __EXPORT int board_app_initialize(uintptr_t arg)
PX4_ERR("Failed to read HW revision and version"); PX4_ERR("Failed to read HW revision and version");
} }
param_init(); px4_platform_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -305,11 +285,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
PX4_ERR("DMA alloc FAILED"); PX4_ERR("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;
struct timespec ts; struct timespec ts;

View File

@ -52,7 +52,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <stm32.h> #include <stm32.h>

View File

@ -40,9 +40,8 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
drivers__led # drv_led_start drivers__led # drv_led_start
parameters # param_init px4_layer
) )

View File

@ -52,7 +52,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -70,9 +69,7 @@
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/cpuload.h> #include <px4_init.h>
#include <perf/perf_counter.h>
#include <parameters/param.h>
/**************************************************************************** /****************************************************************************
* Pre-Processor Definitions * Pre-Processor Definitions
@ -148,30 +145,7 @@ stm32_boardinitialize(void)
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
px4_platform_init();
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;

View File

@ -43,9 +43,8 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio nuttx_arch # sdio
nuttx_drivers # sdio nuttx_drivers # sdio
drivers__led # drv_led_start drivers__led # drv_led_start
parameters # param_init px4_layer
) )

View File

@ -54,7 +54,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -73,11 +72,8 @@
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/px4_macros.h> #include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>
#include <systemlib/err.h>
#include <parameters/param.h> #include <px4_init.h>
#include "up_internal.h" #include "up_internal.h"
/**************************************************************************** /****************************************************************************
@ -236,24 +232,8 @@ stm32_boardinitialize(void)
__EXPORT int board_app_initialize(uintptr_t arg) __EXPORT int board_app_initialize(uintptr_t arg)
{ {
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* configure the DMA allocator */ /* configure the DMA allocator */
@ -261,11 +241,6 @@ __EXPORT int board_app_initialize(uintptr_t arg)
message("DMA alloc FAILED"); message("DMA alloc FAILED");
} }
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;
struct timespec ts; struct timespec ts;

View File

@ -42,6 +42,5 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board target_link_libraries(drivers_board
PRIVATE PRIVATE
nuttx_apps # up_cxxinitialize
drivers_arch drivers_arch
) )

View File

@ -52,7 +52,6 @@
#include <debug.h> #include <debug.h>
#include <errno.h> #include <errno.h>
#include "platform/cxxinitialize.h"
#include <nuttx/board.h> #include <nuttx/board.h>
#include <nuttx/spi/spi.h> #include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h> #include <nuttx/i2c/i2c_master.h>
@ -68,8 +67,7 @@
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#include <drivers/drv_board_led.h> #include <drivers/drv_board_led.h>
#include <systemlib/cpuload.h> #include <px4_init.h>
#include <parameters/param.h>
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE) #if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
#endif #endif
@ -148,24 +146,8 @@ __EXPORT int board_app_initialize(uintptr_t arg)
{ {
int result = OK; int result = OK;
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */ px4_platform_init();
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
/* configure the high-resolution time/callout interface */
hrt_init();
param_init();
/* set up the serial DMA polling */ /* set up the serial DMA polling */
static struct hrt_call serial_dma_call; static struct hrt_call serial_dma_call;

View File

@ -176,6 +176,7 @@ function(px4_add_common_flags)
${PX4_SOURCE_DIR}/src/lib/matrix ${PX4_SOURCE_DIR}/src/lib/matrix
${PX4_SOURCE_DIR}/src/modules ${PX4_SOURCE_DIR}/src/modules
${PX4_SOURCE_DIR}/src/platforms ${PX4_SOURCE_DIR}/src/platforms
${PX4_SOURCE_DIR}/src/platforms/common
) )
add_definitions( add_definitions(

View File

@ -152,7 +152,7 @@ function(px4_add_module)
add_dependencies(${MODULE} uorb_headers) add_dependencies(${MODULE} uorb_headers)
if(NOT DYNAMIC) if(NOT DYNAMIC)
target_link_libraries(${MODULE} PRIVATE prebuild_targets parameters_interface platforms__common px4_layer systemlib) target_link_libraries(${MODULE} PRIVATE prebuild_targets parameters_interface px4_layer px4_platform systemlib)
set_property(GLOBAL APPEND PROPERTY PX4_MODULE_LIBRARIES ${MODULE}) set_property(GLOBAL APPEND PROPERTY PX4_MODULE_LIBRARIES ${MODULE})
set_property(GLOBAL APPEND PROPERTY PX4_MODULE_PATHS ${CMAKE_CURRENT_SOURCE_DIR}) set_property(GLOBAL APPEND PROPERTY PX4_MODULE_PATHS ${CMAKE_CURRENT_SOURCE_DIR})
endif() endif()

View File

@ -96,6 +96,7 @@ target_link_libraries(px4 PRIVATE
-Wl,--gc-sections -Wl,--gc-sections
-Wl,--start-group -Wl,--start-group
drivers_boards_common_arch
${nuttx_libs} ${nuttx_libs}
-Wl,--end-group -Wl,--end-group

View File

@ -37,8 +37,14 @@ if (NOT ${PX4_BOARD} MATCHES "px4_io")
add_library(px4_layer add_library(px4_layer
px4_nuttx_tasks.c px4_nuttx_tasks.c
px4_nuttx_impl.cpp px4_nuttx_impl.cpp
px4_init.cpp
) )
target_link_libraries(px4_layer PRIVATE nuttx_sched drivers_boards_common_arch) target_link_libraries(px4_layer
PRIVATE
nuttx_apps # up_cxxinitialize
nuttx_sched
drivers_boards_common_arch
)
else() else()
add_library(px4_layer ${PX4_SOURCE_DIR}/src/platforms/empty.c) add_library(px4_layer ${PX4_SOURCE_DIR}/src/platforms/empty.c)
endif() endif()

View File

@ -0,0 +1,69 @@
/****************************************************************************
*
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#include "px4_init.h"
#include <px4_config.h>
#include <px4_defines.h>
#include <drivers/drv_hrt.h>
#include <lib/parameters/param.h>
#include <systemlib/cpuload.h>
#include "platform/cxxinitialize.h"
int px4_platform_init(void)
{
#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
/* run C++ ctors before we go any further */
up_cxxinitialize();
# if defined(CONFIG_EXAMPLES_NSH_CXXINITIALIZE)
# error CONFIG_EXAMPLES_NSH_CXXINITIALIZE Must not be defined! Use CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE.
# endif
#else
# error platform is dependent on c++ both CONFIG_HAVE_CXX and CONFIG_HAVE_CXXINITIALIZE must be defined.
#endif
hrt_init();
param_init();
/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
return PX4_OK;
}

View File

@ -62,6 +62,10 @@ else()
${df_driver_libs} ${df_driver_libs}
df_driver_framework df_driver_framework
pthread m pthread m
# horrible circular dependencies that need to be teased apart
px4_layer
px4_platform
) )
if (NOT APPLE) if (NOT APPLE)

View File

@ -48,6 +48,7 @@ add_library(px4_layer
px4_posix_impl.cpp px4_posix_impl.cpp
px4_posix_tasks.cpp px4_posix_tasks.cpp
px4_sem.cpp px4_sem.cpp
px4_init.cpp
lib_crc32.c lib_crc32.c
drv_hrt.cpp drv_hrt.cpp
${SHMEM_SRCS} ${SHMEM_SRCS}

View File

@ -0,0 +1,48 @@
/****************************************************************************
*
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#include "px4_init.h"
#include <px4_config.h>
#include <px4_defines.h>
#include <drivers/drv_hrt.h>
#include <lib/parameters/param.h>
int px4_platform_init(void)
{
hrt_init();
param_init();
return PX4_OK;
}

View File

@ -51,6 +51,7 @@
#include <drivers/drv_hrt.h> #include <drivers/drv_hrt.h>
#include "px4_time.h" #include "px4_time.h"
#include <pthread.h> #include <pthread.h>
#include <px4_init.h>
extern pthread_t _shell_task_id; extern pthread_t _shell_task_id;
@ -69,10 +70,11 @@ void init_once()
{ {
_shell_task_id = pthread_self(); _shell_task_id = pthread_self();
//printf("[init] shell id: %lu\n", (unsigned long)_shell_task_id); //printf("[init] shell id: %lu\n", (unsigned long)_shell_task_id);
work_queues_init(); work_queues_init();
hrt_work_queue_init(); hrt_work_queue_init();
hrt_init();
param_init(); px4_platform_init();
} }
void init(int argc, char *argv[], const char *app_name) void init(int argc, char *argv[], const char *app_name)

View File

@ -44,6 +44,7 @@ set(QURT_LAYER_SRCS
qurt_stubs.c qurt_stubs.c
main.cpp main.cpp
shmem_qurt.cpp shmem_qurt.cpp
px4_init.cpp
) )
if ("${QURT_ENABLE_STUBS}" STREQUAL "1") if ("${QURT_ENABLE_STUBS}" STREQUAL "1")

View File

@ -0,0 +1,48 @@
/****************************************************************************
*
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
#include "px4_init.h"
#include <px4_config.h>
#include <px4_defines.h>
#include <drivers/drv_hrt.h>
#include <lib/parameters/param.h>
int px4_platform_init(void)
{
hrt_init();
param_init();
return PX4_OK;
}

View File

@ -51,7 +51,7 @@
#include <parameters/param.h> #include <parameters/param.h>
#include "hrt_work.h" #include "hrt_work.h"
#include "px4_log.h" #include "px4_log.h"
#include <px4_init.h>
//extern pthread_t _shell_task_id; //extern pthread_t _shell_task_id;
@ -105,8 +105,8 @@ void init_once(void)
work_queues_init(); work_queues_init();
hrt_work_queue_init(); hrt_work_queue_init();
hrt_init();
param_init(); px4_platform_init();
} }
void init(int argc, char *argv[], const char *app_name) void init(int argc, char *argv[], const char *app_name)

View File

@ -37,7 +37,4 @@ px4_add_module(
COMPILE_FLAGS COMPILE_FLAGS
SRCS SRCS
heater.cpp heater.cpp
DEPENDS
platforms__common
modules__uORB
) )

View File

@ -39,6 +39,7 @@ add_subdirectory(battery)
add_subdirectory(bezier) add_subdirectory(bezier)
add_subdirectory(cdev) add_subdirectory(cdev)
add_subdirectory(circuit_breaker) add_subdirectory(circuit_breaker)
add_subdirectory(CollisionPrevention)
add_subdirectory(controllib) add_subdirectory(controllib)
add_subdirectory(conversion) add_subdirectory(conversion)
add_subdirectory(drivers) add_subdirectory(drivers)
@ -56,4 +57,3 @@ add_subdirectory(terrain_estimation)
add_subdirectory(tunes) add_subdirectory(tunes)
add_subdirectory(version) add_subdirectory(version)
add_subdirectory(WeatherVane) add_subdirectory(WeatherVane)
add_subdirectory(CollisionPrevention)

View File

@ -0,0 +1,34 @@
############################################################################
#
# Copyright (c) 2019 PX4 Development Team. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# 3. Neither the name PX4 nor the names of its contributors may be
# used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
add_subdirectory(common)

View File

@ -39,12 +39,12 @@ if (NOT "${PX4_PLATFORM}" MATCHES "qurt" AND NOT "${PX4_BOARD}" MATCHES "io-v2")
) )
endif() endif()
px4_add_library(platforms__common px4_add_library(px4_platform
module.cpp module.cpp
px4_getopt.c px4_getopt.c
px4_cli.cpp px4_cli.cpp
shutdown.cpp shutdown.cpp
${SRCS} ${SRCS}
) )
add_subdirectory(work_queue) add_subdirectory(work_queue)

38
src/platforms/px4_init.h Normal file
View File

@ -0,0 +1,38 @@
/****************************************************************************
*
* Copyright (c) 2019 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. Neither the name PX4 nor the names of its contributors may be
* used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
****************************************************************************/
__BEGIN_DECLS
int px4_platform_init(void);
__END_DECLS

View File

@ -53,7 +53,5 @@ px4_add_module(
SRCS SRCS
rc_receiver_main.cpp rc_receiver_main.cpp
rc_receiver_params.c rc_receiver_params.c
DEPENDS
platforms__common
) )
target_link_libraries(platforms__qurt__fc_addon__rc_receiver PRIVATE rc_receiver) target_link_libraries(platforms__qurt__fc_addon__rc_receiver PRIVATE rc_receiver)

View File

@ -38,6 +38,4 @@ px4_add_module(
-Wno-write-strings -Wno-write-strings
SRCS SRCS
motor_ramp.cpp motor_ramp.cpp
DEPENDS
platforms__common
) )

View File

@ -37,7 +37,4 @@ px4_add_module(
COMPILE_FLAGS COMPILE_FLAGS
SRCS SRCS
shutdown.c shutdown.c
DEPENDS
platforms__common
) )
# vim: set noet ft=cmake fenc=utf-8 ff=unix :