forked from Archive/PX4-Autopilot
commit
5d2b01a8e7
|
@ -4,8 +4,8 @@
|
|||
[submodule "NuttX"]
|
||||
path = NuttX
|
||||
url = git://github.com/PX4/NuttX.git
|
||||
[submodule "src/lib/uavcan"]
|
||||
path = src/lib/uavcan
|
||||
[submodule "src/modules/uavcan/libuavcan"]
|
||||
path = src/modules/uavcan/libuavcan
|
||||
url = git://github.com/UAVCAN/libuavcan.git
|
||||
[submodule "Tools/genmsg"]
|
||||
path = Tools/genmsg
|
||||
|
|
|
@ -224,7 +224,7 @@ px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg")
|
|||
px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp")
|
||||
px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0")
|
||||
px4_add_git_submodule(TARGET git_gtest PATH "unittets/gtest")
|
||||
px4_add_git_submodule(TARGET git_uavcan PATH "src/lib/uavcan")
|
||||
px4_add_git_submodule(TARGET git_uavcan PATH "src/modules/uavcan/libuavcan")
|
||||
px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen")
|
||||
px4_add_git_submodule(TARGET git_nuttx PATH "NuttX")
|
||||
px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal")
|
||||
|
|
12
Makefile
12
Makefile
|
@ -74,7 +74,13 @@ ifdef NINJA_BUILD
|
|||
PX4_MAKE = ninja
|
||||
PX4_MAKE_ARGS =
|
||||
else
|
||||
PX4_CMAKE_GENERATOR ?= "Unix Makefiles"
|
||||
|
||||
ifdef SYSTEMROOT
|
||||
# Windows
|
||||
PX4_CMAKE_GENERATOR ?= "MSYS Makefiles"
|
||||
else
|
||||
PX4_CMAKE_GENERATOR ?= "Unix Makefiles"
|
||||
endif
|
||||
PX4_MAKE = make
|
||||
PX4_MAKE_ARGS = -j$(j) --no-print-directory
|
||||
endif
|
||||
|
@ -171,9 +177,9 @@ distclean: clean
|
|||
@cd NuttX
|
||||
@git clean -d -f -x
|
||||
@cd ..
|
||||
@cd src/lib/uavcan
|
||||
@cd src/modules/uavcan/libuavcan
|
||||
@git clean -d -f -x
|
||||
@cd ../../..
|
||||
@cd ../../../..
|
||||
|
||||
# targets handled by cmake
|
||||
cmake_targets = test upload package package_source debug debug_tui debug_ddd debug_io debug_io_tui debug_io_ddd check_weak libuavcan
|
||||
|
|
|
@ -25,7 +25,7 @@ for fn in $(find src/examples \
|
|||
-path './NuttX' -prune -o \
|
||||
-path './src/lib/eigen' -prune -o \
|
||||
-path './src/lib/mathlib/CMSIS' -prune -o \
|
||||
-path './src/lib/uavcan' -prune -o \
|
||||
-path './src/modules/uavcan/libuavcan' -prune -o \
|
||||
-path './src/modules/attitude_estimator_ekf/codegen' -prune -o \
|
||||
-path './src/modules/ekf_att_pos_estimator' -prune -o \
|
||||
-path './src/modules/sdlog2' -prune -o \
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import glob
|
||||
import os
|
||||
import sys
|
||||
|
||||
# This script is run from Build/<target>_default.build/$(PX4_BASE)/Firmware/src/systemcmds/topic_listener
|
||||
|
@ -48,7 +49,9 @@ for index,m in enumerate(raw_messages):
|
|||
temp_list.append(("int8",line.split(' ')[1].split('\t')[0].split('\n')[0]))
|
||||
|
||||
f.close()
|
||||
messages.append(m.split('/')[-1].split('.')[0])
|
||||
(m_head, m_tail) = os.path.split(m)
|
||||
messages.append(m_tail.split('.')[0])
|
||||
#messages.append(m.split('/')[-1].split('.')[0])
|
||||
message_elements.append(temp_list)
|
||||
|
||||
num_messages = len(messages);
|
||||
|
|
|
@ -43,6 +43,11 @@ import shutil
|
|||
import filecmp
|
||||
import argparse
|
||||
|
||||
import sys
|
||||
px4_tools_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.append(px4_tools_dir + "/genmsg/src")
|
||||
sys.path.append(px4_tools_dir + "/gencpp/src")
|
||||
|
||||
try:
|
||||
import genmsg.template_tools
|
||||
except ImportError as e:
|
||||
|
|
|
@ -138,8 +138,7 @@ function(px4_add_git_submodule)
|
|||
string(REPLACE "/" "_" NAME ${PATH})
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git_${NAME}.stamp
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND git submodule init ${PATH}
|
||||
COMMAND git submodule update -f ${PATH}
|
||||
COMMAND git submodule update --init --recursive -f ${PATH}
|
||||
COMMAND touch ${CMAKE_BINARY_DIR}/git_${NAME}.stamp
|
||||
)
|
||||
add_custom_target(${TARGET}
|
||||
|
@ -330,7 +329,6 @@ function(px4_generate_messages)
|
|||
if(NOT VERBOSE)
|
||||
set(QUIET "-q")
|
||||
endif()
|
||||
set(PYTHONPATH "${CMAKE_SOURCE_DIR}/Tools/genmsg/src:${CMAKE_SOURCE_DIR}/Tools/gencpp/src:$ENV{PYTHONPATH}")
|
||||
set(msg_out_path ${CMAKE_BINARY_DIR}/src/modules/uORB/topics)
|
||||
set(msg_list)
|
||||
foreach(msg_file ${MSG_FILES})
|
||||
|
@ -342,7 +340,7 @@ function(px4_generate_messages)
|
|||
list(APPEND msg_files_out ${msg_out_path}/${msg}.h)
|
||||
endforeach()
|
||||
add_custom_command(OUTPUT ${msg_files_out}
|
||||
COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
Tools/px_generate_uorb_topic_headers.py
|
||||
${QUIET}
|
||||
-d msg
|
||||
|
@ -363,7 +361,7 @@ function(px4_generate_messages)
|
|||
list(APPEND msg_multi_files_out ${msg_multi_out_path}/px4_${msg}.h)
|
||||
endforeach()
|
||||
add_custom_command(OUTPUT ${msg_multi_files_out}
|
||||
COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
Tools/px_generate_uorb_topic_headers.py
|
||||
${QUIET}
|
||||
-d msg
|
||||
|
@ -425,7 +423,7 @@ function(px4_add_upload)
|
|||
endif()
|
||||
px4_join(OUT serial_ports LIST "${serial_ports}" GLUE ",")
|
||||
add_custom_target(${OUT}
|
||||
COMMAND PYTHONPATH=${PYTHONPATH} ${PYTHON_EXECUTABLE}
|
||||
COMMAND ${PYTHON_EXECUTABLE}
|
||||
${CMAKE_SOURCE_DIR}/Tools/px_uploader.py --port ${serial_ports} ${BUNDLE}
|
||||
DEPENDS ${BUNDLE}
|
||||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
||||
|
@ -536,6 +534,7 @@ function(px4_add_common_flags)
|
|||
-ffunction-sections
|
||||
-fdata-sections
|
||||
)
|
||||
|
||||
if (NOT ${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
|
||||
list(APPEND optimization_flags
|
||||
-fno-strength-reduce
|
||||
|
@ -544,7 +543,6 @@ function(px4_add_common_flags)
|
|||
endif()
|
||||
|
||||
set(c_warnings
|
||||
-Wbad-function-cast
|
||||
-Wstrict-prototypes
|
||||
-Wmissing-prototypes
|
||||
-Wnested-externs
|
||||
|
@ -566,6 +564,7 @@ function(px4_add_common_flags)
|
|||
set(cxx_warnings
|
||||
-Wno-missing-field-initializers
|
||||
)
|
||||
|
||||
set(cxx_compile_flags
|
||||
-g
|
||||
-fno-exceptions
|
||||
|
@ -578,7 +577,7 @@ function(px4_add_common_flags)
|
|||
|
||||
set(visibility_flags
|
||||
-fvisibility=hidden
|
||||
"-include ${CMAKE_SOURCE_DIR}/src/include/visibility.h"
|
||||
-include visibility.h
|
||||
)
|
||||
|
||||
set(added_c_flags
|
||||
|
|
|
@ -168,8 +168,8 @@ set(config_io_board
|
|||
|
||||
set(config_extra_libs
|
||||
${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM4lf_math.a
|
||||
libuavcan.a
|
||||
libuavcan_stm32_driver.a
|
||||
uavcan
|
||||
uavcan_stm32_driver
|
||||
)
|
||||
|
||||
set(config_io_extra_libs
|
||||
|
|
|
@ -12,6 +12,7 @@ from subprocess import PIPE
|
|||
parser = argparse.ArgumentParser(description='Convert bin to obj.')
|
||||
parser.add_argument('--c_flags', required=True)
|
||||
parser.add_argument('--c_compiler', required=True)
|
||||
parser.add_argument('--include_path', required=True)
|
||||
parser.add_argument('--nm', required=True)
|
||||
parser.add_argument('--ld', required=True)
|
||||
parser.add_argument('--objcopy', required=True)
|
||||
|
@ -23,6 +24,7 @@ args = parser.parse_args()
|
|||
in_bin = args.bin
|
||||
c_flags = args.c_flags
|
||||
c_compiler = args.c_compiler
|
||||
include_path = args.include_path
|
||||
nm = args.nm
|
||||
ld = args.ld
|
||||
obj = args.obj
|
||||
|
@ -46,7 +48,7 @@ def run_cmd(cmd, d):
|
|||
return stdout
|
||||
|
||||
# do compile
|
||||
run_cmd("{c_compiler:s} {c_flags:s} -c {obj:s}.c -o {obj:s}.c.o",
|
||||
run_cmd("{c_compiler:s} -I{include_path:s} {c_flags:s} -c {obj:s}.c -o {obj:s}.c.o",
|
||||
locals())
|
||||
|
||||
# link
|
||||
|
@ -55,9 +57,10 @@ run_cmd("{ld:s} -r -o {obj:s}.bin.o {obj:s}.c.o -b binary {in_bin:s}",
|
|||
|
||||
# get size of image
|
||||
stdout = run_cmd("{nm:s} -p --radix=x {obj:s}.bin.o", locals())
|
||||
re_string = r"^([0-9A-F-a-f]+) .*{sym:s}_size\n".format(**locals())
|
||||
re_string = r"^([0-9A-Fa-f]+) .*{sym:s}_size".format(**locals())
|
||||
re_size = re.compile(re_string, re.MULTILINE)
|
||||
size_match = re.search(re_size, stdout.decode())
|
||||
|
||||
try:
|
||||
size = size_match.group(1)
|
||||
except AttributeError as e:
|
||||
|
@ -76,7 +79,7 @@ with open('{obj:s}.c'.format(**locals()), 'w') as f:
|
|||
**locals()))
|
||||
|
||||
# do compile
|
||||
run_cmd("{c_compiler:s} {c_flags:s} -c {obj:s}.c -o {obj:s}.c.o",
|
||||
run_cmd("{c_compiler:s} -I{include_path:s} {c_flags:s} -c {obj:s}.c -o {obj:s}.c.o",
|
||||
locals())
|
||||
|
||||
# link
|
||||
|
|
|
@ -213,7 +213,9 @@ function(px4_nuttx_add_export)
|
|||
# copy
|
||||
add_custom_command(OUTPUT nuttx_copy_${CONFIG}.stamp
|
||||
COMMAND ${MKDIR} -p ${CMAKE_BINARY_DIR}/${CONFIG}
|
||||
COMMAND rsync -a --exclude=.git ${CMAKE_SOURCE_DIR}/NuttX/ ${nuttx_src}/
|
||||
COMMAND ${RM} -rf ${nuttx_src}
|
||||
COMMAND ${CP} -r ${CMAKE_SOURCE_DIR}/NuttX ${nuttx_src}
|
||||
COMMAND ${RM} -rf ${nuttx_src}/.git
|
||||
COMMAND ${TOUCH} nuttx_copy_${CONFIG}.stamp
|
||||
DEPENDS ${DEPENDS})
|
||||
add_custom_target(__nuttx_copy_${CONFIG}
|
||||
|
@ -347,6 +349,7 @@ function(px4_nuttx_add_romfs)
|
|||
#COMMAND cmake -E remove_directory ${romfs_temp_dir}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${bin_to_obj}
|
||||
--ld ${LD} --c_flags ${CMAKE_C_FLAGS}
|
||||
--include_path "${CMAKE_SOURCE_DIR}/src/include"
|
||||
--c_compiler ${CMAKE_C_COMPILER}
|
||||
--nm ${NM} --objcopy ${OBJCOPY}
|
||||
--obj romfs.o
|
||||
|
|
|
@ -1064,3 +1064,5 @@ CONFIG_SYSTEM_SYSINFO=y
|
|||
#
|
||||
# USB Monitor
|
||||
#
|
||||
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 86c3397b1b423eeed86f21c8b08c8acfbd5add96
|
|
@ -31,65 +31,30 @@
|
|||
#
|
||||
############################################################################
|
||||
|
||||
# uavcan project
|
||||
set(uavcan_c_flags ${c_flags})
|
||||
list(REMOVE_ITEM uavcan_c_flags -std=gnu++0x -D__CUSTOM_FILE_IO__)
|
||||
set(uavcan_cxx_flags ${cxx_flags})
|
||||
list(REMOVE_ITEM uavcan_cxx_flags -std=gnu++0x -std=c++11 -Wundef -Werror -D__CUSTOM_FILE_IO__)
|
||||
set(uavcan_deps git_uavcan)
|
||||
set(uavcan_platform generic)
|
||||
|
||||
set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export)
|
||||
set(UAVCAN_USE_CPP03 ON CACHE BOOL "uavcan cpp03")
|
||||
set(UAVCAN_PLATFORM stm32 CACHE STRING "uavcan platform")
|
||||
|
||||
string(TOUPPER "${OS}" OS_UPPER)
|
||||
|
||||
set(uavcan_definitions
|
||||
-DUAVCAN_NO_ASSERTIONS
|
||||
-DUAVCAN_STM32_NUM_IFACES=2
|
||||
-DUAVCAN_USE_EXTERNAL_SNPRINT
|
||||
-DUAVCAN_MEM_POOL_BLOCK_SIZE=48
|
||||
-DUAVCAN_MAX_NETWORK_SIZE_HINT=16
|
||||
-DUAVCAN_STM32_TIMER_NUMBER=5
|
||||
-DUAVCAN_STM32_${OS_UPPER}=1
|
||||
-DUAVCAN_CPP_VERSION=UAVCAN_CPP03
|
||||
)
|
||||
set(uavcan_extra_flags ${uavcan_definitions})
|
||||
|
||||
if (${OS} STREQUAL "nuttx")
|
||||
set(uavcan_platform stm32)
|
||||
list(APPEND uavcan_extra_flags
|
||||
-I${nuttx_export_dir}/include
|
||||
-I${nuttx_export_dir}/include/cxx
|
||||
-I${nuttx_export_dir}/arch/chip
|
||||
-I${nuttx_export_dir}/arch/common
|
||||
)
|
||||
list(APPEND uavcan_deps nuttx_export_${BOARD})
|
||||
endif()
|
||||
|
||||
list(APPEND uavcan_c_flags ${uavcan_extra_flags})
|
||||
list(APPEND uavcan_cxx_flags ${uavcan_extra_flags})
|
||||
|
||||
px4_join(OUT uavcan_c_flags LIST "${uavcan_c_flags}" GLUE " ")
|
||||
px4_join(OUT uavcan_cxx_flags LIST "${uavcan_cxx_flags}" GLUE " ")
|
||||
|
||||
externalproject_add(libuavcan
|
||||
DEPENDS ${uavcan_deps}
|
||||
DOWNLOAD_COMMAND ""
|
||||
UPDATE_COMMAND git submodule update --init
|
||||
LOG_INSTALL 1
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lib/uavcan
|
||||
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
add_definitions(
|
||||
-DUAVCAN_CPP_VERSION=UAVCAN_CPP03
|
||||
-DUAVCAN_MAX_NETWORK_SIZE_HINT=16
|
||||
-DUAVCAN_MEM_POOL_BLOCK_SIZE=48
|
||||
-DUAVCAN_NO_ASSERTIONS
|
||||
-DUAVCAN_PLATFORM=stm32
|
||||
-DUAVCAN_STM32_${OS_UPPER}=1
|
||||
-DUAVCAN_STM32_NUM_IFACES=2
|
||||
-DUAVCAN_STM32_TIMER_NUMBER=5
|
||||
-DUAVCAN_USE_CPP03=ON
|
||||
-DUAVCAN_PLATFORM=${uavcan_platform}
|
||||
-DUAVCAN_OS=${OS}
|
||||
-DCMAKE_CXX_FLAGS=${uavcan_cxx_flags}
|
||||
-DCMAKE_C_FLAGS=${uavcan_c_flags}
|
||||
-DCMAKE_INSTALL_PREFIX=${ep_base}/Install
|
||||
)
|
||||
-DUAVCAN_USE_EXTERNAL_SNPRINT
|
||||
)
|
||||
|
||||
string(TOUPPER ${OS} OS_UPPER)
|
||||
add_subdirectory(libuavcan EXCLUDE_FROM_ALL)
|
||||
add_dependencies(uavcan platforms__nuttx)
|
||||
|
||||
add_definitions(${uavcan_definitions})
|
||||
include_directories(libuavcan/libuavcan/include)
|
||||
include_directories(libuavcan/libuavcan/include/dsdlc_generated)
|
||||
include_directories(libuavcan/libuavcan_drivers/posix/include)
|
||||
include_directories(libuavcan/libuavcan_drivers/stm32/driver/include)
|
||||
|
||||
px4_add_module(
|
||||
MODULE modules__uavcan
|
||||
|
@ -100,7 +65,6 @@ px4_add_module(
|
|||
-Wno-deprecated-declarations
|
||||
-O3
|
||||
SRCS
|
||||
|
||||
# Main
|
||||
uavcan_main.cpp
|
||||
uavcan_servers.cpp
|
||||
|
@ -117,7 +81,7 @@ px4_add_module(
|
|||
|
||||
DEPENDS
|
||||
platforms__common
|
||||
libuavcan
|
||||
uavcan
|
||||
)
|
||||
|
||||
## vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 0643879922239930cf7482777356f06891c26616
|
Loading…
Reference in New Issue