Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PX4 platform init #11269

Merged
merged 1 commit into from
Jan 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ add_library(parameters_interface INTERFACE)
include(px4_add_library)
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/uORB EXCLUDE_FROM_ALL) # TODO: platform layer
add_subdirectory(src/drivers/boards EXCLUDE_FROM_ALL)
Expand Down
3 changes: 1 addition & 2 deletions boards/airmind/mindpx-v2/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board
PRIVATE
drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio
nuttx_drivers # sdio
parameters # param_init
px4_layer
)
34 changes: 2 additions & 32 deletions boards/airmind/mindpx-v2/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#include <debug.h>
#include <errno.h>

#include "platform/cxxinitialize.h"
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h>
Expand All @@ -72,12 +71,7 @@
#include <drivers/drv_hrt.h>
#include <drivers/drv_board_led.h>

#include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <perf/perf_counter.h>


#include <parameters/param.h>
#include <px4_init.h>

/****************************************************************************
* Pre-Processor Definitions
Expand Down Expand Up @@ -238,38 +232,14 @@ static struct sdio_dev_s *sdio;

__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

/* configure the high-resolution time/callout interface */

hrt_init();

param_init();
px4_platform_init();

/* configure the DMA allocator */

if (board_dma_alloc_init() < 0) {
message("DMA alloc FAILED");
}

/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif

/* set up the serial DMA polling */
static struct hrt_call serial_dma_call;
struct timespec ts;
Expand Down
3 changes: 1 addition & 2 deletions boards/atmel/same70xplained/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board
PRIVATE
drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio
nuttx_drivers # sdio
parameters # param_init
px4_layer
)
29 changes: 2 additions & 27 deletions boards/atmel/same70xplained/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#include <debug.h>
#include <errno.h>

#include "platform/cxxinitialize.h"
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h>
Expand All @@ -74,11 +73,8 @@
#include <drivers/drv_board_led.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
Expand Down Expand Up @@ -237,36 +233,15 @@ __EXPORT int board_app_initialize(uintptr_t arg)

/* configure power supply control/sense pins */

#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();
px4_platform_init();

/* configure the DMA allocator */

if (board_dma_alloc_init() < 0) {
message("DMA alloc FAILED");
}

/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif


/* initial LED state */
drv_led_start();
Expand Down
3 changes: 1 addition & 2 deletions boards/auav/esc35-v1/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,5 @@ px4_add_library(drivers_board
)
target_link_libraries(drivers_board
PRIVATE
nuttx_apps # up_cxxinitialize
parameters # param_init
px4_layer
)
22 changes: 2 additions & 20 deletions boards/auav/esc35-v1/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
#include <debug.h>
#include <errno.h>

#include "platform/cxxinitialize.h"
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h>
Expand All @@ -68,8 +67,7 @@
#include <drivers/drv_hrt.h>
#include <drivers/drv_board_led.h>

#include <systemlib/cpuload.h>
#include <parameters/param.h>
#include <px4_init.h>

#if defined(CONFIG_HAVE_CXX) && defined(CONFIG_HAVE_CXXINITIALIZE)
#endif
Expand Down Expand Up @@ -162,24 +160,8 @@ __EXPORT int board_app_initialize(uintptr_t arg)
{
int result = OK;

#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();
px4_platform_init();

/* set up the serial DMA polling */
static struct hrt_call serial_dma_call;
Expand Down
3 changes: 1 addition & 2 deletions boards/auav/x21/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board
PRIVATE
drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio
nuttx_drivers # sdio
parameters # param_init
px4_layer
)
29 changes: 2 additions & 27 deletions boards/auav/x21/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#include <debug.h>
#include <errno.h>

#include "platform/cxxinitialize.h"
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h>
Expand All @@ -72,11 +71,8 @@
#include <drivers/drv_board_led.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
Expand Down Expand Up @@ -255,36 +251,15 @@ static struct sdio_dev_s *sdio;

__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

/* configure the high-resolution time/callout interface */
hrt_init();

param_init();
px4_platform_init();

/* configure the DMA allocator */

if (board_dma_alloc_init() < 0) {
message("DMA alloc FAILED");
}

/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif

/* set up the serial DMA polling */
static struct hrt_call serial_dma_call;
struct timespec ts;
Expand Down
3 changes: 1 addition & 2 deletions boards/av/x-v1/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board
PRIVATE
drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio
nuttx_drivers # sdio
parameters # param_init
px4_layer
)
19 changes: 2 additions & 17 deletions boards/av/x-v1/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
#include <debug.h>
#include <errno.h>

#include "platform/cxxinitialize.h"
#include <nuttx/board.h>
#include <nuttx/spi/spi.h>
#include <nuttx/i2c/i2c_master.h>
Expand All @@ -75,11 +74,8 @@
#include <drivers/drv_board_led.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 "up_internal.h"
Expand Down Expand Up @@ -209,25 +205,14 @@ stm32_boardinitialize(void)

__EXPORT int board_app_initialize(uintptr_t arg)
{
/* run C++ ctors before we go any further */
up_cxxinitialize();

/* configure the high-resolution time/callout interface */
hrt_init();

param_init();
px4_platform_init();

/* configure the DMA allocator */

if (board_dma_alloc_init() < 0) {
PX4_ERR("DMA alloc FAILED");
}

/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif

/* set up the serial DMA polling */
static struct hrt_call serial_dma_call;
struct timespec ts;
Expand Down
3 changes: 1 addition & 2 deletions boards/bitcraze/crazyflie/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,5 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board
PRIVATE
drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
parameters # param_init
px4_layer
)
28 changes: 2 additions & 26 deletions boards/bitcraze/crazyflie/src/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
#include <debug.h>
#include <errno.h>

#include "platform/cxxinitialize.h"
#include <nuttx/board.h>
#include <nuttx/analog/adc.h>
#include <nuttx/spi/spi.h>
Expand All @@ -68,9 +67,7 @@
#include <drivers/drv_board_led.h>

#include <systemlib/px4_macros.h>
#include <systemlib/cpuload.h>
#include <systemlib/err.h>
#include <parameters/param.h>
#include <px4_init.h>

/****************************************************************************
* Pre-Processor Definitions
Expand Down Expand Up @@ -149,29 +146,8 @@ stm32_boardinitialize(void)

__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

/* configure the high-resolution time/callout interface */
hrt_init();

param_init();

/* configure CPU load estimation */
#ifdef CONFIG_SCHED_INSTRUMENTATION
cpuload_initialize_once();
#endif
px4_platform_init();

/* set up the serial DMA polling */
static struct hrt_call serial_dma_call;
Expand Down
3 changes: 1 addition & 2 deletions boards/gumstix/aerocore2/src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ px4_add_library(drivers_board
target_link_libraries(drivers_board
PRIVATE
drivers__led # drv_led_start
nuttx_apps # up_cxxinitialize
nuttx_arch # sdio
nuttx_drivers # sdio
parameters # param_init
px4_layer
)
Loading