From 0cde8fda6f0c9cbf5229300608c03375b0842893 Mon Sep 17 00:00:00 2001 From: Ramon Roche Date: Thu, 12 Mar 2026 10:52:10 -0700 Subject: [PATCH] refactor(boards/modalai/voxl2): merge voxl2-slpi into voxl2 as board variant Consolidate the VOXL2 SLPI (DSP) board from a separate directory into the existing voxl2 board as a variant. Multi-processor SoCs like the QRB5165 should use one board directory with multiple .px4board files rather than separate directories per processor. Changes: - Add slpi.px4board (QURT/DSP) alongside default.px4board (POSIX/apps) - Merge board_config.h with __PX4_QURT / __PX4_POSIX preprocessor guards - Merge CMakeLists.txt with PX4_PLATFORM conditionals - Split bus definitions into platform-specific files (i2c/spi_posix/qurt) - Reorganize drivers into drivers/posix/ and drivers/qurt/ subdirectories - Guard cmake/init.cmake and cmake/link_libraries.cmake for posix-only - Update build and install scripts for new target names - Delete boards/modalai/voxl2-slpi/ entirely Build targets change: - modalai_voxl2-slpi_default -> modalai_voxl2_slpi - modalai_voxl2_default (unchanged) Signed-off-by: Ramon Roche --- boards/modalai/voxl2-slpi/src/CMakeLists.txt | 84 ----------------- boards/modalai/voxl2-slpi/src/board_config.h | 82 ----------------- boards/modalai/voxl2-slpi/src/init.c | 35 -------- boards/modalai/voxl2/README.md | 11 ++- boards/modalai/voxl2/cmake/init.cmake | 4 + .../modalai/voxl2/cmake/link_libraries.cmake | 3 + boards/modalai/voxl2/scripts/build-apps.sh | 4 +- boards/modalai/voxl2/scripts/build-slpi.sh | 2 +- .../voxl2/scripts/install-voxl-bins.sh | 2 +- boards/modalai/voxl2/scripts/install-voxl.sh | 2 +- .../default.px4board => voxl2/slpi.px4board} | 18 ++++ boards/modalai/voxl2/src/CMakeLists.txt | 89 +++++++++++++++---- boards/modalai/voxl2/src/board_config.h | 45 +++++++--- .../{ => posix}/apps_sbus/CMakeLists.txt | 0 .../{ => posix}/apps_sbus/apps_sbus.cpp | 0 .../src/drivers/posix/apps_sbus}/protocol.h | 0 .../src/drivers/qurt}/dsp_hitl/CMakeLists.txt | 0 .../src/drivers/qurt}/dsp_hitl/dsp_hitl.cpp | 0 .../src/drivers/qurt}/dsp_sbus/CMakeLists.txt | 0 .../src/drivers/qurt}/dsp_sbus/dsp_sbus.cpp | 0 .../{apps_sbus => qurt/dsp_sbus}/protocol.h | 0 .../src/drivers/qurt}/elrs_led/CMakeLists.txt | 0 .../src/drivers/qurt}/elrs_led/elrs_led.cpp | 0 .../src/drivers/qurt}/elrs_led/elrs_led.h | 0 .../src/drivers/qurt}/ghst_rc/CMakeLists.txt | 0 .../src/drivers/qurt}/ghst_rc/Kconfig | 0 .../src/drivers/qurt}/ghst_rc/ghst_rc.cpp | 0 .../src/drivers/qurt}/ghst_rc/ghst_rc.hpp | 0 .../src/drivers/qurt}/ghst_rc/module.yaml | 0 .../qurt}/mavlink_rc_in/CMakeLists.txt | 0 .../qurt}/mavlink_rc_in/mavlink_rc_in.cpp | 0 .../qurt}/rc_controller/CMakeLists.txt | 0 .../qurt}/rc_controller/rc_controller.cpp | 0 .../qurt}/rc_controller/rc_controller.hpp | 0 .../drivers/qurt}/spektrum_rc/CMakeLists.txt | 0 .../drivers/qurt}/spektrum_rc/drv_rc_input.h | 0 .../drivers/qurt}/spektrum_rc/spektrum_rc.cpp | 0 .../voxl2/src/{i2c.cpp => i2c_posix.cpp} | 0 .../src/i2c.cpp => voxl2/src/i2c_qurt.cpp} | 0 .../voxl2/src/{spi.cpp => spi_posix.cpp} | 0 .../src/spi.cpp => voxl2/src/spi_qurt.cpp} | 0 41 files changed, 146 insertions(+), 235 deletions(-) delete mode 100644 boards/modalai/voxl2-slpi/src/CMakeLists.txt delete mode 100644 boards/modalai/voxl2-slpi/src/board_config.h delete mode 100644 boards/modalai/voxl2-slpi/src/init.c rename boards/modalai/{voxl2-slpi/default.px4board => voxl2/slpi.px4board} (75%) rename boards/modalai/voxl2/src/drivers/{ => posix}/apps_sbus/CMakeLists.txt (100%) rename boards/modalai/voxl2/src/drivers/{ => posix}/apps_sbus/apps_sbus.cpp (100%) rename boards/modalai/{voxl2-slpi/src/drivers/dsp_sbus => voxl2/src/drivers/posix/apps_sbus}/protocol.h (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/dsp_hitl/CMakeLists.txt (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/dsp_hitl/dsp_hitl.cpp (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/dsp_sbus/CMakeLists.txt (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/dsp_sbus/dsp_sbus.cpp (100%) rename boards/modalai/voxl2/src/drivers/{apps_sbus => qurt/dsp_sbus}/protocol.h (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/elrs_led/CMakeLists.txt (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/elrs_led/elrs_led.cpp (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/elrs_led/elrs_led.h (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/ghst_rc/CMakeLists.txt (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/ghst_rc/Kconfig (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/ghst_rc/ghst_rc.cpp (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/ghst_rc/ghst_rc.hpp (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/ghst_rc/module.yaml (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/mavlink_rc_in/CMakeLists.txt (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/mavlink_rc_in/mavlink_rc_in.cpp (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/rc_controller/CMakeLists.txt (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/rc_controller/rc_controller.cpp (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/rc_controller/rc_controller.hpp (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/spektrum_rc/CMakeLists.txt (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/spektrum_rc/drv_rc_input.h (100%) rename boards/modalai/{voxl2-slpi/src/drivers => voxl2/src/drivers/qurt}/spektrum_rc/spektrum_rc.cpp (100%) rename boards/modalai/voxl2/src/{i2c.cpp => i2c_posix.cpp} (100%) rename boards/modalai/{voxl2-slpi/src/i2c.cpp => voxl2/src/i2c_qurt.cpp} (100%) rename boards/modalai/voxl2/src/{spi.cpp => spi_posix.cpp} (100%) rename boards/modalai/{voxl2-slpi/src/spi.cpp => voxl2/src/spi_qurt.cpp} (100%) diff --git a/boards/modalai/voxl2-slpi/src/CMakeLists.txt b/boards/modalai/voxl2-slpi/src/CMakeLists.txt deleted file mode 100644 index a337022241..0000000000 --- a/boards/modalai/voxl2-slpi/src/CMakeLists.txt +++ /dev/null @@ -1,84 +0,0 @@ -############################################################################ -# -# Copyright (c) 2022 ModalAI, Inc. 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. -# -############################################################################ - -# Need to make sure that the DSP processor on VOXL2 -# knows about all parameters since some modules need parameters -# from other modules that are not running on the DSP. -set(DISABLE_PARAMS_MODULE_SCOPING TRUE PARENT_SCOPE) - -add_library(drivers_board - board_config.h - i2c.cpp - init.c - spi.cpp - ) - -# Generate MAVLink common headers for SLPI drivers (dsp_hitl, mavlink_rc_in) -# Replicates the generation from src/modules/mavlink/CMakeLists.txt so the -# SLPI build is self-contained and does not depend on voxl2-default. -set(MAVLINK_GIT_DIR "${PX4_SOURCE_DIR}/src/modules/mavlink/mavlink") -set(MAVLINK_LIBRARY_DIR "${CMAKE_BINARY_DIR}/mavlink") - -px4_add_git_submodule(TARGET git_mavlink_v2 PATH "${MAVLINK_GIT_DIR}") - -add_custom_command( - OUTPUT ${MAVLINK_LIBRARY_DIR}/common/common.h - COMMAND ${PYTHON_EXECUTABLE} ${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py - --lang C --wire-protocol 2.0 - --output ${MAVLINK_LIBRARY_DIR} - ${MAVLINK_GIT_DIR}/message_definitions/v1.0/common.xml - > ${CMAKE_BINARY_DIR}/mavgen_common.log - DEPENDS - git_mavlink_v2 - ${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py - ${MAVLINK_GIT_DIR}/message_definitions/v1.0/common.xml - COMMENT "Generating MAVLink common headers for SLPI" -) -add_custom_target(mavlink_common_generate DEPENDS ${MAVLINK_LIBRARY_DIR}/common/common.h) - -add_library(mavlink_common_headers INTERFACE) -add_dependencies(mavlink_common_headers mavlink_common_generate) -target_compile_options(mavlink_common_headers INTERFACE -Wno-address-of-packed-member -Wno-cast-align) -target_include_directories(mavlink_common_headers INTERFACE - ${MAVLINK_LIBRARY_DIR} - ${MAVLINK_LIBRARY_DIR}/common -) - -# Add custom drivers for SLPI -add_subdirectory(${PX4_BOARD_DIR}/src/drivers/rc_controller) -add_subdirectory(${PX4_BOARD_DIR}/src/drivers/mavlink_rc_in) -add_subdirectory(${PX4_BOARD_DIR}/src/drivers/spektrum_rc) -add_subdirectory(${PX4_BOARD_DIR}/src/drivers/ghst_rc) -add_subdirectory(${PX4_BOARD_DIR}/src/drivers/dsp_hitl) -add_subdirectory(${PX4_BOARD_DIR}/src/drivers/dsp_sbus) -add_subdirectory(${PX4_BOARD_DIR}/src/drivers/elrs_led) diff --git a/boards/modalai/voxl2-slpi/src/board_config.h b/boards/modalai/voxl2-slpi/src/board_config.h deleted file mode 100644 index ef7fb37428..0000000000 --- a/boards/modalai/voxl2-slpi/src/board_config.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2022-2026 ModalAI, Inc. 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. - * - ****************************************************************************/ - -/** - * @file board_config.h - * - * VOXL2 internal definitions - */ - -#pragma once - -#define CONFIG_BOARDCTL_RESET -#define BOARD_HAS_NO_BOOTLOADER -/* - * I2C buses - */ -#define CONFIG_I2C 1 -#define PX4_NUMBER_I2C_BUSES 4 - -/* - * SPI buses - */ -#define CONFIG_SPI 1 -#define BOARD_SPI_BUS_MAX_BUS_ITEMS 1 - -/* - * Include these last to make use of the definitions above - */ -#include -#include - -/* - * Default port for the ESC - */ -#define VOXL_ESC_DEFAULT_PORT "2" - -/* - * Default port for the GHST RC - */ -#define GHST_RC_DEFAULT_PORT "7" - -/* - * Default port for M0065 -*/ -#define VOXL2_IO_DEFAULT_PORT "2" - - -/* - * M0065 PWM - */ -#define DIRECT_PWM_OUTPUT_CHANNELS 4 -#define MAX_IO_TIMERS 3 diff --git a/boards/modalai/voxl2-slpi/src/init.c b/boards/modalai/voxl2-slpi/src/init.c deleted file mode 100644 index f9a71ffaa2..0000000000 --- a/boards/modalai/voxl2-slpi/src/init.c +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************** - * - * Copyright (C) 2022 ModalAI, Inc. 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 "board_config.h" - -// Place holder for VOXL2-specific early startup code diff --git a/boards/modalai/voxl2/README.md b/boards/modalai/voxl2/README.md index ac6bd1f5f1..876ea37a75 100644 --- a/boards/modalai/voxl2/README.md +++ b/boards/modalai/voxl2/README.md @@ -13,6 +13,10 @@ critical applications such as Mavlink, and logging are running on the ARM CPU cluster (aka apps proc). The DSP and ARM CPU cluster communicate via a Qualcomm proprietary shared memory interface. +Both processors are built from this single board directory: +- `default.px4board` - POSIX apps processor (ARM64) +- `slpi.px4board` - QURT DSP (Hexagon) + ## Build environment In order to build for this platform both the Qualcomm Hexagon (DSP) toolchain and the Linaro ARM64 toolchain need to be installed. The (nearly) complete setup including the ARM64 toolchain is provided in the base Docker image provided by ModalAI, but since ModalAI is not allowed to redistribute the Qualcomm Hexagon DSP SDK this must be added by the end user. @@ -22,6 +26,10 @@ The full instructions are available here: ## Build overview +A single `make modalai_voxl2` command builds both the DSP and apps processor +firmware. The Makefile chains the SLPI build as a prerequisite of the default +(apps) build. + - Clone the repo (Don't forget to update and initialize all submodules) - In the top level directory ``` @@ -29,10 +37,11 @@ px4$ boards/modalai/voxl2/scripts/run-docker.sh root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/scripts/clean.sh root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/scripts/build-deps.sh root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/scripts/build-apps.sh -root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/scripts/build-slpi.sh root@9373fa1401b8:/usr/local/workspace# exit ``` +For DSP-only rebuilds: `make modalai_voxl2_slpi` + ## Install and run on VOXL 2 Once the DSP and Linux images have been built they can be installed on a VOXL 2 diff --git a/boards/modalai/voxl2/cmake/init.cmake b/boards/modalai/voxl2/cmake/init.cmake index 4a60cb5d91..4d2f3ff474 100644 --- a/boards/modalai/voxl2/cmake/init.cmake +++ b/boards/modalai/voxl2/cmake/init.cmake @@ -31,6 +31,10 @@ # ############################################################################ +if(NOT "${PX4_PLATFORM}" STREQUAL "posix") + return() +endif() + # Initialize libfc-sensor-api submodule (fetches from GitLab if not present) execute_process( COMMAND Tools/check_submodules.sh boards/modalai/voxl2/libfc-sensor-api diff --git a/boards/modalai/voxl2/cmake/link_libraries.cmake b/boards/modalai/voxl2/cmake/link_libraries.cmake index e0b09beb70..17ccce2aa6 100644 --- a/boards/modalai/voxl2/cmake/link_libraries.cmake +++ b/boards/modalai/voxl2/cmake/link_libraries.cmake @@ -1,3 +1,6 @@ +if(NOT "${PX4_PLATFORM}" STREQUAL "posix") + return() +endif() # Link against the public stub version of the proprietary fc sensor library target_link_libraries(px4 PRIVATE diff --git a/boards/modalai/voxl2/scripts/build-apps.sh b/boards/modalai/voxl2/scripts/build-apps.sh index 28b6a8d99b..a3570748c2 100755 --- a/boards/modalai/voxl2/scripts/build-apps.sh +++ b/boards/modalai/voxl2/scripts/build-apps.sh @@ -1,6 +1,6 @@ #!/bin/bash -echo "*** Starting apps processor build ***" +echo "*** Starting unified VOXL2 build (apps + SLPI) ***" source /home/build-env.sh @@ -8,4 +8,4 @@ make modalai_voxl2 cat build/modalai_voxl2_default/src/lib/version/build_git_version.h -echo "*** End of apps processor build ***" +echo "*** End of unified VOXL2 build ***" diff --git a/boards/modalai/voxl2/scripts/build-slpi.sh b/boards/modalai/voxl2/scripts/build-slpi.sh index cbe9ef6ba9..fa639191be 100755 --- a/boards/modalai/voxl2/scripts/build-slpi.sh +++ b/boards/modalai/voxl2/scripts/build-slpi.sh @@ -4,6 +4,6 @@ echo "*** Starting qurt slpi build ***" source /home/build-env.sh -make modalai_voxl2-slpi +make modalai_voxl2_slpi echo "*** End of qurt slpi build ***" diff --git a/boards/modalai/voxl2/scripts/install-voxl-bins.sh b/boards/modalai/voxl2/scripts/install-voxl-bins.sh index d58627bcf4..417cf59cf5 100755 --- a/boards/modalai/voxl2/scripts/install-voxl-bins.sh +++ b/boards/modalai/voxl2/scripts/install-voxl-bins.sh @@ -1,7 +1,7 @@ #!/bin/bash # Push slpi image to voxl2 -adb push build/modalai_voxl2-slpi_default/platforms/qurt/libpx4.so /usr/lib/rfsa/adsp +adb push build/modalai_voxl2_slpi/platforms/qurt/libpx4.so /usr/lib/rfsa/adsp # Push apps processor image to voxl2 adb push build/modalai_voxl2_default/bin/px4 /usr/bin diff --git a/boards/modalai/voxl2/scripts/install-voxl.sh b/boards/modalai/voxl2/scripts/install-voxl.sh index e4ae8675eb..86c5890c7c 100755 --- a/boards/modalai/voxl2/scripts/install-voxl.sh +++ b/boards/modalai/voxl2/scripts/install-voxl.sh @@ -1,7 +1,7 @@ #!/bin/bash # Push slpi image to voxl2 -adb push build/modalai_voxl2-slpi_default/platforms/qurt/libpx4.so /usr/lib/rfsa/adsp +adb push build/modalai_voxl2_slpi/platforms/qurt/libpx4.so /usr/lib/rfsa/adsp # Push apps processor image to voxl2 adb push build/modalai_voxl2_default/bin/px4 /usr/bin diff --git a/boards/modalai/voxl2-slpi/default.px4board b/boards/modalai/voxl2/slpi.px4board similarity index 75% rename from boards/modalai/voxl2-slpi/default.px4board rename to boards/modalai/voxl2/slpi.px4board index 6afa6f0370..234fc1bfa4 100644 --- a/boards/modalai/voxl2-slpi/default.px4board +++ b/boards/modalai/voxl2/slpi.px4board @@ -1,5 +1,23 @@ CONFIG_PLATFORM_QURT=y CONFIG_BOARD_TOOLCHAIN="qurt" +# Disable modules from default.px4board that are apps-only +CONFIG_BOARD_LINUX_TARGET=n +CONFIG_DRIVERS_OSD_MSP_OSD=n +CONFIG_DRIVERS_QSHELL_POSIX=n +CONFIG_DRIVERS_RC_INPUT=n +CONFIG_MODULES_DATAMAN=n +CONFIG_MODULES_LOGGER=n +CONFIG_MODULES_MAVLINK=n +CONFIG_MODULES_MUORB_APPS=n +CONFIG_MODULES_NAVIGATOR=n +CONFIG_MODULES_UXRCE_DDS_CLIENT=n +CONFIG_SYSTEMCMDS_ACTUATOR_TEST=n +CONFIG_SYSTEMCMDS_BSONDUMP=n +CONFIG_SYSTEMCMDS_PERF=n +CONFIG_SYSTEMCMDS_TOPIC_LISTENER=n +CONFIG_SYSTEMCMDS_VER=n +CONFIG_SYSTEMCMDS_REBOOT=n +CONFIG_PARAM_PRIMARY=n CONFIG_DRIVERS_ACTUATORS_VOXL_ESC=y CONFIG_DRIVERS_BAROMETER_INVENSENSE_ICP101XX=y CONFIG_DRIVERS_BAROMETER_MS5611=y diff --git a/boards/modalai/voxl2/src/CMakeLists.txt b/boards/modalai/voxl2/src/CMakeLists.txt index 77e7a451ad..95f9296dd2 100644 --- a/boards/modalai/voxl2/src/CMakeLists.txt +++ b/boards/modalai/voxl2/src/CMakeLists.txt @@ -31,28 +31,81 @@ # ############################################################################ -# Need to make sure that the Linux processor on VOXL2 -# knows about all parameters since it is acting as the -# parameter server for other processors that may define -# parameters that it doesn't normally know about. +# Both processors need to know about all parameters since modules are +# split across processors and may reference parameters from the other side. set(DISABLE_PARAMS_MODULE_SCOPING TRUE PARENT_SCOPE) -add_library(drivers_board +set(SRCS board_config.h - i2c.cpp init.c - boardctl.c - spi.cpp - ) +) -# Add custom drivers -add_subdirectory(${PX4_BOARD_DIR}/src/drivers/apps_sbus) +if("${PX4_PLATFORM}" STREQUAL "qurt") + list(APPEND SRCS + i2c_qurt.cpp + spi_qurt.cpp + ) +elseif("${PX4_PLATFORM}" STREQUAL "posix") + list(APPEND SRCS + boardctl.c + i2c_posix.cpp + spi_posix.cpp + ) +endif() -# Add custom libraries -add_subdirectory(${PX4_BOARD_DIR}/src/lib/mpa) +add_library(drivers_board ${SRCS}) -# Add custom modules -add_subdirectory(${PX4_BOARD_DIR}/src/modules/voxl_save_cal_params) -add_subdirectory(${PX4_BOARD_DIR}/src/modules/vehicle_air_data_bridge) -add_subdirectory(${PX4_BOARD_DIR}/src/modules/sensor_baro_bridge) -add_subdirectory(${PX4_BOARD_DIR}/src/modules/vehicle_local_position_bridge) +if("${PX4_PLATFORM}" STREQUAL "qurt") + # Generate MAVLink common headers for SLPI drivers (dsp_hitl, mavlink_rc_in) + # Replicates the generation from src/modules/mavlink/CMakeLists.txt so the + # SLPI build is self-contained and does not depend on voxl2-default. + set(MAVLINK_GIT_DIR "${PX4_SOURCE_DIR}/src/modules/mavlink/mavlink") + set(MAVLINK_LIBRARY_DIR "${CMAKE_BINARY_DIR}/mavlink") + + px4_add_git_submodule(TARGET git_mavlink_v2_slpi PATH "${MAVLINK_GIT_DIR}") + + add_custom_command( + OUTPUT ${MAVLINK_LIBRARY_DIR}/common/common.h + COMMAND ${PYTHON_EXECUTABLE} ${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py + --lang C --wire-protocol 2.0 + --output ${MAVLINK_LIBRARY_DIR} + ${MAVLINK_GIT_DIR}/message_definitions/v1.0/common.xml + > ${CMAKE_BINARY_DIR}/mavgen_common.log + DEPENDS + git_mavlink_v2_slpi + ${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py + ${MAVLINK_GIT_DIR}/message_definitions/v1.0/common.xml + COMMENT "Generating MAVLink common headers for SLPI" + ) + add_custom_target(mavlink_common_generate DEPENDS ${MAVLINK_LIBRARY_DIR}/common/common.h) + + add_library(mavlink_common_headers INTERFACE) + add_dependencies(mavlink_common_headers mavlink_common_generate) + target_compile_options(mavlink_common_headers INTERFACE -Wno-address-of-packed-member -Wno-cast-align) + target_include_directories(mavlink_common_headers INTERFACE + ${MAVLINK_LIBRARY_DIR} + ${MAVLINK_LIBRARY_DIR}/common + ) + + # Add custom drivers for SLPI + add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/rc_controller rc_controller) + add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/mavlink_rc_in mavlink_rc_in) + add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/spektrum_rc spektrum_rc) + add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/ghst_rc ghst_rc) + add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/dsp_hitl dsp_hitl) + add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/dsp_sbus dsp_sbus) + add_subdirectory(${PX4_BOARD_DIR}/src/drivers/qurt/elrs_led elrs_led) + +elseif("${PX4_PLATFORM}" STREQUAL "posix") + # Add custom drivers + add_subdirectory(${PX4_BOARD_DIR}/src/drivers/posix/apps_sbus apps_sbus) + + # Add custom libraries + add_subdirectory(${PX4_BOARD_DIR}/src/lib/mpa mpa) + + # Add custom modules + add_subdirectory(${PX4_BOARD_DIR}/src/modules/voxl_save_cal_params voxl_save_cal_params) + add_subdirectory(${PX4_BOARD_DIR}/src/modules/vehicle_air_data_bridge vehicle_air_data_bridge) + add_subdirectory(${PX4_BOARD_DIR}/src/modules/sensor_baro_bridge sensor_baro_bridge) + add_subdirectory(${PX4_BOARD_DIR}/src/modules/vehicle_local_position_bridge vehicle_local_position_bridge) +endif() diff --git a/boards/modalai/voxl2/src/board_config.h b/boards/modalai/voxl2/src/board_config.h index fa2fee21b4..4761b73b4a 100644 --- a/boards/modalai/voxl2/src/board_config.h +++ b/boards/modalai/voxl2/src/board_config.h @@ -42,21 +42,44 @@ #define CONFIG_BOARDCTL_RESET #define BOARD_HAS_NO_BOOTLOADER -// Define this as empty since i2c clock init isn't required -#define BOARD_I2C_BUS_CLOCK_INIT - /* - * I2C buses - */ -#define CONFIG_I2C 1 -#define PX4_NUMBER_I2C_BUSES 1 - -/* - * SPI buses + * SPI buses (shared) */ #define CONFIG_SPI 1 #define BOARD_SPI_BUS_MAX_BUS_ITEMS 1 +#ifdef __PX4_QURT +/* + * QURT (DSP) specific defines + */ + +#define CONFIG_I2C 1 +#define PX4_NUMBER_I2C_BUSES 4 + +#include +#include + +#define VOXL_ESC_DEFAULT_PORT "2" +#define GHST_RC_DEFAULT_PORT "7" +#define VOXL2_IO_DEFAULT_PORT "2" + +/* M0065 PWM */ +#define DIRECT_PWM_OUTPUT_CHANNELS 4 +#define MAX_IO_TIMERS 3 + +#endif /* __PX4_QURT */ + +#if defined(__PX4_POSIX) && !defined(__PX4_QURT) +/* + * POSIX (apps processor) specific defines + */ + +/* I2C clock init not required on Linux */ +#define BOARD_I2C_BUS_CLOCK_INIT + +#define CONFIG_I2C 1 +#define PX4_NUMBER_I2C_BUSES 1 + #include #include @@ -65,3 +88,5 @@ #define VOXL_ESC_DEFAULT_PORT "2" #define VOXL2_IO_DEFAULT_PORT "2" + +#endif /* __PX4_POSIX && !__PX4_QURT */ diff --git a/boards/modalai/voxl2/src/drivers/apps_sbus/CMakeLists.txt b/boards/modalai/voxl2/src/drivers/posix/apps_sbus/CMakeLists.txt similarity index 100% rename from boards/modalai/voxl2/src/drivers/apps_sbus/CMakeLists.txt rename to boards/modalai/voxl2/src/drivers/posix/apps_sbus/CMakeLists.txt diff --git a/boards/modalai/voxl2/src/drivers/apps_sbus/apps_sbus.cpp b/boards/modalai/voxl2/src/drivers/posix/apps_sbus/apps_sbus.cpp similarity index 100% rename from boards/modalai/voxl2/src/drivers/apps_sbus/apps_sbus.cpp rename to boards/modalai/voxl2/src/drivers/posix/apps_sbus/apps_sbus.cpp diff --git a/boards/modalai/voxl2-slpi/src/drivers/dsp_sbus/protocol.h b/boards/modalai/voxl2/src/drivers/posix/apps_sbus/protocol.h similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/dsp_sbus/protocol.h rename to boards/modalai/voxl2/src/drivers/posix/apps_sbus/protocol.h diff --git a/boards/modalai/voxl2-slpi/src/drivers/dsp_hitl/CMakeLists.txt b/boards/modalai/voxl2/src/drivers/qurt/dsp_hitl/CMakeLists.txt similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/dsp_hitl/CMakeLists.txt rename to boards/modalai/voxl2/src/drivers/qurt/dsp_hitl/CMakeLists.txt diff --git a/boards/modalai/voxl2-slpi/src/drivers/dsp_hitl/dsp_hitl.cpp b/boards/modalai/voxl2/src/drivers/qurt/dsp_hitl/dsp_hitl.cpp similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/dsp_hitl/dsp_hitl.cpp rename to boards/modalai/voxl2/src/drivers/qurt/dsp_hitl/dsp_hitl.cpp diff --git a/boards/modalai/voxl2-slpi/src/drivers/dsp_sbus/CMakeLists.txt b/boards/modalai/voxl2/src/drivers/qurt/dsp_sbus/CMakeLists.txt similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/dsp_sbus/CMakeLists.txt rename to boards/modalai/voxl2/src/drivers/qurt/dsp_sbus/CMakeLists.txt diff --git a/boards/modalai/voxl2-slpi/src/drivers/dsp_sbus/dsp_sbus.cpp b/boards/modalai/voxl2/src/drivers/qurt/dsp_sbus/dsp_sbus.cpp similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/dsp_sbus/dsp_sbus.cpp rename to boards/modalai/voxl2/src/drivers/qurt/dsp_sbus/dsp_sbus.cpp diff --git a/boards/modalai/voxl2/src/drivers/apps_sbus/protocol.h b/boards/modalai/voxl2/src/drivers/qurt/dsp_sbus/protocol.h similarity index 100% rename from boards/modalai/voxl2/src/drivers/apps_sbus/protocol.h rename to boards/modalai/voxl2/src/drivers/qurt/dsp_sbus/protocol.h diff --git a/boards/modalai/voxl2-slpi/src/drivers/elrs_led/CMakeLists.txt b/boards/modalai/voxl2/src/drivers/qurt/elrs_led/CMakeLists.txt similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/elrs_led/CMakeLists.txt rename to boards/modalai/voxl2/src/drivers/qurt/elrs_led/CMakeLists.txt diff --git a/boards/modalai/voxl2-slpi/src/drivers/elrs_led/elrs_led.cpp b/boards/modalai/voxl2/src/drivers/qurt/elrs_led/elrs_led.cpp similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/elrs_led/elrs_led.cpp rename to boards/modalai/voxl2/src/drivers/qurt/elrs_led/elrs_led.cpp diff --git a/boards/modalai/voxl2-slpi/src/drivers/elrs_led/elrs_led.h b/boards/modalai/voxl2/src/drivers/qurt/elrs_led/elrs_led.h similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/elrs_led/elrs_led.h rename to boards/modalai/voxl2/src/drivers/qurt/elrs_led/elrs_led.h diff --git a/boards/modalai/voxl2-slpi/src/drivers/ghst_rc/CMakeLists.txt b/boards/modalai/voxl2/src/drivers/qurt/ghst_rc/CMakeLists.txt similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/ghst_rc/CMakeLists.txt rename to boards/modalai/voxl2/src/drivers/qurt/ghst_rc/CMakeLists.txt diff --git a/boards/modalai/voxl2-slpi/src/drivers/ghst_rc/Kconfig b/boards/modalai/voxl2/src/drivers/qurt/ghst_rc/Kconfig similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/ghst_rc/Kconfig rename to boards/modalai/voxl2/src/drivers/qurt/ghst_rc/Kconfig diff --git a/boards/modalai/voxl2-slpi/src/drivers/ghst_rc/ghst_rc.cpp b/boards/modalai/voxl2/src/drivers/qurt/ghst_rc/ghst_rc.cpp similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/ghst_rc/ghst_rc.cpp rename to boards/modalai/voxl2/src/drivers/qurt/ghst_rc/ghst_rc.cpp diff --git a/boards/modalai/voxl2-slpi/src/drivers/ghst_rc/ghst_rc.hpp b/boards/modalai/voxl2/src/drivers/qurt/ghst_rc/ghst_rc.hpp similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/ghst_rc/ghst_rc.hpp rename to boards/modalai/voxl2/src/drivers/qurt/ghst_rc/ghst_rc.hpp diff --git a/boards/modalai/voxl2-slpi/src/drivers/ghst_rc/module.yaml b/boards/modalai/voxl2/src/drivers/qurt/ghst_rc/module.yaml similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/ghst_rc/module.yaml rename to boards/modalai/voxl2/src/drivers/qurt/ghst_rc/module.yaml diff --git a/boards/modalai/voxl2-slpi/src/drivers/mavlink_rc_in/CMakeLists.txt b/boards/modalai/voxl2/src/drivers/qurt/mavlink_rc_in/CMakeLists.txt similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/mavlink_rc_in/CMakeLists.txt rename to boards/modalai/voxl2/src/drivers/qurt/mavlink_rc_in/CMakeLists.txt diff --git a/boards/modalai/voxl2-slpi/src/drivers/mavlink_rc_in/mavlink_rc_in.cpp b/boards/modalai/voxl2/src/drivers/qurt/mavlink_rc_in/mavlink_rc_in.cpp similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/mavlink_rc_in/mavlink_rc_in.cpp rename to boards/modalai/voxl2/src/drivers/qurt/mavlink_rc_in/mavlink_rc_in.cpp diff --git a/boards/modalai/voxl2-slpi/src/drivers/rc_controller/CMakeLists.txt b/boards/modalai/voxl2/src/drivers/qurt/rc_controller/CMakeLists.txt similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/rc_controller/CMakeLists.txt rename to boards/modalai/voxl2/src/drivers/qurt/rc_controller/CMakeLists.txt diff --git a/boards/modalai/voxl2-slpi/src/drivers/rc_controller/rc_controller.cpp b/boards/modalai/voxl2/src/drivers/qurt/rc_controller/rc_controller.cpp similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/rc_controller/rc_controller.cpp rename to boards/modalai/voxl2/src/drivers/qurt/rc_controller/rc_controller.cpp diff --git a/boards/modalai/voxl2-slpi/src/drivers/rc_controller/rc_controller.hpp b/boards/modalai/voxl2/src/drivers/qurt/rc_controller/rc_controller.hpp similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/rc_controller/rc_controller.hpp rename to boards/modalai/voxl2/src/drivers/qurt/rc_controller/rc_controller.hpp diff --git a/boards/modalai/voxl2-slpi/src/drivers/spektrum_rc/CMakeLists.txt b/boards/modalai/voxl2/src/drivers/qurt/spektrum_rc/CMakeLists.txt similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/spektrum_rc/CMakeLists.txt rename to boards/modalai/voxl2/src/drivers/qurt/spektrum_rc/CMakeLists.txt diff --git a/boards/modalai/voxl2-slpi/src/drivers/spektrum_rc/drv_rc_input.h b/boards/modalai/voxl2/src/drivers/qurt/spektrum_rc/drv_rc_input.h similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/spektrum_rc/drv_rc_input.h rename to boards/modalai/voxl2/src/drivers/qurt/spektrum_rc/drv_rc_input.h diff --git a/boards/modalai/voxl2-slpi/src/drivers/spektrum_rc/spektrum_rc.cpp b/boards/modalai/voxl2/src/drivers/qurt/spektrum_rc/spektrum_rc.cpp similarity index 100% rename from boards/modalai/voxl2-slpi/src/drivers/spektrum_rc/spektrum_rc.cpp rename to boards/modalai/voxl2/src/drivers/qurt/spektrum_rc/spektrum_rc.cpp diff --git a/boards/modalai/voxl2/src/i2c.cpp b/boards/modalai/voxl2/src/i2c_posix.cpp similarity index 100% rename from boards/modalai/voxl2/src/i2c.cpp rename to boards/modalai/voxl2/src/i2c_posix.cpp diff --git a/boards/modalai/voxl2-slpi/src/i2c.cpp b/boards/modalai/voxl2/src/i2c_qurt.cpp similarity index 100% rename from boards/modalai/voxl2-slpi/src/i2c.cpp rename to boards/modalai/voxl2/src/i2c_qurt.cpp diff --git a/boards/modalai/voxl2/src/spi.cpp b/boards/modalai/voxl2/src/spi_posix.cpp similarity index 100% rename from boards/modalai/voxl2/src/spi.cpp rename to boards/modalai/voxl2/src/spi_posix.cpp diff --git a/boards/modalai/voxl2-slpi/src/spi.cpp b/boards/modalai/voxl2/src/spi_qurt.cpp similarity index 100% rename from boards/modalai/voxl2-slpi/src/spi.cpp rename to boards/modalai/voxl2/src/spi_qurt.cpp