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

Port PX4 to BeagleBone Blue #9635

Closed
wants to merge 31 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
954c42c
Updated src/lib/DriverFramework
Bob-F May 27, 2018
1fdedcd
changes from git pull upstream master
UAV-Pilot May 31, 2018
4a90254
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
72236b7
Merge branch 'master' of https://github.com/PX4/Firmware
UAV-Pilot Jun 10, 2018
a002bf1
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
126a9e4
Revert "Updated src/lib/DriverFramework"
UAV-Pilot Jun 10, 2018
02697b5
skip output redirect when parsing arguments in main function
UAV-Pilot Jun 10, 2018
e47c9a4
resolve a conflict during git operations
UAV-Pilot Jun 10, 2018
eb2d15d
Added Robotics_Cape_Installer submodule
UAV-Pilot Jun 10, 2018
c98cc66
Merge branch 'master' of https://github.com/PX4/Firmware
UAV-Pilot Jun 13, 2018
0162b09
Merge branch 'master' of https://github.com/PX4/Firmware
UAV-Pilot Jun 13, 2018
a45ce46
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
8dd5fbb
Revert "Updated src/lib/DriverFramework"
UAV-Pilot Jun 10, 2018
a95964a
skip output redirect when parsing arguments in main function
UAV-Pilot Jun 10, 2018
4134f72
Added Robotics_Cape_Installer submodule
UAV-Pilot Jun 10, 2018
6a03294
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
a4b65a1
Modified per pull request comments: rolled back changes to px4_base.c…
UAV-Pilot Jun 13, 2018
1412c71
Resolve push conflict
UAV-Pilot Jun 13, 2018
19db523
Modified per pull request comments
UAV-Pilot Jun 13, 2018
2ad7fd9
sync change to src/lib/DriverFramework
UAV-Pilot Jun 13, 2018
5566ce5
Merge branch 'master' of https://github.com/PX4/Firmware
UAV-Pilot Jun 13, 2018
deb6d2d
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
60ad621
Revert "Updated src/lib/DriverFramework"
UAV-Pilot Jun 10, 2018
54e1381
skip output redirect when parsing arguments in main function
UAV-Pilot Jun 10, 2018
09e750e
Added Robotics_Cape_Installer submodule
UAV-Pilot Jun 10, 2018
0817fd2
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
acdc25e
skip output redirect when parsing arguments in main function
UAV-Pilot Jun 10, 2018
8bf145e
Firmware changes for porting PX4 to BeagleBone Blue board
UAV-Pilot May 31, 2018
d8e8914
Modified per pull request comments: rolled back changes to px4_base.c…
UAV-Pilot Jun 13, 2018
25a0b02
Modified per pull request comments
UAV-Pilot Jun 13, 2018
c10855e
git sync
UAV-Pilot Jun 13, 2018
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
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@
path = cmake/configs/uavcan_board_ident
url = https://github.com/PX4/uavcan_board_ident.git
branch = master
[submodule "src/lib/Robotics_Cape_Installer"]
path = src/lib/Robotics_Cape_Installer
url = https://github.com/StrawsonDesign/Robotics_Cape_Installer
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ add_subdirectory(msg EXCLUDE_FROM_ALL)

px4_generate_airframes_xml(BOARD ${BOARD})

add_subdirectory(src/lib/Robotics_Cape_Installer)

#=============================================================================
# DriverFramework
#
Expand Down
2 changes: 1 addition & 1 deletion Tools/sitl_gazebo
117 changes: 82 additions & 35 deletions cmake/common/px4_base.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -333,30 +333,58 @@ function(px4_add_common_flags)
REQUIRED ${inout_vars} BOARD
ARGN ${ARGN})

set(warnings
-Wall
-Warray-bounds
-Wdisabled-optimization
-Werror
-Wextra
-Wfatal-errors
-Wfloat-equal
-Wformat-security
-Winit-self
-Wlogical-op
-Wmissing-declarations
-Wmissing-field-initializers
#-Wmissing-include-dirs # TODO: fix and enable
-Wpointer-arith
-Wshadow
-Wuninitialized
-Wunknown-pragmas
-Wunused-variable

-Wno-implicit-fallthrough # set appropriate level and update

-Wno-unused-parameter
)
if(CONFIG MATCHES "^posix_bbblue_")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to discuss in the robotics cape library is actually needed as a submodule, but for now you could pass -Wno-error to it alone rather than changing these flags system wide.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't played with the Robotics Cape, but it seems to me that it's incompatible with/redundant to the Beaglebone Blue. Are you including the Robotics Cape so that you can support the Black?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, I was talking about the hardware while you were talking about the library...

The interface to librobotics needs to be part of a module, but it seems like the calls could be hidden inside of the PWM, etc. APIs and then the library itself could be shared from the host platform.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although with enough available time and experience with TI’s ARM processor, which I don’t have, one could implement the porting without the Robotics Cape library, I’d think using this library made my porting an order of magnitude easier than implementing the corresponding features from scratch. Device initialization and other device specific APIs from this library are used for BMP280/MPU9250 I2C driver, ADC, linux_pwm, etc. Let’s take a look of linux_pwm adaption for example. The porting code simply uses 2 APIs from the library: one for initialization and another for setting pulse width, however the underline hardware and corresponding software in the library are much more complicated than these 2 seemingly simple APIs. In TI AM33XX processor, there is a PRUSS (Programmable Real-time Unit Sub System), which consists of two 32-bit 200MHz real-time core (PRU). In Robotics Cape library, the servo initialization API loads assembly code into PRU to generate PWM signals, and the pulse width setting API communicate with the external processor (PRU) through shared memory. Thus the PWM implementation involves multiple processors of different kinds: ARM and PRU, and inter-processor communication. These are not trivial tasks. Another benefit of using this library is in maintenance area. After the release of BeagleBone Blue board, its users had quite some issues when device tree in software was out of sync with kernel updates, and this issue was only resolved recently. For details, refer to this email thread: https://groups.google.com/forum/#!msg/beagleboard/GHeMjrAM5AE/zcfCc8YVCQAJ . By using this library, PX4 users with BeagleBone Blue boards and traditional Robotics Cape Library users can help each other in library maintenance with regarding to kernel updates. Another aspect is that TI made the Blue variant of the BeagleBone board by combining previously 2 boards: a BeagleBone board and a Robotics Cape (the hardware corresponding to the Robotics Cape Library software) into one board: BeagleBone Blue, so it’s natural to me to use a library which was specifically developed for BeagleBone Blue board.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's likely that PX4 users would choose BeagleBone Black plus a sensor board over the integrated BeagleBone Blue board, so I did not think about supporting BeagleBone Black before.

#Gradually apply px4 warnings to robotics cape library later
set(warnings
-Wall
-Warray-bounds
-Wdisabled-optimization
-Werror
-Wextra
-Wfatal-errors
-Wfloat-equal
-Wformat-security
-Winit-self
-Wlogical-op
#-Wmissing-declarations
-Wmissing-field-initializers
#-Wmissing-include-dirs # TODO: fix and enable
#-Wpointer-arith
-Wshadow
-Wuninitialized
-Wunknown-pragmas
-Wno-unused-variable

-Wno-implicit-fallthrough # set appropriate level and update

-Wno-unused-parameter
)
else()
set(warnings
-Wall
-Warray-bounds
-Wdisabled-optimization
-Werror
-Wextra
-Wfatal-errors
-Wfloat-equal
-Wformat-security
-Winit-self
-Wlogical-op
-Wmissing-declarations
-Wmissing-field-initializers
#-Wmissing-include-dirs # TODO: fix and enable
-Wpointer-arith
-Wshadow
-Wuninitialized
-Wunknown-pragmas
-Wunused-variable

-Wno-implicit-fallthrough # set appropriate level and update

-Wno-unused-parameter
)
endif()

if (${CMAKE_C_COMPILER_ID} MATCHES ".*Clang.*")
# QuRT 6.4.X compiler identifies as Clang but does not support this option
Expand All @@ -372,11 +400,20 @@ function(px4_add_common_flags)
)
endif()
else()
list(APPEND warnings
-Wunused-but-set-variable
-Wformat=1
-Wdouble-promotion
)
if(CONFIG MATCHES "^posix_bbblue_")
#fix robotics cape library later
list(APPEND warnings
-Wunused-but-set-variable
-Wformat=1
#-Wdouble-promotion
)
else()
list(APPEND warnings
-Wunused-but-set-variable
-Wformat=1
-Wdouble-promotion
)
endif()
endif()

set(_optimization_flags
Expand All @@ -390,12 +427,22 @@ function(px4_add_common_flags)
-fdata-sections
)

set(c_warnings
-Wbad-function-cast
-Wstrict-prototypes
-Wmissing-prototypes
-Wnested-externs
)
if(CONFIG MATCHES "^posix_bbblue_")
#fix robotics cape library later
set(c_warnings
-Wbad-function-cast
#-Wstrict-prototypes
#-Wmissing-prototypes
-Wnested-externs
)
else()
set(c_warnings
-Wbad-function-cast
-Wstrict-prototypes
-Wmissing-prototypes
-Wnested-externs
)
endif()

set(c_compile_flags
-g
Expand Down
105 changes: 105 additions & 0 deletions cmake/configs/posix_bbblue_common.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# This file is shared between posix_bbblue_native.cmake
# and posix_bbblue_cross.cmake.


# This definition allows to differentiate if this just the usual POSIX build
# or if it is for the bbblue.
add_definitions(
-D__PX4_POSIX_BBBLUE
-D__PX4_POSIX
-D__DF_LINUX # For DriverFramework
-D__DF_BBBLUE # For DriverFramework
# -D__RC_V0_3 # option for Robotics Cape v0.3
# -DDEBUG_BUILD
)

#optional __DF_BBBLUE_USE_RC_BMP280_IMP
add_definitions(
-D__DF_BBBLUE_USE_RC_BMP280_IMP
)

#optional __PX4_BBBLUE_DEFAULT_MAVLINK_WIFI, default is "SoftAp"
#add_definitions(
# -D__PX4_BBBLUE_DEFAULT_MAVLINK_WIFI="wlan"
#)


set(config_module_list
#
# Board support modules
#
#drivers/barometer
drivers/batt_smbus
drivers/differential_pressure
drivers/distance_sensor
#drivers/telemetry
#drivers/boards

modules/sensors

platforms/posix/drivers/df_mpu9250_wrapper
platforms/posix/drivers/df_bmp280_wrapper

#
# System commands
#
systemcmds/param
systemcmds/led_control
systemcmds/mixer
systemcmds/ver
systemcmds/esc_calib
systemcmds/reboot
systemcmds/topic_listener
systemcmds/tune_control
systemcmds/perf

#
# Estimation modules
#
modules/attitude_estimator_q
modules/position_estimator_inav
modules/local_position_estimator
modules/landing_target_estimator
modules/ekf2

#
# Vehicle Control
#
modules/fw_att_control
modules/fw_pos_control_l1
modules/gnd_att_control
modules/gnd_pos_control
modules/mc_att_control
modules/mc_pos_control
modules/vtol_att_control

#
# Library modules
#
modules/sdlog2
modules/logger
modules/commander
modules/dataman
modules/land_detector
modules/navigator
modules/mavlink

#
# PX4 drivers
#
drivers/linux_sbus
drivers/gps
drivers/bbblue_adc
drivers/linux_gpio
drivers/linux_pwm_out
drivers/pwm_out_sim

)

#
# DriverFramework driver
#
set(config_df_driver_list
mpu9250
bmp280
)
3 changes: 3 additions & 0 deletions cmake/configs/posix_bbblue_cross.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
include(configs/posix_bbblue_common)

SET(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-linux-gnueabihf.cmake)
7 changes: 7 additions & 0 deletions cmake/configs/posix_bbblue_native.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
include(configs/posix_bbblue_common)

add_definitions(
-D __DF_BBBLUE
)

set(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cmake)
18 changes: 18 additions & 0 deletions platforms/posix/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,24 @@ if ("${BOARD}" STREQUAL "rpi")
USES_TERMINAL
)

elseif ("${BOARD}" STREQUAL "bbblue")
target_link_libraries(px4 PRIVATE robotics_cape)

add_custom_target(upload
COMMAND scp -r ${PX4_SOURCE_DIR}/posix-configs/bbblue/*.config debian@BBBluePX4:/home/debian/px4/posix-configs
COMMAND scp -r ${PX4_SOURCE_DIR}/ROMFS $<TARGET_FILE:px4> debian@BBBluePX4:/home/debian/px4
DEPENDS px4
COMMENT "uploading px4 and data files"
USES_TERMINAL
)

add_custom_target(upload_px4
COMMAND scp -r $<TARGET_FILE:px4> debian@BBBluePX4:/home/debian/px4
DEPENDS px4
COMMENT "uploading px4"
USES_TERMINAL
)

elseif ("${BOARD}" STREQUAL "bebop")

add_custom_target(upload
Expand Down
7 changes: 6 additions & 1 deletion platforms/posix/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,10 @@ int main(int argc, char **argv)
string data_path;
string node_name;

bool skippingOutputRedirect = false;

// parse arguments
while (index < argc) {
while (index < argc && !skippingOutputRedirect) {
//cout << "arg: " << index << " : " << argv[index] << endl;

if (argv[index][0] == '-') {
Expand Down Expand Up @@ -366,6 +368,9 @@ int main(int argc, char **argv)
cout << "node name: " << node_name << endl;
}

} else if (strchr(argv[index], '>')) {
skippingOutputRedirect = true;

} else {
//cout << "positional argument" << endl;

Expand Down
Loading