forked from Archive/PX4-Autopilot
boards/modalai: separate voxl2 builds into two board builds instead of single board build with different variants
* Made voxl2 apps processor and slpi dsp processor builds into separate board builds so that they can more easily be configured independently. * Removed board specific link library command from px4_config.cmake and moved it to a more generic board specific solution that can be used by any board that needs custom link libraries. * Removed redundant cmake command for Qurt * Removed unused definition from Qurt cmake file * Removed unnecessary QURT_LIB cmake function * Reorganized the voxl2 build structure to avoid 4 level board directories. * Reverted cmake files to remove 4 level board naming code * Updated documentation
This commit is contained in:
parent
22420a7bf1
commit
796fa8bd72
|
@ -1,6 +1,6 @@
|
|||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2022 ModalAI, Inc. All rights reserved.
|
||||
# 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
|
||||
|
@ -30,25 +30,8 @@
|
|||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# Overview:
|
||||
# Voxl2 PX4 is built in 2 parts, the part that runs on the
|
||||
# application (apps) processor, and the library that is loaded on the DSP.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include(px4_git)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH
|
||||
"${PX4_SOURCE_DIR}/platforms/posix/cmake"
|
||||
)
|
||||
|
||||
# set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
|
||||
|
||||
add_definitions(-DORB_COMMUNICATOR)
|
||||
|
||||
set(CONFIG_PARAM_SERVER "1")
|
||||
|
||||
add_definitions( -D__PX4_LINUX )
|
||||
|
||||
include(CMakeParseArguments)
|
||||
add_library(drivers_board
|
||||
board_config.h
|
||||
init.c
|
||||
)
|
|
@ -0,0 +1,51 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* @file board_config.h
|
||||
*
|
||||
* VOXL2 internal definitions
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define BOARD_HAS_NO_RESET
|
||||
#define BOARD_HAS_NO_BOOTLOADER
|
||||
#define ORB_COMMUNICATOR 1
|
||||
/*
|
||||
* I2C buses
|
||||
*/
|
||||
#define PX4_NUMBER_I2C_BUSES 3
|
||||
|
||||
#include <system_config.h>
|
||||
#include <px4_platform_common/board_common.h>
|
|
@ -0,0 +1,35 @@
|
|||
/****************************************************************************
|
||||
*
|
||||
* 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
|
|
@ -25,10 +25,10 @@ The full instructions are available here:
|
|||
- Clone the repo (Don't forget to update and initialize all submodules)
|
||||
- In the top level directory
|
||||
```
|
||||
px4$ boards/modalai/voxl2/run-docker.sh
|
||||
root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/clean.sh
|
||||
root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/build-posix.sh
|
||||
root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/build-qurt.sh
|
||||
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-apps.sh
|
||||
root@9373fa1401b8:/usr/local/workspace# boards/modalai/voxl2/scripts/build-slpi.sh
|
||||
root@9373fa1401b8:/usr/local/workspace# exit
|
||||
```
|
||||
|
||||
|
@ -37,7 +37,7 @@ root@9373fa1401b8:/usr/local/workspace# exit
|
|||
Once the DSP and Linux images have been built they can be installed on a VOXL 2
|
||||
board using ADB. There is a script to do this.
|
||||
```
|
||||
px4$ boards/modalai/voxl2/install-voxl.sh
|
||||
px4$ boards/modalai/voxl2/scripts/install-voxl.sh
|
||||
```
|
||||
|
||||
## Running PX4 on VOXL 2
|
||||
|
@ -66,10 +66,17 @@ INFO [px4] Startup script returned successfully
|
|||
pxh>
|
||||
```
|
||||
|
||||
## Notes
|
||||
|
||||
You cannot cleanly shutdown PX4 with the shutdown command on VOXL 2. You have
|
||||
to power cycle the board and restart everything.
|
||||
|
||||
## Tips
|
||||
|
||||
Start with a VOXL 2 that only has the system image installed, not the SDK
|
||||
|
||||
Run the command ```voxl-px4 -s``` on target to run the self-test
|
||||
|
||||
In order to see DSP specific debug messages the mini-dm tool in the Hexagon SDK
|
||||
can be used:
|
||||
```
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "*** Starting qurt build ***"
|
||||
|
||||
source /home/build-env.sh
|
||||
|
||||
make modalai_voxl2_qurt
|
||||
|
||||
cat build/modalai_voxl2_default/src/lib/version/build_git_version.h
|
||||
|
||||
echo "*** End of qurt build ***"
|
|
@ -0,0 +1,7 @@
|
|||
|
||||
# libfc_sensor.so is provided in the Docker build environment
|
||||
target_link_libraries(px4 PRIVATE
|
||||
/home/libfc_sensor.so
|
||||
px4_layer
|
||||
${module_libraries}
|
||||
)
|
|
@ -1,43 +0,0 @@
|
|||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2022 ModalAI, Inc. All rights reserved.
|
||||
#
|
||||
############################################################################
|
||||
#
|
||||
# This cmake config builds for QURT which is the operating system running on
|
||||
# the DSP side of VOXL 2
|
||||
#
|
||||
# Required environment variables:
|
||||
# HEXAGON_TOOLS_ROOT
|
||||
# HEXAGON_SDK_ROOT
|
||||
#
|
||||
############################################################################
|
||||
|
||||
if ("$ENV{HEXAGON_SDK_ROOT}" STREQUAL "")
|
||||
message(FATAL_ERROR "Enviroment variable HEXAGON_SDK_ROOT must be set")
|
||||
else()
|
||||
set(HEXAGON_SDK_ROOT $ENV{HEXAGON_SDK_ROOT})
|
||||
endif()
|
||||
|
||||
if ("$ENV{HEXAGON_TOOLS_ROOT}" STREQUAL "")
|
||||
message(FATAL_ERROR "Environment variable HEXAGON_TOOLS_ROOT must be set")
|
||||
else()
|
||||
set(HEXAGON_TOOLS_ROOT $ENV{HEXAGON_TOOLS_ROOT})
|
||||
endif()
|
||||
|
||||
include(px4_git)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH
|
||||
"${PX4_SOURCE_DIR}/platforms/qurt/cmake"
|
||||
)
|
||||
|
||||
include(Toolchain-qurt)
|
||||
include(qurt_reqs)
|
||||
|
||||
include_directories(${HEXAGON_SDK_INCLUDES})
|
||||
|
||||
add_definitions(-DORB_COMMUNICATOR)
|
||||
|
||||
set(CONFIG_PARAM_CLIENT "1")
|
||||
|
||||
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
|
|
@ -1,12 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "*** Starting posix build ***"
|
||||
echo "*** Starting apps processor build ***"
|
||||
|
||||
source /home/build-env.sh
|
||||
|
||||
make modalai_voxl2_default
|
||||
make modalai_voxl2
|
||||
|
||||
cat build/modalai_voxl2_default/src/lib/version/build_git_version.h
|
||||
|
||||
|
||||
echo "*** End of posix build ***"
|
||||
echo "*** End of apps processor build ***"
|
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "*** Starting qurt slpi build ***"
|
||||
|
||||
source /home/build-env.sh
|
||||
|
||||
make modalai_voxl2-slpi
|
||||
|
||||
cat build/modalai_voxl2-slpi_default/src/lib/version/build_git_version.h
|
||||
|
||||
echo "*** End of qurt slpi build ***"
|
|
@ -1,19 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Push qurt image to voxl2
|
||||
adb push build/modalai_voxl2_qurt/platforms/qurt/libpx4.so /usr/lib/rfsa/adsp
|
||||
# Push slpi image to voxl2
|
||||
adb push build/modalai_voxl2-slpi_default/platforms/qurt/libpx4.so /usr/lib/rfsa/adsp
|
||||
|
||||
# Push posix image to voxl2
|
||||
# Push apps processor image to voxl2
|
||||
adb push build/modalai_voxl2_default/bin/px4 /usr/bin
|
||||
|
||||
# Push scripts to voxl2
|
||||
adb push build/modalai_voxl2_default/bin/px4-alias.sh /usr/bin
|
||||
adb push boards/modalai/voxl2/voxl-px4 /usr/bin
|
||||
adb push boards/modalai/voxl2/target/voxl-px4 /usr/bin
|
||||
adb shell chmod a+x /usr/bin/px4-alias.sh
|
||||
adb shell chmod a+x /usr/bin/voxl-px4
|
||||
|
||||
# Push configuration file
|
||||
adb shell mkdir -p /etc/modalai
|
||||
adb push boards/modalai/voxl2/voxl-px4.config /etc/modalai
|
||||
adb push boards/modalai/voxl2/target/voxl-px4.config /etc/modalai
|
||||
|
||||
adb shell sync
|
|
@ -42,10 +42,9 @@
|
|||
#define BOARD_HAS_NO_RESET
|
||||
#define BOARD_HAS_NO_BOOTLOADER
|
||||
#define ORB_COMMUNICATOR 1
|
||||
/*
|
||||
* I2C buses
|
||||
*/
|
||||
#define PX4_NUMBER_I2C_BUSES 3
|
||||
|
||||
// Define this as empty since there are no I2C buses
|
||||
#define BOARD_I2C_BUS_CLOCK_INIT
|
||||
|
||||
#include <system_config.h>
|
||||
#include <px4_platform_common/board_common.h>
|
||||
|
|
|
@ -34,7 +34,7 @@ if(EXISTS ${BOARD_DEFCONFIG})
|
|||
# Depend on BOARD_DEFCONFIG so that we reconfigure on config change
|
||||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${BOARD_DEFCONFIG})
|
||||
|
||||
if(${LABEL} MATCHES "default" OR ${LABEL} MATCHES "qurt" OR ${LABEL} MATCHES "recovery" OR ${LABEL} MATCHES "bootloader" OR ${LABEL} MATCHES "canbootloader")
|
||||
if(${LABEL} MATCHES "default" OR ${LABEL} MATCHES "recovery" OR ${LABEL} MATCHES "bootloader" OR ${LABEL} MATCHES "canbootloader")
|
||||
# Generate boardconfig from saved defconfig
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E env ${COMMON_KCONFIG_ENV_SETTINGS}
|
||||
${DEFCONFIG_PATH} ${BOARD_DEFCONFIG}
|
||||
|
@ -228,10 +228,6 @@ if(EXISTS ${BOARD_DEFCONFIG})
|
|||
|
||||
# platform-specific include path
|
||||
include_directories(${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/src/px4/common/include)
|
||||
|
||||
if(PLATFORM STREQUAL "qurt")
|
||||
include(${PX4_SOURCE_DIR}/boards/modalai/voxl2/cmake/voxl2_qurt.cmake)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(ARCHITECTURE)
|
||||
|
|
|
@ -97,18 +97,14 @@ if(EXISTS "${PX4_BOARD_DIR}/cmake/upload.cmake")
|
|||
include(${PX4_BOARD_DIR}/cmake/upload.cmake)
|
||||
endif()
|
||||
|
||||
# board defined link libraries
|
||||
if(EXISTS "${PX4_BOARD_DIR}/cmake/link_libraries.cmake")
|
||||
include(${PX4_BOARD_DIR}/cmake/link_libraries.cmake)
|
||||
endif()
|
||||
|
||||
if("${PX4_BOARD}" MATCHES "beaglebone_blue")
|
||||
target_link_libraries(px4 PRIVATE robotics_cape)
|
||||
|
||||
elseif("${PX4_BOARD}" MATCHES "modalai_voxl2")
|
||||
# libfc_sensor.so is provided in the Docker build environment
|
||||
target_link_libraries(px4 PRIVATE
|
||||
/home/libfc_sensor.so
|
||||
px4_layer
|
||||
${module_libraries}
|
||||
)
|
||||
|
||||
elseif("${PX4_BOARD}" MATCHES "emlid_navio2")
|
||||
target_link_libraries(px4 PRIVATE atomic)
|
||||
|
||||
|
|
|
@ -33,11 +33,16 @@
|
|||
|
||||
get_property(module_libraries GLOBAL PROPERTY PX4_MODULE_LIBRARIES)
|
||||
|
||||
QURT_LIB(LIB_NAME px4
|
||||
SOURCES
|
||||
${PX4_SOURCE_DIR}/platforms/qurt/unresolved_symbols.c
|
||||
LINK_LIBS
|
||||
modules__muorb__slpi
|
||||
${module_libraries}
|
||||
px4_layer
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
add_library(px4 SHARED
|
||||
${PX4_SOURCE_DIR}/platforms/qurt/unresolved_symbols.c
|
||||
)
|
||||
|
||||
target_link_libraries(px4
|
||||
modules__muorb__slpi
|
||||
${module_libraries}
|
||||
px4_layer
|
||||
)
|
||||
|
|
|
@ -31,6 +31,29 @@
|
|||
#
|
||||
############################################################################
|
||||
|
||||
if ("$ENV{HEXAGON_SDK_ROOT}" STREQUAL "")
|
||||
message(FATAL_ERROR "Enviroment variable HEXAGON_SDK_ROOT must be set")
|
||||
else()
|
||||
set(HEXAGON_SDK_ROOT $ENV{HEXAGON_SDK_ROOT})
|
||||
endif()
|
||||
|
||||
if ("$ENV{HEXAGON_TOOLS_ROOT}" STREQUAL "")
|
||||
message(FATAL_ERROR "Environment variable HEXAGON_TOOLS_ROOT must be set")
|
||||
else()
|
||||
set(HEXAGON_TOOLS_ROOT $ENV{HEXAGON_TOOLS_ROOT})
|
||||
endif()
|
||||
|
||||
include(px4_git)
|
||||
|
||||
include(Toolchain-qurt)
|
||||
include(qurt_reqs)
|
||||
|
||||
include_directories(${HEXAGON_SDK_INCLUDES})
|
||||
|
||||
add_definitions(-DORB_COMMUNICATOR)
|
||||
|
||||
set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# Defined functions in this file
|
||||
|
|
|
@ -176,46 +176,3 @@ list2string(CMAKE_EXE_LINKER_FLAGS
|
|||
)
|
||||
|
||||
include (CMakeParseArguments)
|
||||
|
||||
# Process DSP files
|
||||
function (QURT_LIB)
|
||||
set(options)
|
||||
set(oneValueArgs LIB_NAME)
|
||||
set(multiValueArgs SOURCES LINK_LIBS INCS FLAGS)
|
||||
cmake_parse_arguments(QURT_LIB "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
|
||||
|
||||
include_directories(
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
)
|
||||
|
||||
if ("${QURT_LIB_SOURCES}" STREQUAL "")
|
||||
message(FATAL_ERROR "QURT_LIB called without SOURCES")
|
||||
else()
|
||||
# Build lib that is run on the DSP
|
||||
add_library(${QURT_LIB_LIB_NAME} SHARED
|
||||
${QURT_LIB_SOURCES}
|
||||
)
|
||||
|
||||
if (NOT "${QURT_LIB_FLAGS}" STREQUAL "")
|
||||
set_target_properties(${QURT_LIB_LIB_NAME} PROPERTIES COMPILE_FLAGS "${QURT_LIB_FLAGS}")
|
||||
endif()
|
||||
|
||||
if (NOT "${QURT_LIB_INCS}" STREQUAL "")
|
||||
target_include_directories(${QURT_LIB_LIB_NAME} PUBLIC ${QURT_LIB_INCS})
|
||||
endif()
|
||||
|
||||
target_link_libraries(${QURT_LIB_LIB_NAME}
|
||||
${QURT_LIB_LINK_LIBS}
|
||||
)
|
||||
endif()
|
||||
|
||||
set(DSPLIB_TARGET_PATH "/usr/lib/rfsa/adsp/")
|
||||
|
||||
# Add a rule to load the files onto the target that run in the DSP
|
||||
add_custom_target(lib${QURT_LIB_LIB_NAME}-load
|
||||
DEPENDS ${QURT_LIB_LIB_NAME}
|
||||
COMMAND adb wait-for-device
|
||||
COMMAND adb push lib${QURT_LIB_LIB_NAME}.so ${DSPLIB_TARGET_PATH}
|
||||
COMMAND echo "Pushed lib${QURT_LIB_LIB_NAME}.so and dependencies to ${DSPLIB_TARGET_PATH}"
|
||||
)
|
||||
endfunction()
|
||||
|
|
Loading…
Reference in New Issue