mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 22:58:10 +08:00
cmake: add support for Aerotenna OcPoC-Zynq hardware
This commit is contained in:
committed by
Lorenz Meier
parent
70ccfe80a7
commit
c5ac73e87e
@@ -0,0 +1,114 @@
|
||||
#set toolchain
|
||||
set(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/toolchains/Toolchain-arm-xilinx-linux-gnueabi.cmake)
|
||||
|
||||
set(CMAKE_PROGRAM_PATH
|
||||
"${OCPOC_TOOLCHAIN_DIR}"
|
||||
${CMAKE_PROGRAM_PATH}
|
||||
)
|
||||
|
||||
include(posix/px4_impl_posix)
|
||||
|
||||
add_definitions(
|
||||
-D__PX4_POSIX_OCPOC
|
||||
-D__DF_LINUX # For DriverFramework
|
||||
-D__DF_OCPOC # For DriverFramework
|
||||
-D__PX4_POSIX
|
||||
)
|
||||
|
||||
set(config_module_list
|
||||
#
|
||||
# Board support modules
|
||||
#
|
||||
drivers/device
|
||||
modules/sensors
|
||||
platforms/posix/drivers/df_mpu9250_wrapper
|
||||
platforms/posix/drivers/df_ms5611_wrapper
|
||||
platforms/posix/drivers/df_hmc5883_wrapper
|
||||
|
||||
#
|
||||
# System commands
|
||||
#
|
||||
systemcmds/param
|
||||
systemcmds/mixer
|
||||
systemcmds/ver
|
||||
systemcmds/esc_calib
|
||||
systemcmds/reboot
|
||||
systemcmds/topic_listener
|
||||
systemcmds/perf
|
||||
|
||||
#
|
||||
# Estimation modules
|
||||
#
|
||||
modules/attitude_estimator_q
|
||||
modules/position_estimator_inav
|
||||
modules/local_position_estimator
|
||||
modules/ekf2
|
||||
|
||||
#
|
||||
# Vehicle Control
|
||||
#
|
||||
modules/mc_att_control
|
||||
modules/mc_pos_control
|
||||
|
||||
#
|
||||
# Library modules
|
||||
#
|
||||
modules/sdlog2
|
||||
modules/logger
|
||||
modules/commander
|
||||
modules/param
|
||||
modules/systemlib
|
||||
modules/systemlib/mixer
|
||||
modules/uORB
|
||||
modules/dataman
|
||||
modules/land_detector
|
||||
modules/navigator
|
||||
modules/mavlink
|
||||
|
||||
#
|
||||
# PX4 drivers
|
||||
#
|
||||
drivers/gps
|
||||
drivers/ocpoc_adc
|
||||
drivers/ocpoc_sbus_rc_in
|
||||
drivers/ocpoc_mmap_pwm_out
|
||||
drivers/rgbled
|
||||
|
||||
#
|
||||
# Libraries
|
||||
#
|
||||
lib/controllib
|
||||
lib/mathlib
|
||||
lib/mathlib/math/filter
|
||||
lib/geo
|
||||
lib/ecl
|
||||
lib/geo_lookup
|
||||
lib/launchdetection
|
||||
lib/external_lgpl
|
||||
lib/conversion
|
||||
lib/terrain_estimation
|
||||
lib/runway_takeoff
|
||||
lib/tailsitter_recovery
|
||||
lib/version
|
||||
lib/DriverFramework/framework
|
||||
lib/rc
|
||||
lib/led
|
||||
|
||||
#
|
||||
# POSIX
|
||||
#
|
||||
platforms/common
|
||||
platforms/posix/px4_layer
|
||||
platforms/posix/work_queue
|
||||
|
||||
examples/px4_simple_app
|
||||
)
|
||||
|
||||
#
|
||||
# DriverFramework driver
|
||||
#
|
||||
set(config_df_driver_list
|
||||
mpu9250
|
||||
ms5611
|
||||
hmc5883
|
||||
)
|
||||
@@ -0,0 +1,92 @@
|
||||
# defines:
|
||||
#
|
||||
# NM
|
||||
# OBJCOPY
|
||||
# LD
|
||||
# CXX_COMPILER
|
||||
# C_COMPILER
|
||||
# CMAKE_SYSTEM_NAME
|
||||
# CMAKE_SYSTEM_VERSION
|
||||
# LINKER_FLAGS
|
||||
# CMAKE_EXE_LINKER_FLAGS
|
||||
# CMAKE_FIND_ROOT_PATH
|
||||
# CMAKE_FIND_ROOT_PATH_MODE_PROGRAM
|
||||
# CMAKE_FIND_ROOT_PATH_MODE_LIBRARY
|
||||
# CMAKE_FIND_ROOT_PATH_MODE_INCLUDE
|
||||
|
||||
include(CMakeForceCompiler)
|
||||
|
||||
if ("$ENV{OCPOC_TOOLCHAIN_DIR}" STREQUAL "")
|
||||
message(FATAL_ERROR "OCPOC_TOOLCHAIN_DIR not set")
|
||||
else()
|
||||
set(OCPOC_TOOLCHAIN_DIR $ENV{OCPOC_TOOLCHAIN_DIR})
|
||||
endif()
|
||||
|
||||
# this one is important
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
|
||||
#this one not so much
|
||||
set(CMAKE_SYSTEM_VERSION 1)
|
||||
|
||||
# specify the cross compiler
|
||||
find_program(C_COMPILER arm-xilinx-linux-gnueabi-gcc
|
||||
PATHS ${OCPOC_TOOLCHAIN_DIR}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(NOT C_COMPILER)
|
||||
message(FATAL_ERROR "could not find arm-xilinx-linux-gnueabi-gcc compiler")
|
||||
endif()
|
||||
cmake_force_c_compiler(${C_COMPILER} GNU)
|
||||
|
||||
find_program(CXX_COMPILER arm-xilinx-linux-gnueabi-g++
|
||||
PATHS ${OCPOC_TOOLCHAIN_DIR}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(NOT CXX_COMPILER)
|
||||
message(FATAL_ERROR "could not find arm-xilinx-linux-gnueabi-g++ compiler")
|
||||
endif()
|
||||
cmake_force_cxx_compiler(${CXX_COMPILER} GNU)
|
||||
|
||||
# compiler tools
|
||||
foreach(tool objcopy nm ld)
|
||||
string(TOUPPER ${tool} TOOL)
|
||||
find_program(${TOOL} arm-xilinx-linux-gnueabi-${tool}
|
||||
PATHS ${OCPOC_TOOLCHAIN_DIR}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
if(NOT ${TOOL})
|
||||
message(FATAL_ERROR "could not find arm-xilinx-linux-gnueabi-${tool}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
# os tools
|
||||
foreach(tool echo grep rm mkdir nm cp touch make unzip)
|
||||
string(TOUPPER ${tool} TOOL)
|
||||
find_program(${TOOL} ${tool})
|
||||
if(NOT ${TOOL})
|
||||
message(FATAL_ERROR "could not find ${TOOL}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
add_definitions(
|
||||
-D __OCPOC
|
||||
)
|
||||
|
||||
set(LINKER_FLAGS "-Wl,-gc-sections")
|
||||
set(CMAKE_EXE_LINKER_FLAGS ${LINKER_FLAGS})
|
||||
set(CMAKE_C_FLAGS ${C_FLAGS})
|
||||
set(CMAKE_CXX_LINKER_FLAGS ${C_FLAGS})
|
||||
|
||||
# where is the target environment
|
||||
set(CMAKE_FIND_ROOT_PATH get_file_component(${C_COMPILER} PATH))
|
||||
|
||||
# search for programs in the build host directories
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
# for libraries and headers in the target directories
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
# enable static linking
|
||||
#set(LDFLAGS "--disable-shared")
|
||||
Reference in New Issue
Block a user