mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-25 16:27:35 +08:00
Compare commits
151 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 61778511ea | |||
| 56de0e27d8 | |||
| 7cb8ed3a1f | |||
| 0607982b23 | |||
| bcd057ac3e | |||
| a2260e53da | |||
| 446729566d | |||
| 0dea56f88b | |||
| dec5e7e9c8 | |||
| 19c98b8841 | |||
| e89e3c1b0c | |||
| ea80c5027e | |||
| 476c1e5c09 | |||
| ffebd8e771 | |||
| 92a5bbe97f | |||
| 36605bfff6 | |||
| c9f7c20d46 | |||
| d4e356a1ac | |||
| 8811482f1d | |||
| 632dfa55e6 | |||
| cbb8c90245 | |||
| 0950bb81ab | |||
| 258a563dd5 | |||
| fe44e281e5 | |||
| dd6b7fa98f | |||
| b1d2a0cc4e | |||
| 8067207ea6 | |||
| 953c90d3a6 | |||
| 408cf011b2 | |||
| 7eee949a81 | |||
| 548b7d5ece | |||
| ece09064c4 | |||
| cdb6a437a0 | |||
| 0bb9cce1ce | |||
| be9385ef06 | |||
| 2fb82789fe | |||
| 4cbee44220 | |||
| 425b268feb | |||
| cd2bb14f9b | |||
| 9249d3ae3d | |||
| 0ce44cebb7 | |||
| 1a4b2b37bb | |||
| 3b6c9448aa | |||
| 13c36155ce | |||
| 082e320191 | |||
| 66cbbf9f2e | |||
| 9ca58f5e97 | |||
| 98a9748bb8 | |||
| 81ecd130fc | |||
| 25099ce11f | |||
| 651702c2c1 | |||
| dc6067ed12 | |||
| 34bb671a73 | |||
| 555ee371e8 | |||
| f8c2ee73db | |||
| 8a01135a93 | |||
| d122513197 | |||
| bb1177d504 | |||
| d1304e1ceb | |||
| 3cd1e0ce19 | |||
| 443406ea2b | |||
| 4fc7348582 | |||
| ea7d2334c9 | |||
| 463513f31f | |||
| 2eec7842ae | |||
| 4e06b40e2b | |||
| 6ed48ad0c0 | |||
| b52972f3f8 | |||
| 1baecf07ad | |||
| 38439256e5 | |||
| 14fb019821 | |||
| feb2987fa8 | |||
| a061d7a02a | |||
| b3d830dd11 | |||
| 372a0da987 | |||
| 73044c51f9 | |||
| 22180a2639 | |||
| 0ffdccbd60 | |||
| b44f5b49ca | |||
| 8331339927 | |||
| b1a1e4913b | |||
| 28d69d3285 | |||
| b92aa92bec | |||
| 06b5b58b3b | |||
| 11b60904c3 | |||
| ca1fabf80a | |||
| f3a278dce5 | |||
| ecfc7cc24f | |||
| e15cbc3a6b | |||
| 24bdf79180 | |||
| c2e0e09b2d | |||
| e4763f15f6 | |||
| 9fe7a40673 | |||
| 1754e25920 | |||
| f03990f015 | |||
| cb15728536 | |||
| 7d09635fb6 | |||
| bb09646b41 | |||
| 0fbb03dee1 | |||
| a50f7af3b1 | |||
| fa282cfe86 | |||
| 880292f5d7 | |||
| 2b4b87571c | |||
| aa007dadee | |||
| 6301fa35c1 | |||
| 4a43155e69 | |||
| 7759ffb00e | |||
| 6960600c28 | |||
| 860b23dd17 | |||
| a21fefda48 | |||
| 856e229482 | |||
| 1be4e35ed4 | |||
| 76920171c7 | |||
| de1849167d | |||
| 185e4cfd48 | |||
| dd00e43ca3 | |||
| aefbd80b53 | |||
| f48c3a2cc6 | |||
| cc1fee525a | |||
| ab547bb982 | |||
| b58922a5d7 | |||
| 7d632254be | |||
| 2e2ac36cab | |||
| d9e7315420 | |||
| e731fcdbc0 | |||
| 45040be669 | |||
| c3ca40a98f | |||
| e5d49f6fff | |||
| d077ca15fb | |||
| df44df2df6 | |||
| 03bdc460d8 | |||
| d3301ba826 | |||
| 8de59dad32 | |||
| 1739ecc981 | |||
| 649d3e3f55 | |||
| b7ed4fd3e0 | |||
| 551a31ce2f | |||
| daa925137c | |||
| 78b3d22471 | |||
| 71d8b15b73 | |||
| 0b1402afe2 | |||
| 57fa9c545a | |||
| 6c97700eaa | |||
| bbad4a5397 | |||
| be0a5b4b32 | |||
| 2cbc993976 | |||
| 9eda5b373c | |||
| c17a9e8003 | |||
| aec97e0020 | |||
| 5d7ddf5734 | |||
| 30ccfdb2ed |
@@ -743,8 +743,10 @@ void checkStatus() {
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param status"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param show SYS*"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param dump"'
|
||||
sh './Tools/HIL/reboot.py --device `find /dev/serial -name *usb-*`' // reboot to apply
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param show SYS*"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param dump"'
|
||||
|
||||
// run logger
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "logger on"'
|
||||
@@ -778,6 +780,7 @@ void checkStatus() {
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "mavlink status" || true'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "mount"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "mtd status"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param dump"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param show" || true'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param status"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "perf latency"'
|
||||
@@ -789,7 +792,7 @@ void checkStatus() {
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "sensors status"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "top once"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "uavcan status" || true'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "uorb status"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "uorb status" || true'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "uorb top -1 -a"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "ver all"'
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "work_queue status"'
|
||||
@@ -806,12 +809,14 @@ void resetParameters() {
|
||||
void runTests() {
|
||||
|
||||
// test loading a range of airframes
|
||||
sh './Tools/HIL/test_airframes.sh `find /dev/serial -name *usb-*` 1000 1001 2100 3000 4001 6001 8001 10016'
|
||||
sh './Tools/HIL/test_airframes.sh `find /dev/serial -name *usb-*` 1000 1001 2100 3000 4001 4018 6001 8001 10016'
|
||||
|
||||
resetParameters()
|
||||
|
||||
sh './Tools/HIL/nsh_param_set.py --device `find /dev/serial -name *usb-*` --name "IMU_GYRO_CAL_EN" --value "0" || true' // disable during testing
|
||||
sh './Tools/HIL/nsh_param_set.py --device `find /dev/serial -name *usb-*` --name "IMU_GYRO_FFT_EN" --value "0" || true' // disable during testing
|
||||
sh './Tools/HIL/nsh_param_set.py --device `find /dev/serial -name *usb-*` --name "SENS_IMU_AUTOCAL" --value "0" || true' // disable during testing
|
||||
sh './Tools/HIL/nsh_param_set.py --device `find /dev/serial -name *usb-*` --name "SENS_MAG_AUTOCAL" --value "0" || true' // disable during testing
|
||||
|
||||
sh './Tools/HIL/run_nsh_cmd.py --device `find /dev/serial -name *usb-*` --cmd "param save"'
|
||||
sh './Tools/HIL/reboot.py --device `find /dev/serial -name *usb-*`' // reboot to apply
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
FROM gcr.io/oss-fuzz-base/base-builder:v1
|
||||
COPY . $SRC/PX4-Autopilot
|
||||
RUN apt-get install -y libjpeg8-dev zlib1g-dev
|
||||
RUN pip3 install --upgrade pip
|
||||
RUN python3 -m pip install -r $SRC/PX4-Autopilot/Tools/setup/requirements.txt
|
||||
WORKDIR $SRC/PX4-Autopilot
|
||||
COPY ./.clusterfuzzlite/build.sh $SRC/
|
||||
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash -eu
|
||||
|
||||
PX4_FUZZ=1 make px4_sitl
|
||||
cp build/px4_sitl_default/bin/px4 $OUT/px4
|
||||
@@ -0,0 +1 @@
|
||||
language: c++
|
||||
@@ -0,0 +1,34 @@
|
||||
name: ClusterFuzzLite batch fuzzing
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 6 * * *' # UTC 6am every day.
|
||||
permissions: read-all
|
||||
jobs:
|
||||
BatchFuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
sanitizer:
|
||||
- address
|
||||
- undefined
|
||||
- memory
|
||||
steps:
|
||||
- name: Build Fuzzers (${{ matrix.sanitizer }})
|
||||
id: build
|
||||
uses: google/clusterfuzzlite/actions/build_fuzzers@v1
|
||||
with:
|
||||
sanitizer: ${{ matrix.sanitizer }}
|
||||
- name: Run Fuzzers (${{ matrix.sanitizer }})
|
||||
id: run
|
||||
uses: google/clusterfuzzlite/actions/run_fuzzers@v1
|
||||
with:
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
fuzz-seconds: 1800 # 30 mins
|
||||
mode: 'batch'
|
||||
sanitizer: ${{ matrix.sanitizer }}
|
||||
# Optional but recommended: For storing certain artifacts from fuzzing.
|
||||
# See later section on "Git repo for storage".
|
||||
# storage-repo: https://${{ secrets.PERSONAL_ACCESS_TOKEN }}@github.com/OWNER/STORAGE-REPO-NAME.git
|
||||
# storage-repo-branch: main # Optional. Defaults to "main"
|
||||
# storage-repo-branch-coverage: gh-pages # Optional. Defaults to "gh-pages".
|
||||
@@ -33,6 +33,7 @@ jobs:
|
||||
holybro_can-gps-v1,
|
||||
holybro_durandal-v1,
|
||||
holybro_kakutef7,
|
||||
holybro_kakuteh7,
|
||||
holybro_pix32v5,
|
||||
matek_h743-slim,
|
||||
modalai_fc-v1,
|
||||
|
||||
@@ -64,6 +64,3 @@
|
||||
path = src/lib/crypto/libtommath
|
||||
url = https://github.com/PX4/libtommath.git
|
||||
branch = px4
|
||||
[submodule "platforms/nuttx/src/px4/stm/hal_stm32"]
|
||||
path = platforms/nuttx/src/px4/stm/hal_stm32
|
||||
url = git@github.com:zephyrproject-rtos/hal_stm32.git
|
||||
|
||||
Vendored
+5
@@ -31,6 +31,11 @@ CONFIG:
|
||||
buildType: RelWithDebInfo
|
||||
settings:
|
||||
CONFIG: px4_sitl_test
|
||||
px4_ros2_default:
|
||||
short: px4_ros2
|
||||
buildType: RelWithDebInfo
|
||||
settings:
|
||||
CONFIG: px4_ros2_default
|
||||
px4_io-v2_default:
|
||||
short: px4_io-v2
|
||||
buildType: MinSizeRel
|
||||
|
||||
Vendored
+5
-2
@@ -6,7 +6,7 @@
|
||||
"C_Cpp.autoAddFileAssociations": false,
|
||||
"C_Cpp.clang_format_fallbackStyle": "none",
|
||||
"C_Cpp.default.browse.limitSymbolsToIncludedHeaders": true,
|
||||
"C_Cpp.default.cppStandard": "c++14",
|
||||
"C_Cpp.default.cppStandard": "c++17",
|
||||
"C_Cpp.default.cStandard": "c11",
|
||||
"C_Cpp.formatting": "Disabled",
|
||||
"C_Cpp.intelliSenseEngine": "Default",
|
||||
@@ -121,6 +121,7 @@
|
||||
"variant": "cpp",
|
||||
"vector": "cpp"
|
||||
},
|
||||
"ros.distro": "foxy",
|
||||
"search.exclude": {
|
||||
"${workspaceFolder}/build": true
|
||||
},
|
||||
@@ -136,5 +137,7 @@
|
||||
"yaml.schemas": {
|
||||
"${workspaceFolder}/validation/module_schema.yaml": "${workspaceFolder}/src/modules/*/module.yaml"
|
||||
},
|
||||
"cortex-debug.openocdPath": "${env:PICO_SDK_PATH}/../openocd/src/openocd" // Added for rp2040
|
||||
"python.autoComplete.extraPaths": [
|
||||
"/opt/ros/foxy/lib/python3.8/site-packages"
|
||||
]
|
||||
}
|
||||
|
||||
+169
-38
@@ -101,6 +101,8 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)
|
||||
|
||||
cmake_policy(SET CMP0058 NEW)
|
||||
|
||||
set(PX4_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE FILEPATH "PX4 source directory" FORCE)
|
||||
set(PX4_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE FILEPATH "PX4 binary directory" FORCE)
|
||||
|
||||
@@ -124,7 +126,6 @@ define_property(GLOBAL PROPERTY PX4_MODULE_LIBRARIES
|
||||
BRIEF_DOCS "PX4 module libs"
|
||||
FULL_DOCS "List of all PX4 module libraries"
|
||||
)
|
||||
|
||||
define_property(GLOBAL PROPERTY PX4_MODULE_PATHS
|
||||
BRIEF_DOCS "PX4 module paths"
|
||||
FULL_DOCS "List of paths to all PX4 modules"
|
||||
@@ -133,29 +134,40 @@ define_property(GLOBAL PROPERTY PX4_SRC_FILES
|
||||
BRIEF_DOCS "src files from all PX4 modules & libs"
|
||||
FULL_DOCS "SRC files from px4_add_{module,library}"
|
||||
)
|
||||
|
||||
define_property(GLOBAL PROPERTY PX4_PUBLICATIONS
|
||||
BRIEF_DOCS "PX4 publication topics"
|
||||
FULL_DOCS "List of topics published by PX4 modules"
|
||||
)
|
||||
define_property(GLOBAL PROPERTY PX4_SUBSCRIPTIONS
|
||||
BRIEF_DOCS "PX4 subscription topics"
|
||||
FULL_DOCS "List of topics subscribed by PX4 modules"
|
||||
)
|
||||
#=============================================================================
|
||||
# configuration
|
||||
#
|
||||
|
||||
set(CONFIG "px4_sitl_default" CACHE STRING "desired configuration")
|
||||
# default to px4_ros2_default if building within a ROS2 colcon environment
|
||||
if((DEFINED ENV{COLCON_PREFIX_PATH}) AND (DEFINED ENV{ROS_VERSION}))
|
||||
if("$ENV{ROS_VERSION}" MATCHES "2")
|
||||
message(STATUS "ROS_VERSION: $ENV{ROS_VERSION}")
|
||||
set(CONFIG "px4_ros2_default" CACHE STRING "desired configuration") # TODO
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT CONFIG)
|
||||
set(CONFIG "px4_sitl_default" CACHE STRING "desired configuration")
|
||||
endif()
|
||||
|
||||
include(px4_add_module)
|
||||
set(config_module_list)
|
||||
|
||||
# Find Python
|
||||
# If using catkin, Python 2 is found since it points
|
||||
# to the Python libs installed with the ROS distro
|
||||
if (NOT CATKIN_DEVEL_PREFIX)
|
||||
find_package(PythonInterp 3)
|
||||
# We have a custom error message to tell users how to install python3.
|
||||
if (NOT PYTHONINTERP_FOUND)
|
||||
message(FATAL_ERROR "Python 3 not found. Please install Python 3:\n"
|
||||
" Ubuntu: sudo apt install python3 python3-dev python3-pip\n"
|
||||
" macOS: brew install python")
|
||||
endif()
|
||||
else()
|
||||
find_package(PythonInterp REQUIRED)
|
||||
find_package(PythonInterp 3)
|
||||
# We have a custom error message to tell users how to install python3.
|
||||
if(NOT PYTHONINTERP_FOUND)
|
||||
message(FATAL_ERROR "Python 3 not found. Please install Python 3:\n"
|
||||
" Ubuntu: sudo apt install python3 python3-dev python3-pip\n"
|
||||
" macOS: brew install python")
|
||||
endif()
|
||||
|
||||
option(PYTHON_COVERAGE "Python code coverage" OFF)
|
||||
@@ -191,10 +203,6 @@ set_property(GLOBAL PROPERTY PX4_MODULE_CONFIG_FILES)
|
||||
include(platforms/${PX4_PLATFORM}/cmake/px4_impl_os.cmake)
|
||||
list(APPEND CMAKE_MODULE_PATH ${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/cmake)
|
||||
|
||||
if(EXISTS "${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/cmake/init.cmake")
|
||||
include(init)
|
||||
endif()
|
||||
|
||||
# CMake build type (Debug Release RelWithDebInfo MinSizeRel Coverage)
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
if(${PX4_PLATFORM} STREQUAL "nuttx")
|
||||
@@ -230,7 +238,7 @@ project(px4 CXX C ASM)
|
||||
|
||||
set(package-contact "px4users@googlegroups.com")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_C_STANDARD 11)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
@@ -246,6 +254,10 @@ else()
|
||||
SET(BUILD_SHARED_LIBS OFF)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/cmake/init.cmake")
|
||||
include(init)
|
||||
endif()
|
||||
|
||||
#=============================================================================
|
||||
|
||||
# gold linker - use if available (posix only for now)
|
||||
@@ -315,13 +327,6 @@ if(NOT PX4_CHIP)
|
||||
message(FATAL_ERROR "px4_os_determine_build_chip() needs to set PX4_CHIP")
|
||||
endif()
|
||||
|
||||
#=============================================================================
|
||||
# build flags
|
||||
#
|
||||
include(px4_add_common_flags)
|
||||
px4_add_common_flags()
|
||||
px4_os_add_flags()
|
||||
|
||||
#=============================================================================
|
||||
# board cmake init (optional)
|
||||
#
|
||||
@@ -329,6 +334,13 @@ if(EXISTS ${PX4_BOARD_DIR}/cmake/init.cmake)
|
||||
include(${PX4_BOARD_DIR}/cmake/init.cmake)
|
||||
endif()
|
||||
|
||||
#=============================================================================
|
||||
# build flags
|
||||
#
|
||||
include(px4_add_common_flags)
|
||||
px4_add_common_flags()
|
||||
px4_os_add_flags()
|
||||
|
||||
#=============================================================================
|
||||
# message, and airframe generation
|
||||
#
|
||||
@@ -410,10 +422,13 @@ add_library(parameters_interface INTERFACE)
|
||||
include(px4_add_library)
|
||||
add_subdirectory(src/lib EXCLUDE_FROM_ALL)
|
||||
|
||||
add_subdirectory(platforms/${PX4_PLATFORM}/src/px4)
|
||||
add_subdirectory(platforms EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(platforms/${PX4_PLATFORM}/src/px4 EXCLUDE_FROM_ALL)
|
||||
|
||||
include(dts)
|
||||
if(${PX4_PLATFORM} MATCHES "ros2") # TODO: fix
|
||||
add_subdirectory(platforms/common/work_queue EXCLUDE_FROM_ALL)
|
||||
else()
|
||||
add_subdirectory(platforms EXCLUDE_FROM_ALL)
|
||||
endif()
|
||||
|
||||
if(EXISTS "${PX4_BOARD_DIR}/CMakeLists.txt")
|
||||
add_subdirectory(${PX4_BOARD_DIR})
|
||||
@@ -435,6 +450,126 @@ target_link_libraries(parameters_interface INTERFACE parameters)
|
||||
# firmware added last to generate the builtin for included modules
|
||||
add_subdirectory(platforms/${PX4_PLATFORM})
|
||||
|
||||
|
||||
set(PX4_ORB_TOPIC_COUNT 0)
|
||||
|
||||
if(${PX4_PLATFORM} MATCHES "ros2") # TODO: fix
|
||||
|
||||
configure_file(${CMAKE_SOURCE_DIR}/build/px4_fmu-v5x_default/uORBTopics.cpp ${CMAKE_BINARY_DIR}/uORBTopics.cpp COPYONLY)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/build/px4_fmu-v5x_default/uORBTopics.hpp ${CMAKE_BINARY_DIR}/uORBTopics.hpp COPYONLY)
|
||||
|
||||
set(PX4_ORB_TOPIC_COUNT 1)
|
||||
|
||||
else()
|
||||
|
||||
get_property(publications GLOBAL PROPERTY PX4_PUBLICATIONS)
|
||||
get_property(subscriptions GLOBAL PROPERTY PX4_SUBSCRIPTIONS)
|
||||
|
||||
# TODO: for now combine subsriptions and publications for complete topic list
|
||||
list(APPEND publications ${subscriptions})
|
||||
|
||||
list(SORT publications)
|
||||
list(REMOVE_DUPLICATES publications)
|
||||
|
||||
set(pub_all_topics)
|
||||
set(PX4_MSG_TYPE_ID)
|
||||
set(PX4_MSG_TOPIC_ID)
|
||||
set(PX4_MSG_TOPIC_ID_STRING)
|
||||
set(PX4_MSG_TOPIC_ORB_ID)
|
||||
|
||||
set(PX4_ORB_DECLARE_STR)
|
||||
set(PX4_ORB_DEFINE_STR)
|
||||
set(PX4_ORB_HEADER_INCLUDE_STR)
|
||||
|
||||
|
||||
foreach(pub ${publications})
|
||||
#message(STATUS "pub: ${pub}")
|
||||
string(REPLACE " /" ";" pub ${pub})
|
||||
|
||||
list(GET pub 0 pub_type)
|
||||
list(GET pub 1 pub_topic)
|
||||
|
||||
string(REPLACE "::" ";" pub_type_split ${pub_type})
|
||||
list(GET pub_type_split 2 pub_type_simple_lower)
|
||||
|
||||
# Pascal case to snake case (PubType -> pub_type)
|
||||
string(REGEX REPLACE "(.)([A-Z][a-z]+)" "\\1_\\2" pub_type_simple_lower "${pub_type_simple_lower}")
|
||||
string(REGEX REPLACE "([a-z0-9])([A-Z])" "\\1_\\2" pub_type_simple_lower "${pub_type_simple_lower}")
|
||||
string(TOLOWER "${pub_type_simple_lower}" pub_type_simple_lower)
|
||||
|
||||
#message(STATUS "pub: Type: ${pub_type}, Topic: ${pub_topic} (${pub_type_simple_lower})")
|
||||
|
||||
|
||||
|
||||
|
||||
# pub_type to include path (eg px4::msg::VehicleStatus => px4/msg/vehicle_status.hpp)
|
||||
# temporary create px4/msg/vehicle_status.hpp which simply includes <uORB/topics/vehicle_status.h>
|
||||
|
||||
|
||||
|
||||
|
||||
list(APPEND pub_all_topics ${pub_topic})
|
||||
|
||||
list(APPEND PX4_MSG_TYPE_ID ${pub_type})
|
||||
|
||||
#list(APPEND PX4_MSG_TOPIC_ID ${pub_topic})
|
||||
set(PX4_MSG_TOPIC_ID "${PX4_MSG_TOPIC_ID}\t${pub_topic},\n")
|
||||
#set(PX4_MSG_TOPIC_ID_STRING "${PX4_MSG_TOPIC_ID_STRING}\t"case ORB_ID::${pub_topic}: return \"${pub_topic}\";"\n")
|
||||
set(PX4_MSG_TOPIC_ORB_ID "${PX4_MSG_TOPIC_ORB_ID}\tORB_ID(${pub_topic}),\n")
|
||||
|
||||
list(APPEND PX4_MSG_TOPIC_ID_STRING
|
||||
"case ORB_ID::${pub_topic}: return \"${pub_topic}\";\n"
|
||||
)
|
||||
|
||||
# PX4_MSG_TYPE_ID
|
||||
# PX4_MSG_TOPIC_ID
|
||||
|
||||
# .h ORB_DECLARE(actuator_controls_0);
|
||||
# .c ORB_DEFINE(actuator_controls_0, struct actuator_controls_s, 48, __orb_actuator_controls_fields, static_cast<uint8_t>(ORB_ID::actuator_controls_0));
|
||||
|
||||
|
||||
set(PX4_ORB_DECLARE_STR
|
||||
"${PX4_ORB_DECLARE_STR}ORB_DECLARE(${pub_topic});\n")
|
||||
|
||||
# ORB_DEFINE(actuator_armed, struct actuator_armed_s, 16, __orb_actuator_armed_fields, static_cast<uint8_t>(ORB_ID::actuator_armed));
|
||||
set(PX4_ORB_DEFINE_STR
|
||||
"${PX4_ORB_DEFINE_STR}ORB_DEFINE(${pub_topic}, ${pub_type}, px4_embedded::${pub_type_simple_lower}_s::SIZE_NO_PADDING, px4_embedded::${pub_type_simple_lower}_s::FIELDS, static_cast<uint8_t>(ORB_ID::${pub_topic}));\n")
|
||||
|
||||
set(PX4_ORB_HEADER_INCLUDE_STR
|
||||
"${PX4_ORB_HEADER_INCLUDE_STR}#include <uORB/topics/${pub_type_simple_lower}.h>\n")
|
||||
|
||||
math(EXPR PX4_ORB_TOPIC_COUNT "${PX4_ORB_TOPIC_COUNT}+1")
|
||||
|
||||
endforeach()
|
||||
list(REMOVE_DUPLICATES PX4_MSG_TYPE_ID)
|
||||
#list(REMOVE_DUPLICATES PX4_MSG_TOPIC_ID)
|
||||
|
||||
#message(STATUS "PX4_MSG_TYPE_ID: ${PX4_MSG_TYPE_ID}")
|
||||
#message(STATUS "PX4_MSG_TOPIC_ID: ${PX4_MSG_TOPIC_ID}")
|
||||
|
||||
if(PX4_ORB_TOPIC_COUNT GREATER 0)
|
||||
configure_file(uORBTopics.cpp.in ${CMAKE_BINARY_DIR}/uORBTopics.cpp)
|
||||
configure_file(uORBTopics.hpp.in ${CMAKE_BINARY_DIR}/uORBTopics.hpp)
|
||||
endif()
|
||||
|
||||
# .hpp enum ORB_ID
|
||||
# .cpp struct orb_metadat ORB_ID() array
|
||||
|
||||
foreach(f ${msg_files})
|
||||
#message(STATUS "MSG: ${f}")
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
if(PX4_ORB_TOPIC_COUNT GREATER 0)
|
||||
add_library(uorb_msgs ${uorb_headers} ${CMAKE_BINARY_DIR}/uORBTopics.cpp ${CMAKE_BINARY_DIR}/uORBTopics.hpp)
|
||||
add_dependencies(uorb_msgs prebuild_targets uorb_headers)
|
||||
endif()
|
||||
|
||||
if(${PX4_PLATFORM} MATCHES "ros2") # TODO: fix
|
||||
ament_target_dependencies(uorb_msgs rclcpp std_msgs)
|
||||
rosidl_target_interfaces(uorb_msgs ${PROJECT_NAME} "rosidl_typesupport_cpp")
|
||||
endif()
|
||||
|
||||
#=============================================================================
|
||||
# uORB graph generation: add a custom target 'uorb_graph'
|
||||
#
|
||||
@@ -462,17 +597,13 @@ include(doxygen)
|
||||
include(metadata)
|
||||
include(package)
|
||||
|
||||
# print size
|
||||
add_custom_target(size
|
||||
COMMAND size $<TARGET_FILE:px4>
|
||||
DEPENDS px4
|
||||
WORKING_DIRECTORY ${PX4_BINARY_DIR}
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
# install python requirements using configured python
|
||||
add_custom_target(install_python_requirements
|
||||
COMMAND ${PYTHON_EXECUTABLE} -m pip install --requirement ${PX4_SOURCE_DIR}/Tools/setup/requirements.txt
|
||||
DEPENDS ${PX4_SOURCE_DIR}/Tools/setup/requirements.txt
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
if(EXISTS "${PX4_SOURCE_DIR}/platforms/${PX4_PLATFORM}/cmake/finalize.cmake")
|
||||
include(finalize)
|
||||
endif()
|
||||
|
||||
@@ -17,6 +17,8 @@ menu "Toolchain"
|
||||
bool "posix"
|
||||
config PLATFORM_QURT
|
||||
bool "qurt"
|
||||
config PLATFORM_ROS2
|
||||
bool "ros2"
|
||||
endchoice
|
||||
|
||||
config BOARD_PLATFORM
|
||||
@@ -24,6 +26,7 @@ menu "Toolchain"
|
||||
default "nuttx" if PLATFORM_NUTTX
|
||||
default "posix" if PLATFORM_POSIX
|
||||
default "qurt" if PLATFORM_QURT
|
||||
default "ros2" if PLATFORM_ROS2
|
||||
|
||||
config BOARD_LOCKSTEP
|
||||
bool "Force enable lockstep"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2012 - 2021, PX4 Development Team
|
||||
Copyright (c) 2012 - 2022, PX4 Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -158,6 +158,11 @@ else
|
||||
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=UndefinedBehaviorSanitizer
|
||||
endif
|
||||
|
||||
# Fuzz Testing
|
||||
ifdef PX4_FUZZ
|
||||
CMAKE_ARGS += -DCMAKE_BUILD_TYPE=FuzzTesting
|
||||
endif
|
||||
|
||||
endif
|
||||
|
||||
# Pick up specific Python path if set
|
||||
@@ -474,7 +479,7 @@ clang-tidy-quiet: px4_sitl_default-clang
|
||||
# TODO: Fix cppcheck errors then try --enable=warning,performance,portability,style,unusedFunction or --enable=all
|
||||
cppcheck: px4_sitl_default
|
||||
@mkdir -p "$(SRC_DIR)"/build/cppcheck
|
||||
@cppcheck -i"$(SRC_DIR)"/src/examples --enable=performance --std=c++14 --std=c99 --std=posix --project="$(SRC_DIR)"/build/px4_sitl_default/compile_commands.json --xml-version=2 2> "$(SRC_DIR)"/build/cppcheck/cppcheck-result.xml > /dev/null
|
||||
@cppcheck -i"$(SRC_DIR)"/src/examples --enable=performance --std=c++17 --std=c99 --std=posix --project="$(SRC_DIR)"/build/px4_sitl_default/compile_commands.json --xml-version=2 2> "$(SRC_DIR)"/build/cppcheck/cppcheck-result.xml > /dev/null
|
||||
@cppcheck-htmlreport --source-encoding=ascii --file="$(SRC_DIR)"/build/cppcheck/cppcheck-result.xml --report-dir="$(SRC_DIR)"/build/cppcheck --source-dir="$(SRC_DIR)"/src/
|
||||
|
||||
shellcheck_all:
|
||||
|
||||
@@ -35,6 +35,6 @@ param set-default MC_YAWRATE_P 0.25
|
||||
param set-default MC_YAWRATE_I 0.25
|
||||
|
||||
param set-default BAT1_V_DIV 12.27559
|
||||
param set-default BAT1_A_PER_V 15.39103
|
||||
param set-default BAT1_A_PER_V 15.391030303103
|
||||
|
||||
set MIXER quad_w
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
set MIXER quad_x
|
||||
set PWM_OUT 1234
|
||||
|
||||
param set UAVCAN_ENABLE 0
|
||||
|
||||
# set SYS_HITL to 2 to start the SIH and avoid sensors startup
|
||||
param set SYS_HITL 2
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
set MIXER AERT
|
||||
set PWM_OUT 1234
|
||||
|
||||
param set UAVCAN_ENABLE 0
|
||||
|
||||
# set SYS_HITL to 2 to start the SIH and avoid sensors startup
|
||||
param set-default SYS_HITL 2
|
||||
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# @name SIH Tailsitter Duo
|
||||
#
|
||||
# @type Simulation
|
||||
# @class VTOL
|
||||
#
|
||||
# @output MAIN1 motor right
|
||||
# @output MAIN2 motor left
|
||||
# @output MAIN5 elevon right
|
||||
# @output MAIN6 elevon left
|
||||
#
|
||||
# @maintainer Romain Chiappinelli <romain.chiap@gmail.com>
|
||||
#
|
||||
# @board px4_fmu-v2 exclude
|
||||
#
|
||||
|
||||
. ${R}etc/init.d/rc.vtol_defaults
|
||||
|
||||
param set UAVCAN_ENABLE 0
|
||||
param set-default VT_ELEV_MC_LOCK 0
|
||||
param set-default VT_MOT_COUNT 2
|
||||
param set-default VT_TYPE 0
|
||||
param set-default VT_FW_DIFTHR_EN 1
|
||||
param set-default VT_FW_DIFTHR_SC 0.3
|
||||
param set-default MPC_MAN_Y_MAX 60
|
||||
param set-default MC_PITCH_P 5
|
||||
|
||||
param set-default MAV_TYPE 19
|
||||
set MAV_TYPE 19
|
||||
set MIXER vtol_tailsitter_duo_sat
|
||||
|
||||
set PWM_OUT 1234
|
||||
|
||||
# set SYS_HITL to 2 to start the SIH and avoid sensors startup
|
||||
param set-default SYS_HITL 2
|
||||
|
||||
# disable some checks to allow to fly:
|
||||
# - with usb
|
||||
param set-default CBRK_USB_CHK 197848
|
||||
# - without real battery
|
||||
param set-default CBRK_SUPPLY_CHK 894281
|
||||
# - without safety switch
|
||||
param set-default COM_PREARM_MODE 0
|
||||
param set-default CBRK_IO_SAFETY 22027
|
||||
|
||||
param set-default BAT_N_CELLS 3
|
||||
|
||||
param set SIH_T_MAX 2.0
|
||||
param set SIH_Q_MAX 0.0165
|
||||
param set SIH_MASS 0.2
|
||||
# IXX and IZZ are inverted from the thesis as the body frame is pitched by 90 deg
|
||||
param set SIH_IXX 0.00354
|
||||
param set SIH_IYY 0.000625
|
||||
param set SIH_IZZ 0.00300
|
||||
param set SIH_IXZ 0.0
|
||||
param set SIH_KDV 0.2
|
||||
param set SIH_L_ROLL 0.145
|
||||
|
||||
# sih as tailsitter
|
||||
param set SIH_VEHICLE_TYPE 2
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# @name Holybro X500 V2
|
||||
#
|
||||
# @type Quadrotor x
|
||||
# @class Copter
|
||||
#
|
||||
# @maintainer Farhang Naderi <farhang.nba@gmail.com>
|
||||
#
|
||||
# @board px4_fmu-v2 exclude
|
||||
# @board bitcraze_crazyflie exclude
|
||||
#
|
||||
|
||||
. ${R}etc/init.d/rc.mc_defaults
|
||||
|
||||
param set-default IMU_GYRO_CUTOFF 30
|
||||
|
||||
param set-default MC_ROLLRATE_P 0.14
|
||||
param set-default MC_PITCHRATE_P 0.14
|
||||
param set-default MC_ROLLRATE_I 0.3
|
||||
param set-default MC_PITCHRATE_I 0.3
|
||||
param set-default MC_ROLLRATE_D 0.004
|
||||
param set-default MC_PITCHRATE_D 0.004
|
||||
@@ -16,8 +16,10 @@
|
||||
|
||||
. ${R}etc/init.d/rc.mc_defaults
|
||||
|
||||
set MIXER none
|
||||
set MIXER_AUX none
|
||||
# We set the mixer and ESC manually.
|
||||
set MIXER skip
|
||||
set MIXER_AUX skip
|
||||
set MIXER_FILE ""
|
||||
|
||||
# Battery settings
|
||||
param set-default BAT_CRIT_THR 0.20
|
||||
@@ -33,12 +35,13 @@ param set-default CBRK_SUPPLY_CHK 894281
|
||||
|
||||
param set-default COM_DISARM_LAND 0.1
|
||||
param set-default COM_DISARM_PRFLT 3
|
||||
param set-default COM_FLTMODE1 -1
|
||||
param set-default COM_DL_LOSS_T 10
|
||||
param set-default COM_FLTMODE1 2
|
||||
param set-default COM_FLTMODE2 -1
|
||||
param set-default COM_FLTMODE3 -1
|
||||
param set-default COM_FLTMODE4 2
|
||||
param set-default COM_FLTMODE4 -1
|
||||
param set-default COM_FLTMODE5 -1
|
||||
param set-default COM_FLTMODE6 6
|
||||
param set-default COM_FLTMODE6 1
|
||||
param set-default COM_RC_LOSS_T 3
|
||||
|
||||
|
||||
@@ -68,6 +71,9 @@ param set-default EKF2_OF_GATE 2.0
|
||||
param set-default EKF2_OF_POS_X -0.035
|
||||
param set-default EKF2_OF_POS_Y 0.0
|
||||
param set-default EKF2_OF_POS_Z 0.033
|
||||
param set-default EKF2_OF_MIN_RNG 0.01
|
||||
param set-default EKF2_OF_A_HMAX 7.0
|
||||
param set-default EKF2_OF_QMIN 30
|
||||
|
||||
param set-default EKF2_PCOEF_XN -0.3
|
||||
param set-default EKF2_PCOEF_XP -0.4
|
||||
@@ -142,57 +148,30 @@ param set-default MPC_Z_VEL_P 0.27
|
||||
|
||||
# gimbal configuration
|
||||
param set-default MNT_MODE_IN 1
|
||||
param set-default MNT_MODE_OUT 2
|
||||
param set-default MNT_MAN_PITCH 1
|
||||
|
||||
param set-default MNT_MODE_OUT 1
|
||||
param set-default MNT_MAN_PITCH 2
|
||||
param set-default MNT_RC_IN_MODE 1
|
||||
param set-default MNT_RATE_PITCH 30
|
||||
|
||||
# RC
|
||||
param set-default RC_CHAN_CNT 12
|
||||
|
||||
param set-default RC_MAP_THROTTLE 1
|
||||
param set-default RC_MAP_ROLL 2
|
||||
param set-default RC_MAP_YAW 2
|
||||
param set-default RC_MAP_PITCH 3
|
||||
param set-default RC_MAP_YAW 4
|
||||
param set-default RC_MAP_FLTMODE 5
|
||||
param set-default RC_MAP_AUX1 7
|
||||
|
||||
param set-default RC1_DZ 10
|
||||
param set-default RC1_MAX 3413
|
||||
param set-default RC1_MIN 683
|
||||
param set-default RC1_REV 1
|
||||
param set-default RC1_TRIM 683
|
||||
param set-default RC2_DZ 10
|
||||
param set-default RC2_MAX 3413
|
||||
param set-default RC2_MIN 683
|
||||
param set-default RC2_REV -1
|
||||
param set-default RC2_TRIM 2048
|
||||
param set-default RC3_DZ 10
|
||||
param set-default RC3_MAX 3413
|
||||
param set-default RC3_MIN 683
|
||||
param set-default RC3_REV 1
|
||||
param set-default RC3_TRIM 2048
|
||||
param set-default RC4_DZ 10
|
||||
param set-default RC4_MAX 3413
|
||||
param set-default RC4_MIN 683
|
||||
param set-default RC4_REV -1
|
||||
param set-default RC4_TRIM 2048
|
||||
param set-default RC5_DZ 10
|
||||
param set-default RC5_MAX 3414
|
||||
param set-default RC5_MIN 2048
|
||||
param set-default RC5_REV 1
|
||||
param set-default RC5_TRIM 2048
|
||||
param set-default RC7_DZ 10
|
||||
param set-default RC7_MAX 3413
|
||||
param set-default RC7_MIN 683
|
||||
param set-default RC7_REV 1
|
||||
param set-default RC7_TRIM 2048
|
||||
param set-default RC_MAP_ROLL 4
|
||||
param set-default RC_MAP_AUX2 5
|
||||
param set-default RC_MAP_AUX3 10
|
||||
param set-default RC_MAP_AUX4 8
|
||||
param set-default RC_MAP_FLTMODE 6
|
||||
param set-default RC1_TRIM 1000
|
||||
|
||||
|
||||
# optical flow
|
||||
param set-default SENS_FLOW_MAXR 7.4
|
||||
param set-default SENS_FLOW_MINHGT 0.15
|
||||
param set-default SENS_FLOW_MAXHGT 5.0
|
||||
param set-default SENS_FLOW_ROT 4
|
||||
param set-default SENS_FLOW_ROT 0
|
||||
|
||||
|
||||
mixer load /dev/tap_esc /etc/mixers/quad_x.main.mix
|
||||
# ignore the SD card errors and use normal startup sound
|
||||
set STARTUP_TUNE "1"
|
||||
|
||||
@@ -40,6 +40,7 @@ px4_add_romfs_files(
|
||||
1002_standard_vtol.hil
|
||||
1100_rc_quad_x_sih.hil
|
||||
1101_rc_plane_sih.hil
|
||||
1102_tailsitter_duo_sih.hil
|
||||
|
||||
# [2000, 2999] Standard planes"
|
||||
2100_standard_plane
|
||||
@@ -72,6 +73,7 @@ px4_add_romfs_files(
|
||||
4016_holybro_px4vision
|
||||
4017_nxp_hovergames
|
||||
4018_s500_ctrlalloc
|
||||
4019_x500_v2
|
||||
4030_3dr_solo
|
||||
4031_3dr_quad
|
||||
4040_reaper
|
||||
|
||||
@@ -45,7 +45,7 @@ fi
|
||||
#
|
||||
# Set the default output mode if none was set.
|
||||
#
|
||||
if [ $OUTPUT_MODE = none ]
|
||||
if [ $OUTPUT_MODE = none -a $OUTPUT_MODE != skip ]
|
||||
then
|
||||
if [ $USE_IO = yes ]
|
||||
then
|
||||
@@ -72,7 +72,7 @@ fi
|
||||
#
|
||||
# If OUTPUT_MODE = none then something is wrong with setup and we shouldn't try to enable output.
|
||||
#
|
||||
if [ $OUTPUT_MODE != none ]
|
||||
if [ $OUTPUT_MODE != none -a $OUTPUT_MODE != skip ]
|
||||
then
|
||||
|
||||
if [ $OUTPUT_MODE = hil -o $OUTPUT_MODE = sim ]
|
||||
|
||||
@@ -7,7 +7,10 @@
|
||||
|
||||
set VEHICLE_TYPE mc
|
||||
|
||||
param set-default IMU_GYRO_RATEMAX 800
|
||||
if param compare IMU_GYRO_RATEMAX 400
|
||||
then
|
||||
param set-default IMU_GYRO_RATEMAX 800
|
||||
fi
|
||||
|
||||
param set-default NAV_ACC_RAD 2
|
||||
|
||||
|
||||
@@ -291,15 +291,9 @@ else
|
||||
# Start core UAVCAN module.
|
||||
if uavcan start
|
||||
then
|
||||
if param greater UAVCAN_ENABLE 1
|
||||
if param greater UAVCAN_ENABLE 2
|
||||
then
|
||||
# Start UAVCAN firmware update server and dynamic node ID allocation server.
|
||||
uavcan start fw
|
||||
|
||||
if param greater UAVCAN_ENABLE 2
|
||||
then
|
||||
set OUTPUT_MODE uavcan_esc
|
||||
fi
|
||||
set OUTPUT_MODE uavcan_esc
|
||||
fi
|
||||
else
|
||||
tune_control play error
|
||||
@@ -415,17 +409,6 @@ else
|
||||
commander start
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Play the startup tune (if not disabled or there is an error)
|
||||
#
|
||||
param compare CBRK_BUZZER 782090
|
||||
if [ $? != 0 -o $STARTUP_TUNE != 1 ]
|
||||
then
|
||||
tune_control play -t $STARTUP_TUNE
|
||||
fi
|
||||
|
||||
|
||||
# Pre-takeoff continuous magnetometer calibration
|
||||
if param compare -s MBE_ENABLE 1
|
||||
then
|
||||
@@ -444,7 +427,7 @@ else
|
||||
set BOARD_RC_MAVLINK ${R}etc/init.d/rc.board_mavlink
|
||||
if [ -f $BOARD_RC_MAVLINK ]
|
||||
then
|
||||
echo "Board extras: ${BOARD_RC_MAVLINK}"
|
||||
echo "Board mavlink: ${BOARD_RC_MAVLINK}"
|
||||
. $BOARD_RC_MAVLINK
|
||||
fi
|
||||
unset BOARD_RC_MAVLINK
|
||||
@@ -483,6 +466,15 @@ else
|
||||
#
|
||||
. ${R}etc/init.d/rc.vehicle_setup
|
||||
|
||||
#
|
||||
# Play the startup tune (if not disabled or there is an error)
|
||||
#
|
||||
param compare CBRK_BUZZER 782090
|
||||
if [ "$?" != "0" -o "$STARTUP_TUNE" != "1" ]
|
||||
then
|
||||
tune_control play -t $STARTUP_TUNE
|
||||
fi
|
||||
|
||||
#
|
||||
# Start the navigator.
|
||||
#
|
||||
|
||||
@@ -90,4 +90,5 @@ px4_add_romfs_files(
|
||||
vtol_convergence.main.mix
|
||||
vtol_delta.aux.mix
|
||||
vtol_tailsitter_duo.main.mix
|
||||
vtol_tailsitter_duo_sat.main.mix
|
||||
)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
Tailsitter duo mixer
|
||||
============================
|
||||
|
||||
This file defines a mixer for a generic duo tailsitter VTOL (eg TBS Caipirinha tailsitter edition). This vehicle
|
||||
has two motors in total, one attached to each wing. It also has two elevons which
|
||||
are located in the slipstream of the propellers. This mixer generates 4 PWM outputs
|
||||
on the main PWM ouput port, two at 400Hz for the motors, and two at 50Hz for the
|
||||
elevon servos. Channels 1-4 are configured to run at 400Hz, while channels 5-8 run
|
||||
at the default rate of 50Hz. Note that channels 3 and 4 are assigned but not used.
|
||||
|
||||
Motor mixer
|
||||
------------
|
||||
Channel 1 connects to the right (starboard) motor.
|
||||
Channel 2 connects to the left (port) motor.
|
||||
|
||||
R: 2-
|
||||
|
||||
Zero mixer (2x)
|
||||
---------------
|
||||
Channels 3,4 are unused.
|
||||
|
||||
Z:
|
||||
|
||||
Z:
|
||||
|
||||
Elevons mixer
|
||||
--------------
|
||||
Channel 5 connects to the right (starboard) elevon.
|
||||
Channel 6 connects to the left (port) elevon.
|
||||
Here we saturate the elevons before their full range
|
||||
to avoid roll-pitch-yaw coupling during faster maneuvers
|
||||
|
||||
M: 2
|
||||
S: 1 0 10000 10000 0 -6000 6000
|
||||
S: 1 1 10000 10000 0 -6000 6000
|
||||
|
||||
M: 2
|
||||
S: 1 0 10000 10000 0 -6000 6000
|
||||
S: 1 1 -10000 -10000 0 -6000 6000
|
||||
@@ -21,13 +21,26 @@ echo "airframes: ${ALL_AIRFRAMES}"
|
||||
for airframe in $ALL_AIRFRAMES
|
||||
do
|
||||
echo
|
||||
echo "##########################################################################################"
|
||||
echo
|
||||
echo
|
||||
echo "########################################################################################################################"
|
||||
echo " Airframe: $airframe"
|
||||
echo "##########################################################################################"
|
||||
echo "########################################################################################################################"
|
||||
echo
|
||||
|
||||
${DIR}/nsh_param_set.py --device ${SERIAL_DEVICE} --name SYS_AUTOSTART --value $airframe
|
||||
${DIR}/nsh_param_set.py --device ${SERIAL_DEVICE} --name CBRK_BUZZER --value 782097
|
||||
|
||||
# enable all mavlink instances
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param set MAV_0_CONFIG 101' || true
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param set MAV_1_CONFIG 102' || true
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param set MAV_2_CONFIG 103' || true
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param set MAV_3_CONFIG 104' || true
|
||||
|
||||
# enable all GPS
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param set GPS_1_CONFIG 201' || true
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param set GPS_1_CONFIG 202' || true
|
||||
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param reset SYS_HITL'
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param status'
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param save'
|
||||
@@ -35,13 +48,16 @@ do
|
||||
|
||||
${DIR}/reboot.py --device ${SERIAL_DEVICE}
|
||||
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param status'
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param dump /fs/mtd_params' || true
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param dump /fs/microsd/parameters_backup.bson' || true
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'param dump /fs/microsd/param_import_fail.bson' || true
|
||||
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'ps'
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'work_queue status'
|
||||
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'pwm info'
|
||||
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'mavlink stop-all'
|
||||
${DIR}/run_nsh_cmd.py --device ${SERIAL_DEVICE} --cmd 'gps stop'
|
||||
|
||||
done
|
||||
|
||||
@@ -10,7 +10,6 @@ fi
|
||||
exec find boards msg src platforms test \
|
||||
-path msg/templates/urtps -prune -o \
|
||||
-path platforms/nuttx/NuttX -prune -o \
|
||||
-path platforms/nuttx/src/px4/stm/hal_stm32 -prune -o \
|
||||
-path platforms/qurt/dspal -prune -o \
|
||||
-path src/drivers/uavcan/libuavcan -prune -o \
|
||||
-path src/drivers/uavcan/uavcan_drivers/kinetis/driver/include/uavcan_kinetis -prune -o \
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
This directory used to contain the edtlib.py and dtlib.py libraries
|
||||
and tests, alongside the gen_defines.py script that uses them for
|
||||
converting DTS to the C macros used by Zephyr.
|
||||
|
||||
The libraries and tests have now been moved to the 'python-devicetree'
|
||||
subdirectory.
|
||||
|
||||
We are now in the process of extracting edtlib and dtlib into a
|
||||
standalone source code library that we intend to share with other
|
||||
projects.
|
||||
|
||||
Links related to the work making this standalone:
|
||||
|
||||
https://pypi.org/project/devicetree/
|
||||
https://python-devicetree.readthedocs.io/en/latest/
|
||||
https://github.com/zephyrproject-rtos/python-devicetree
|
||||
|
||||
The 'python-devicetree' subdirectory you find here next to this
|
||||
README.txt matches the standalone python-devicetree repository linked
|
||||
above.
|
||||
|
||||
For now, the 'main' copy will continue to be hosted here in the zephyr
|
||||
repository. We will mirror changes into the standalone repository as
|
||||
needed; you can just ignore it for now.
|
||||
|
||||
Code in the zephyr repository which needs these libraries will import
|
||||
devicetree.edtlib from now on, but the code will continue to be found
|
||||
by manipulating sys.path for now.
|
||||
|
||||
Eventually, as APIs stabilize, the python-devicetree code in this
|
||||
repository will disappear, and a standalone repository will be the
|
||||
'main' one.
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,151 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
'''
|
||||
This script uses edtlib and the devicetree data in the build directory
|
||||
to generate a CMake file which contains devicetree data.
|
||||
|
||||
That data can then be used in the rest of the build system.
|
||||
|
||||
The generated CMake file looks like this:
|
||||
|
||||
add_custom_target(devicetree_target)
|
||||
set_target_properties(devicetree_target PROPERTIES
|
||||
"DT_PROP|/soc|compatible" "vnd,soc;")
|
||||
...
|
||||
|
||||
It defines a special CMake target, and saves various values in the
|
||||
devicetree as CMake target properties.
|
||||
|
||||
Be careful:
|
||||
|
||||
"Property" here can refer to a CMake target property or a
|
||||
DTS property. DTS property values are stored inside
|
||||
CMake target properties, along with other devicetree data.
|
||||
|
||||
The build system includes this generated file early on, so
|
||||
devicetree values can be used at CMake processing time.
|
||||
|
||||
Accss is not done directly, but with Zephyr CMake extension APIs,
|
||||
like this:
|
||||
|
||||
# sets 'compat' to "vnd,soc" in CMake
|
||||
dt_prop(compat PATH "/soc" PROPERTY compatible INDEX 0)
|
||||
|
||||
This is analogous to how DTS values are encoded as C macros,
|
||||
which can be read in source code using C APIs like
|
||||
DT_PROP(node_id, foo) from devicetree.h.
|
||||
'''
|
||||
|
||||
import argparse
|
||||
import os
|
||||
import pickle
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), 'python-devicetree',
|
||||
'src'))
|
||||
|
||||
|
||||
def parse_args():
|
||||
# Returns parsed command-line arguments
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("--cmake-out", required=True,
|
||||
help="path to write the CMake property file")
|
||||
parser.add_argument("--edt-pickle", required=True,
|
||||
help="path to read the pickled edtlib.EDT object from")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def main():
|
||||
args = parse_args()
|
||||
|
||||
with open(args.edt_pickle, 'rb') as f:
|
||||
edt = pickle.load(f)
|
||||
|
||||
# In what looks like an undocumented implementation detail, CMake
|
||||
# target properties are stored in a C++ standard library map whose
|
||||
# keys and values are each arbitrary strings, so we can use
|
||||
# whatever we want as target property names.
|
||||
#
|
||||
# We therefore use '|' as a field separator character below within
|
||||
# because it's not a valid character in DTS node paths or property
|
||||
# names. This lets us store the "real" paths and property names
|
||||
# without conversion to lowercase-and-underscores like we have to
|
||||
# do in C.
|
||||
#
|
||||
# If CMake adds restrictions on target property names later, we
|
||||
# can just tweak the generated file to use a more restrictive
|
||||
# property encoding, perhaps reusing the same style documented in
|
||||
# macros.bnf for C macros.
|
||||
|
||||
cmake_props = []
|
||||
chosen_nodes = edt.chosen_nodes
|
||||
for node in chosen_nodes:
|
||||
path = chosen_nodes[node].path
|
||||
cmake_props.append(f'"DT_CHOSEN|{node}" "{path}"')
|
||||
|
||||
# The separate loop over edt.nodes here is meant to keep
|
||||
# all of the alias-related properties in one place.
|
||||
for node in edt.nodes:
|
||||
path = node.path
|
||||
for alias in node.aliases:
|
||||
cmake_props.append(f'"DT_ALIAS|{alias}" "{path}"')
|
||||
|
||||
for node in edt.nodes:
|
||||
cmake_props.append(f'"DT_NODE|{node.path}" TRUE')
|
||||
|
||||
for label in node.labels:
|
||||
cmake_props.append(f'"DT_NODELABEL|{label}" "{node.path}"')
|
||||
|
||||
for item in node.props:
|
||||
# We currently do not support phandles for edt -> cmake conversion.
|
||||
if "phandle" not in node.props[item].type:
|
||||
if "array" in node.props[item].type:
|
||||
# Convert array to CMake list
|
||||
cmake_value = ''
|
||||
for val in node.props[item].val:
|
||||
cmake_value = f'{cmake_value}{val};'
|
||||
else:
|
||||
cmake_value = node.props[item].val
|
||||
|
||||
# Encode node's property 'item' as a CMake target property
|
||||
# with a name like 'DT_PROP|<path>|<property>'.
|
||||
cmake_prop = f'DT_PROP|{node.path}|{item}'
|
||||
cmake_props.append(f'"{cmake_prop}" "{cmake_value}"')
|
||||
|
||||
if node.regs is not None:
|
||||
cmake_props.append(f'"DT_REG|{node.path}|NUM" "{len(node.regs)}"')
|
||||
cmake_addr = ''
|
||||
cmake_size = ''
|
||||
|
||||
for reg in node.regs:
|
||||
if reg.addr is None:
|
||||
cmake_addr = f'{cmake_addr}NONE;'
|
||||
else:
|
||||
cmake_addr = f'{cmake_addr}{hex(reg.addr)};'
|
||||
|
||||
if reg.size is None:
|
||||
cmake_size = f'{cmake_size}NONE;'
|
||||
else:
|
||||
cmake_size = f'{cmake_size}{hex(reg.size)};'
|
||||
|
||||
cmake_props.append(f'"DT_REG|{node.path}|ADDR" "{cmake_addr}"')
|
||||
cmake_props.append(f'"DT_REG|{node.path}|SIZE" "{cmake_size}"')
|
||||
|
||||
with open(args.cmake_out, "w", encoding="utf-8") as cmake_file:
|
||||
print('add_custom_target(devicetree_target)', file=cmake_file)
|
||||
print(file=cmake_file)
|
||||
|
||||
for prop in cmake_props:
|
||||
print(
|
||||
f'set_target_properties(devicetree_target PROPERTIES {prop})',
|
||||
file=cmake_file
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,7 +0,0 @@
|
||||
dist/
|
||||
src/devicetree.egg-info/
|
||||
build/
|
||||
devicetree.egg-info/
|
||||
__pycache__/
|
||||
.tox/
|
||||
doc/build/
|
||||
@@ -1 +0,0 @@
|
||||
sphinx_rtd_theme # docs
|
||||
@@ -1,42 +0,0 @@
|
||||
# Copyright (c) 2021, Nordic Semiconductor ASA
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import setuptools
|
||||
|
||||
long_description = '''
|
||||
Placeholder
|
||||
===========
|
||||
|
||||
This is just a placeholder for moving Zephyr's devicetree libraries
|
||||
to PyPI.
|
||||
'''
|
||||
|
||||
version = '0.0.1'
|
||||
|
||||
setuptools.setup(
|
||||
# TBD, just use these for now.
|
||||
author='Zephyr Project',
|
||||
author_email='devel@lists.zephyrproject.org',
|
||||
|
||||
name='devicetree',
|
||||
version=version,
|
||||
description='Python libraries for devicetree',
|
||||
long_description=long_description,
|
||||
# http://docutils.sourceforge.net/FAQ.html#what-s-the-official-mime-type-for-restructuredtext-data
|
||||
long_description_content_type="text/x-rst",
|
||||
url='https://github.com/zephyrproject-rtos/python-devicetree',
|
||||
packages=setuptools.find_packages(where='src'),
|
||||
package_dir={'': 'src'},
|
||||
classifiers=[
|
||||
'Programming Language :: Python :: 3 :: Only',
|
||||
'License :: OSI Approved :: Apache Software License',
|
||||
'Operating System :: POSIX :: Linux',
|
||||
'Operating System :: MacOS :: MacOS X',
|
||||
'Operating System :: Microsoft :: Windows',
|
||||
],
|
||||
install_requires=[
|
||||
'PyYAML>=5.1',
|
||||
],
|
||||
python_requires='>=3.6',
|
||||
)
|
||||
@@ -1,4 +0,0 @@
|
||||
# Copyright (c) 2021 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
__all__ = ['edtlib', 'dtlib']
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,161 +0,0 @@
|
||||
# Copyright 2009-2013, 2019 Peter A. Bigot
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
# This implementation is derived from the one in
|
||||
# [PyXB](https://github.com/pabigot/pyxb), stripped down and modified
|
||||
# specifically to manage edtlib Node instances.
|
||||
|
||||
import collections
|
||||
|
||||
class Graph:
|
||||
"""
|
||||
Represent a directed graph with edtlib Node objects as nodes.
|
||||
|
||||
This is used to determine order dependencies among nodes in a
|
||||
devicetree. An edge from C{source} to C{target} indicates that
|
||||
some aspect of C{source} requires that some aspect of C{target}
|
||||
already be available.
|
||||
"""
|
||||
|
||||
def __init__(self, root=None):
|
||||
self.__roots = None
|
||||
if root is not None:
|
||||
self.__roots = {root}
|
||||
self.__edge_map = collections.defaultdict(set)
|
||||
self.__reverse_map = collections.defaultdict(set)
|
||||
self.__nodes = set()
|
||||
|
||||
def add_edge(self, source, target):
|
||||
"""
|
||||
Add a directed edge from the C{source} to the C{target}.
|
||||
|
||||
The nodes are added to the graph if necessary.
|
||||
"""
|
||||
self.__edge_map[source].add(target)
|
||||
if source != target:
|
||||
self.__reverse_map[target].add(source)
|
||||
self.__nodes.add(source)
|
||||
self.__nodes.add(target)
|
||||
|
||||
def roots(self):
|
||||
"""
|
||||
Return the set of nodes calculated to be roots (i.e., those
|
||||
that have no incoming edges).
|
||||
|
||||
This caches the roots calculated in a previous invocation.
|
||||
|
||||
@rtype: C{set}
|
||||
"""
|
||||
if not self.__roots:
|
||||
self.__roots = set()
|
||||
for n in self.__nodes:
|
||||
if n not in self.__reverse_map:
|
||||
self.__roots.add(n)
|
||||
return self.__roots
|
||||
|
||||
def _tarjan(self):
|
||||
# Execute Tarjan's algorithm on the graph.
|
||||
#
|
||||
# Tarjan's algorithm
|
||||
# (http://en.wikipedia.org/wiki/Tarjan%27s_strongly_connected_components_algorithm)
|
||||
# computes the strongly-connected components
|
||||
# (http://en.wikipedia.org/wiki/Strongly_connected_component)
|
||||
# of the graph: i.e., the sets of nodes that form a minimal
|
||||
# closed set under edge transition. In essence, the loops.
|
||||
# We use this to detect groups of components that have a
|
||||
# dependency cycle, and to impose a total order on components
|
||||
# based on dependencies.
|
||||
|
||||
self.__stack = []
|
||||
self.__scc_order = []
|
||||
self.__index = 0
|
||||
self.__tarjan_index = {}
|
||||
self.__tarjan_low_link = {}
|
||||
for v in self.__nodes:
|
||||
self.__tarjan_index[v] = None
|
||||
roots = sorted(self.roots(), key=node_key)
|
||||
if self.__nodes and not roots:
|
||||
raise Exception('TARJAN: No roots found in graph with {} nodes'.format(len(self.__nodes)))
|
||||
|
||||
for r in roots:
|
||||
self._tarjan_root(r)
|
||||
|
||||
# Assign ordinals for edtlib
|
||||
ordinal = 0
|
||||
for scc in self.__scc_order:
|
||||
# Zephyr customization: devicetree Node graphs should have
|
||||
# no loops, so all SCCs should be singletons. That may
|
||||
# change in the future, but for now we only give an
|
||||
# ordinal to singletons.
|
||||
if len(scc) == 1:
|
||||
scc[0].dep_ordinal = ordinal
|
||||
ordinal += 1
|
||||
|
||||
def _tarjan_root(self, v):
|
||||
# Do the work of Tarjan's algorithm for a given root node.
|
||||
|
||||
if self.__tarjan_index.get(v) is not None:
|
||||
# "Root" was already reached.
|
||||
return
|
||||
self.__tarjan_index[v] = self.__tarjan_low_link[v] = self.__index
|
||||
self.__index += 1
|
||||
self.__stack.append(v)
|
||||
source = v
|
||||
for target in sorted(self.__edge_map[source], key=node_key):
|
||||
if self.__tarjan_index[target] is None:
|
||||
self._tarjan_root(target)
|
||||
self.__tarjan_low_link[v] = min(self.__tarjan_low_link[v], self.__tarjan_low_link[target])
|
||||
elif target in self.__stack:
|
||||
self.__tarjan_low_link[v] = min(self.__tarjan_low_link[v], self.__tarjan_low_link[target])
|
||||
|
||||
if self.__tarjan_low_link[v] == self.__tarjan_index[v]:
|
||||
scc = []
|
||||
while True:
|
||||
scc.append(self.__stack.pop())
|
||||
if v == scc[-1]:
|
||||
break
|
||||
self.__scc_order.append(scc)
|
||||
|
||||
def scc_order(self):
|
||||
"""Return the strongly-connected components in order.
|
||||
|
||||
The data structure is a list, in dependency order, of strongly
|
||||
connected components (which can be single nodes). Appearance
|
||||
of a node in a set earlier in the list indicates that it has
|
||||
no dependencies on any node that appears in a subsequent set.
|
||||
This order is preferred over a depth-first-search order for
|
||||
code generation, since it detects loops.
|
||||
"""
|
||||
if not self.__scc_order:
|
||||
self._tarjan()
|
||||
return self.__scc_order
|
||||
__scc_order = None
|
||||
|
||||
def depends_on(self, node):
|
||||
"""Get the nodes that 'node' directly depends on."""
|
||||
return sorted(self.__edge_map[node], key=node_key)
|
||||
|
||||
def required_by(self, node):
|
||||
"""Get the nodes that directly depend on 'node'."""
|
||||
return sorted(self.__reverse_map[node], key=node_key)
|
||||
|
||||
def node_key(node):
|
||||
# This sort key ensures that sibling nodes with the same name will
|
||||
# use unit addresses as tiebreakers. That in turn ensures ordinals
|
||||
# for otherwise indistinguishable siblings are in increasing order
|
||||
# by unit address, which is convenient for displaying output.
|
||||
|
||||
if node.parent:
|
||||
parent_path = node.parent.path
|
||||
else:
|
||||
parent_path = '/'
|
||||
|
||||
if node.unit_addr is not None:
|
||||
name = node.name.rsplit('@', 1)[0]
|
||||
unit_addr = node.unit_addr
|
||||
else:
|
||||
name = node.name
|
||||
unit_addr = -1
|
||||
|
||||
return (parent_path, name, unit_addr)
|
||||
@@ -1,5 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Binding in test-bindings-2/
|
||||
|
||||
compatible: "in-dir-2"
|
||||
@@ -1 +0,0 @@
|
||||
This directory contains bindings used to test the 'include:' feature.
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: |
|
||||
An include must not give both an allowlist and a blocklist in a
|
||||
child binding. This binding should cause an error.
|
||||
compatible: allow-and-blocklist-child
|
||||
include:
|
||||
- name: include.yaml
|
||||
child-binding:
|
||||
property-blocklist: [x]
|
||||
property-allowlist: [y]
|
||||
@@ -1,10 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: |
|
||||
An include must not give both an allowlist and a blocklist.
|
||||
This binding should cause an error.
|
||||
compatible: allow-and-blocklist
|
||||
include:
|
||||
- name: include.yaml
|
||||
property-blocklist: [x]
|
||||
property-allowlist: [y]
|
||||
@@ -1,10 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: |
|
||||
A property-allowlist, if given, must be a list. This binding should
|
||||
cause an error.
|
||||
compatible: allow-not-list
|
||||
include:
|
||||
- name: include.yaml
|
||||
property-allowlist:
|
||||
foo:
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Valid property-allowlist.
|
||||
compatible: allowlist
|
||||
include:
|
||||
- name: include.yaml
|
||||
property-allowlist: [x]
|
||||
@@ -1,10 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: |
|
||||
A property-blocklist, if given, must be a list. This binding should
|
||||
cause an error.
|
||||
compatible: block-not-list
|
||||
include:
|
||||
- name: include.yaml
|
||||
property-blocklist:
|
||||
foo:
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Valid property-blocklist.
|
||||
compatible: blocklist
|
||||
include:
|
||||
- name: include.yaml
|
||||
property-blocklist: [x]
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: An empty property-allowlist is valid.
|
||||
compatible: empty-allowlist
|
||||
include:
|
||||
- name: include.yaml
|
||||
property-allowlist: []
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: An empty property-blocklist is valid.
|
||||
compatible: empty-blocklist
|
||||
include:
|
||||
- name: include.yaml
|
||||
property-blocklist: []
|
||||
@@ -1,11 +0,0 @@
|
||||
description: Test binding for filtering 'child-binding' properties
|
||||
|
||||
include:
|
||||
- name: include.yaml
|
||||
property-allowlist: [x]
|
||||
child-binding:
|
||||
property-blocklist: [child-prop-1]
|
||||
child-binding:
|
||||
property-allowlist: [grandchild-prop-1]
|
||||
|
||||
compatible: filter-child-bindings
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Second file for testing "intermixed" includes.
|
||||
compatible: include-2
|
||||
properties:
|
||||
a:
|
||||
type: int
|
||||
@@ -1,10 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: |
|
||||
Invalid include element: invalid keys are present.
|
||||
compatible: include-invalid-keys
|
||||
include:
|
||||
- name: include.yaml
|
||||
property-allowlist: [x]
|
||||
bad-key-1: 3
|
||||
bad-key-2: 3
|
||||
@@ -1,5 +0,0 @@
|
||||
description: |
|
||||
Invalid include: wrong top level type.
|
||||
compatible: include-invalid-type
|
||||
include:
|
||||
a-map-is-not-allowed-here: 3
|
||||
@@ -1,6 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: A map element with just a name is valid, and has no filters.
|
||||
compatible: include-no-list
|
||||
include:
|
||||
- name: include.yaml
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: |
|
||||
Invalid include element: no name key is present.
|
||||
compatible: include-no-name
|
||||
include:
|
||||
- property-allowlist: [x]
|
||||
@@ -1,24 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Test file for including other bindings
|
||||
compatible: include
|
||||
properties:
|
||||
x:
|
||||
type: int
|
||||
y:
|
||||
type: int
|
||||
z:
|
||||
type: int
|
||||
child-binding:
|
||||
properties:
|
||||
child-prop-1:
|
||||
type: int
|
||||
child-prop-2:
|
||||
type: int
|
||||
|
||||
child-binding:
|
||||
properties:
|
||||
grandchild-prop-1:
|
||||
type: int
|
||||
grandchild-prop-2:
|
||||
type: int
|
||||
@@ -1,8 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Including intermixed file names and maps is valid.
|
||||
compatible: intermixed
|
||||
include:
|
||||
- name: include.yaml
|
||||
property-allowlist: [x]
|
||||
- include-2.yaml
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Bar bus controller
|
||||
|
||||
compatible: "bar-bus"
|
||||
|
||||
bus: "bar"
|
||||
@@ -1,20 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: child-binding with separate compatible than the parent
|
||||
|
||||
compatible: "top-binding-with-compat"
|
||||
|
||||
child-binding:
|
||||
compatible: child-compat
|
||||
description: child node
|
||||
properties:
|
||||
child-prop:
|
||||
type: int
|
||||
required: true
|
||||
|
||||
child-binding:
|
||||
description: grandchild node
|
||||
properties:
|
||||
grandchild-prop:
|
||||
type: int
|
||||
required: true
|
||||
@@ -1,19 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: child-binding test
|
||||
|
||||
compatible: "top-binding"
|
||||
|
||||
child-binding:
|
||||
description: child node
|
||||
properties:
|
||||
child-prop:
|
||||
type: int
|
||||
required: true
|
||||
|
||||
child-binding:
|
||||
description: grandchild node
|
||||
properties:
|
||||
grandchild-prop:
|
||||
type: int
|
||||
required: true
|
||||
@@ -1,8 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
include: [grandchild-1.yaml, grandchild-2.yaml, grandchild-3.yaml]
|
||||
|
||||
properties:
|
||||
bar:
|
||||
required: true
|
||||
type: int
|
||||
@@ -1,36 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Property default value test
|
||||
|
||||
compatible: "defaults"
|
||||
|
||||
properties:
|
||||
int:
|
||||
type: int
|
||||
required: false
|
||||
default: 123
|
||||
|
||||
array:
|
||||
type: array
|
||||
required: false
|
||||
default: [1, 2, 3]
|
||||
|
||||
uint8-array:
|
||||
type: uint8-array
|
||||
required: false
|
||||
default: [0x89, 0xAB, 0xCD]
|
||||
|
||||
string:
|
||||
type: string
|
||||
required: false
|
||||
default: "hello"
|
||||
|
||||
string-array:
|
||||
type: string-array
|
||||
required: false
|
||||
default: ["hello", "there"]
|
||||
|
||||
default-not-used:
|
||||
type: int
|
||||
required: false
|
||||
default: 123
|
||||
@@ -1,15 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Property deprecated value test
|
||||
|
||||
compatible: "test-deprecated"
|
||||
|
||||
properties:
|
||||
oldprop:
|
||||
type: int
|
||||
deprecated: true
|
||||
required: false
|
||||
|
||||
curprop:
|
||||
type: int
|
||||
required: false
|
||||
@@ -1,5 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Device on any bus
|
||||
|
||||
compatible: "on-any-bus"
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Device on bar bus
|
||||
|
||||
compatible: "on-bus"
|
||||
|
||||
on-bus: "bar"
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Device on foo bus
|
||||
|
||||
compatible: "on-bus"
|
||||
|
||||
on-bus: "foo"
|
||||
@@ -1,36 +0,0 @@
|
||||
# Copyright (c) 2020 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Property enum test
|
||||
|
||||
compatible: "enums"
|
||||
|
||||
properties:
|
||||
int-enum:
|
||||
type: int
|
||||
enum:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
|
||||
string-enum: # not tokenizable
|
||||
type: string
|
||||
enum:
|
||||
- foo bar
|
||||
- foo_bar
|
||||
|
||||
tokenizable-lower-enum: # tokenizable in lowercase only
|
||||
type: string
|
||||
enum:
|
||||
- bar
|
||||
- BAR
|
||||
|
||||
tokenizable-enum: # tokenizable in lower and uppercase
|
||||
type: string
|
||||
enum:
|
||||
- bar
|
||||
- whitespace is ok
|
||||
- 123 is ok
|
||||
|
||||
no-enum:
|
||||
type: string
|
||||
@@ -1,4 +0,0 @@
|
||||
# A file that mentions a 'compatible' string without actually implementing it.
|
||||
# Used to check for issues with how we optimize binding loading.
|
||||
|
||||
# props
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Foo bus controller
|
||||
|
||||
compatible: "foo-bus"
|
||||
|
||||
bus: "foo"
|
||||
@@ -1,4 +0,0 @@
|
||||
properties:
|
||||
foo:
|
||||
type: int
|
||||
required: false
|
||||
@@ -1,4 +0,0 @@
|
||||
properties:
|
||||
foo:
|
||||
type: int
|
||||
required: true
|
||||
@@ -1,8 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: GPIO destination for mapping test
|
||||
|
||||
compatible: "gpio-dst"
|
||||
|
||||
gpio-cells:
|
||||
- val
|
||||
@@ -1,9 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: GPIO source for mapping test
|
||||
|
||||
compatible: "gpio-src"
|
||||
|
||||
properties:
|
||||
foo-gpios:
|
||||
type: phandle-array
|
||||
@@ -1,10 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
properties:
|
||||
foo:
|
||||
required: false
|
||||
type: int
|
||||
|
||||
baz:
|
||||
required: true
|
||||
type: int
|
||||
@@ -1,6 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
properties:
|
||||
baz:
|
||||
required: true
|
||||
type: int
|
||||
@@ -1,6 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
properties:
|
||||
qaz:
|
||||
required: true
|
||||
type: int
|
||||
@@ -1,8 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Interrupt controller with one cell
|
||||
|
||||
compatible: "interrupt-one-cell"
|
||||
|
||||
interrupt-cells:
|
||||
- one
|
||||
@@ -1,9 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Interrupt controller with two cells
|
||||
|
||||
compatible: "interrupt-two-cell"
|
||||
|
||||
interrupt-cells:
|
||||
- one
|
||||
- two
|
||||
@@ -1,10 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Interrupt controller with three cells
|
||||
|
||||
compatible: "interrupt-three-cell"
|
||||
|
||||
interrupt-cells:
|
||||
- one
|
||||
- two
|
||||
- three
|
||||
@@ -1,5 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Binding in test-bindings/
|
||||
|
||||
compatible: "in-dir-1"
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Include ordering test
|
||||
|
||||
compatible: "order-1"
|
||||
|
||||
include: ["foo-required.yaml", "foo-optional.yaml"]
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Include ordering test
|
||||
|
||||
compatible: "order-2"
|
||||
|
||||
include: ["foo-optional.yaml", "foo-required.yaml"]
|
||||
@@ -1,13 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Parent binding
|
||||
|
||||
compatible: "binding-include-test"
|
||||
|
||||
include: child.yaml
|
||||
|
||||
properties:
|
||||
foo:
|
||||
# Changed from not being required in grandchild-1.yaml
|
||||
required: true
|
||||
# Type set in grandchild
|
||||
@@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Controller with zero data values
|
||||
|
||||
compatible: "phandle-array-controller-0"
|
||||
|
||||
phandle-array-foo-cells: []
|
||||
@@ -1,11 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Controller with one data value
|
||||
|
||||
compatible: "phandle-array-controller-1"
|
||||
|
||||
phandle-array-foo-cells:
|
||||
- one
|
||||
|
||||
gpio-cells:
|
||||
- gpio-one
|
||||
@@ -1,9 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Controller with two data values
|
||||
|
||||
compatible: "phandle-array-controller-2"
|
||||
|
||||
phandle-array-foo-cells:
|
||||
- one
|
||||
- two
|
||||
@@ -1,50 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Device.props test
|
||||
|
||||
compatible: "props"
|
||||
|
||||
properties:
|
||||
nonexistent-boolean:
|
||||
type: boolean
|
||||
|
||||
existent-boolean:
|
||||
type: boolean
|
||||
|
||||
int:
|
||||
type: int
|
||||
const: 1
|
||||
|
||||
array:
|
||||
type: array
|
||||
|
||||
uint8-array:
|
||||
type: uint8-array
|
||||
|
||||
string:
|
||||
type: string
|
||||
const: "foo"
|
||||
|
||||
string-array:
|
||||
type: string-array
|
||||
|
||||
phandle-ref:
|
||||
type: phandle
|
||||
|
||||
phandle-refs:
|
||||
type: phandles
|
||||
|
||||
phandle-array-foos:
|
||||
type: phandle-array
|
||||
|
||||
phandle-array-foo-names:
|
||||
type: string-array
|
||||
|
||||
# There's some slight special-casing for GPIOs in that 'foo-gpios = ...'
|
||||
# gets resolved to #gpio-cells rather than #foo-gpio-cells, so test that
|
||||
# too
|
||||
foo-gpios:
|
||||
type: phandle-array
|
||||
|
||||
path:
|
||||
type: path
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Nordic Semiconductor
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
// Used by testedtlib.py. Dedicated file for testing having multiple binding
|
||||
// directories.
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
in-dir-1 {
|
||||
compatible = "in-dir-1";
|
||||
};
|
||||
in-dir-2 {
|
||||
compatible = "in-dir-2";
|
||||
};
|
||||
};
|
||||
@@ -1,9 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Device.wrong_phandle_array_name test
|
||||
|
||||
compatible: "wrong_phandle_array_name"
|
||||
|
||||
properties:
|
||||
wrong-phandle-array-name:
|
||||
type: phandle-array
|
||||
@@ -1,10 +0,0 @@
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
description: Device.wrong_specifier_space_type test
|
||||
|
||||
compatible: "wrong_specifier_space_type"
|
||||
|
||||
properties:
|
||||
wrong-type-for-specifier-space:
|
||||
type: phandle
|
||||
specifier-space: foobar
|
||||
@@ -1,534 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2019, Nordic Semiconductor
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
|
||||
// Used by testedtlib.py
|
||||
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
//
|
||||
// Interrupts
|
||||
//
|
||||
|
||||
interrupt-parent-test {
|
||||
controller {
|
||||
compatible = "interrupt-three-cell";
|
||||
#interrupt-cells = <3>;
|
||||
interrupt-controller;
|
||||
};
|
||||
node {
|
||||
interrupts = <1 2 3 4 5 6>;
|
||||
interrupt-names = "foo", "bar";
|
||||
interrupt-parent = <&{/interrupt-parent-test/controller}>;
|
||||
};
|
||||
};
|
||||
interrupts-extended-test {
|
||||
controller-0 {
|
||||
compatible = "interrupt-one-cell";
|
||||
#interrupt-cells = <1>;
|
||||
interrupt-controller;
|
||||
};
|
||||
controller-1 {
|
||||
compatible = "interrupt-two-cell";
|
||||
#interrupt-cells = <2>;
|
||||
interrupt-controller;
|
||||
};
|
||||
controller-2 {
|
||||
compatible = "interrupt-three-cell";
|
||||
#interrupt-cells = <3>;
|
||||
interrupt-controller;
|
||||
};
|
||||
node {
|
||||
interrupts-extended = <
|
||||
&{/interrupts-extended-test/controller-0} 1
|
||||
&{/interrupts-extended-test/controller-1} 2 3
|
||||
&{/interrupts-extended-test/controller-2} 4 5 6>;
|
||||
};
|
||||
};
|
||||
interrupt-map-test {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <0>;
|
||||
|
||||
controller-0 {
|
||||
compatible = "interrupt-one-cell";
|
||||
#address-cells = <1>;
|
||||
#interrupt-cells = <1>;
|
||||
interrupt-controller;
|
||||
};
|
||||
controller-1 {
|
||||
compatible = "interrupt-two-cell";
|
||||
#address-cells = <2>;
|
||||
#interrupt-cells = <2>;
|
||||
interrupt-controller;
|
||||
};
|
||||
controller-2 {
|
||||
compatible = "interrupt-three-cell";
|
||||
#address-cells = <3>;
|
||||
#interrupt-cells = <3>;
|
||||
interrupt-controller;
|
||||
};
|
||||
nexus {
|
||||
#interrupt-cells = <2>;
|
||||
interrupt-map = <
|
||||
0 0 0 0 &{/interrupt-map-test/controller-0} 0 0
|
||||
0 0 0 1 &{/interrupt-map-test/controller-1} 0 0 0 1
|
||||
0 0 0 2 &{/interrupt-map-test/controller-2} 0 0 0 0 0 2
|
||||
0 1 0 0 &{/interrupt-map-test/controller-0} 0 3
|
||||
0 1 0 1 &{/interrupt-map-test/controller-1} 0 0 0 4
|
||||
0 1 0 2 &{/interrupt-map-test/controller-2} 0 0 0 0 0 5>;
|
||||
};
|
||||
node@0 {
|
||||
reg = <0 0>;
|
||||
interrupts = <0 0 0 1 0 2>;
|
||||
interrupt-parent = <&{/interrupt-map-test/nexus}>;
|
||||
};
|
||||
node@1 {
|
||||
reg = <0 1>;
|
||||
interrupts-extended = <
|
||||
&{/interrupt-map-test/nexus} 0 0
|
||||
&{/interrupt-map-test/nexus} 0 1
|
||||
&{/interrupt-map-test/nexus} 0 2>;
|
||||
};
|
||||
};
|
||||
interrupt-map-bitops-test {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <0>;
|
||||
|
||||
controller {
|
||||
compatible = "interrupt-two-cell";
|
||||
#address-cells = <0>;
|
||||
#interrupt-cells = <2>;
|
||||
interrupt-controller;
|
||||
};
|
||||
nexus {
|
||||
#interrupt-cells = <2>;
|
||||
interrupt-map = <
|
||||
6 6 6 6 &{/interrupt-map-bitops-test/controller} 2 1
|
||||
>;
|
||||
interrupt-map-mask = <0xE 0x7 0xE 0x7>;
|
||||
// Not specified in the DT spec., but shows up due to
|
||||
// common code with GPIO. Might as well test it here.
|
||||
interrupt-map-pass-thru = <1 2 3 3>;
|
||||
};
|
||||
// Child unit specifier: 00000007 0000000E 00000007 0000000E
|
||||
// Mask: 0000000E 00000007 0000000E 00000007
|
||||
// Pass-thru: 00000001 00000002 00000003 00000003
|
||||
node@70000000E {
|
||||
reg = <0x7 0xE>;
|
||||
interrupt-parent = <&{/interrupt-map-bitops-test/nexus}>;
|
||||
interrupts = <0x7 0xE>;
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// 'ranges'
|
||||
//
|
||||
|
||||
ranges-zero-cells {
|
||||
#address-cells = <0>;
|
||||
|
||||
node {
|
||||
#address-cells = <0>;
|
||||
#size-cells = <0>;
|
||||
|
||||
ranges;
|
||||
};
|
||||
};
|
||||
|
||||
ranges-zero-parent-cells {
|
||||
#address-cells = <0>;
|
||||
|
||||
node {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
ranges = <0xA>,
|
||||
<0x1A>,
|
||||
<0x2A>;
|
||||
};
|
||||
};
|
||||
|
||||
ranges-one-address-cells {
|
||||
#address-cells = <0>;
|
||||
|
||||
node {
|
||||
reg = <1>;
|
||||
#address-cells = <1>;
|
||||
|
||||
ranges = <0xA 0xB>,
|
||||
<0x1A 0x1B>,
|
||||
<0x2A 0x2B>;
|
||||
};
|
||||
};
|
||||
|
||||
ranges-one-address-two-size-cells {
|
||||
#address-cells = <0>;
|
||||
|
||||
node {
|
||||
reg = <1>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <2>;
|
||||
|
||||
ranges = <0xA 0xB 0xC>,
|
||||
<0x1A 0x1B 0x1C>,
|
||||
<0x2A 0x2B 0x2C>;
|
||||
};
|
||||
};
|
||||
|
||||
ranges-two-address-cells {
|
||||
#address-cells = <1>;
|
||||
|
||||
node@1 {
|
||||
reg = <1 2>;
|
||||
|
||||
ranges = <0xA 0xB 0xC 0xD>,
|
||||
<0x1A 0x1B 0x1C 0x1D>,
|
||||
<0x2A 0x2B 0x2C 0x2D>;
|
||||
};
|
||||
};
|
||||
|
||||
ranges-two-address-two-size-cells {
|
||||
#address-cells = <1>;
|
||||
|
||||
node@1 {
|
||||
reg = <1 2>;
|
||||
#size-cells = <2>;
|
||||
|
||||
ranges = <0xA 0xB 0xC 0xD 0xE>,
|
||||
<0x1A 0x1B 0x1C 0x1D 0x1E>,
|
||||
<0x2A 0x2B 0x2C 0x2D 0x1D>;
|
||||
};
|
||||
};
|
||||
|
||||
ranges-three-address-cells {
|
||||
node@1 {
|
||||
reg = <0 1 2>;
|
||||
#address-cells = <3>;
|
||||
|
||||
ranges = <0xA 0xB 0xC 0xD 0xE 0xF>,
|
||||
<0x1A 0x1B 0x1C 0x1D 0x1E 0x1F>,
|
||||
<0x2A 0x2B 0x2C 0x2D 0x2E 0x2F>;
|
||||
};
|
||||
};
|
||||
|
||||
ranges-three-address-two-size-cells {
|
||||
node@1 {
|
||||
reg = <0 1 2>;
|
||||
#address-cells = <3>;
|
||||
#size-cells = <2>;
|
||||
|
||||
ranges = <0xA 0xB 0xC 0xD 0xE 0xF 0x10>,
|
||||
<0x1A 0x1B 0x1C 0x1D 0x1E 0x1F 0x110>,
|
||||
<0x2A 0x2B 0x2C 0x2D 0x2E 0x2F 0x210>;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 'reg'
|
||||
//
|
||||
|
||||
reg-zero-address-cells {
|
||||
#address-cells = <0>;
|
||||
#size-cells = <1>;
|
||||
|
||||
node {
|
||||
reg = <1 2>;
|
||||
};
|
||||
};
|
||||
reg-zero-size-cells {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
|
||||
node {
|
||||
reg = <1 2>;
|
||||
};
|
||||
};
|
||||
// Use implied #size-cells = <1>
|
||||
reg-ranges {
|
||||
#address-cells = <2>;
|
||||
|
||||
parent {
|
||||
#address-cells = <1>;
|
||||
ranges = <1 0xA 0xB 1 /* 1 -> 0xA 0xB */
|
||||
2 0xC 0xD 2 /* 2..3 -> 0xC 0xD */
|
||||
4 0xE 0xF 1 /* 4 -> 0xE 0xF */
|
||||
>;
|
||||
|
||||
node {
|
||||
reg = <5 1 /* Matches no range */
|
||||
4 1 /* Matches third range */
|
||||
3 1 /* Matches second range */
|
||||
2 1 /* Matches second range */
|
||||
1 1 /* Matches first range */
|
||||
0 1 /* Matches no range */
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
||||
// Build up <3 2 1> address with nested 'ranges'
|
||||
reg-nested-ranges {
|
||||
#address-cells = <3>;
|
||||
|
||||
grandparent {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
ranges = <0 0 3 0 0 2 2>;
|
||||
|
||||
parent {
|
||||
#address-cells = <1>;
|
||||
ranges = <0 2 0 2>;
|
||||
|
||||
node {
|
||||
reg = <1 1>;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// 'pinctrl-<index>'
|
||||
//
|
||||
|
||||
pinctrl {
|
||||
dev {
|
||||
pinctrl-0 = <>;
|
||||
pinctrl-1 = <&{/pinctrl/pincontroller/state-1}>;
|
||||
pinctrl-2 = <&{/pinctrl/pincontroller/state-1}
|
||||
&{/pinctrl/pincontroller/state-2}>;
|
||||
pinctrl-names = "zero", "one", "two";
|
||||
};
|
||||
pincontroller {
|
||||
state-1 {
|
||||
};
|
||||
state-2 {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// For testing Node.parent and Node.children
|
||||
//
|
||||
|
||||
parent {
|
||||
child-1 {
|
||||
};
|
||||
child-2 {
|
||||
grandchild {
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// For testing 'include:'
|
||||
//
|
||||
|
||||
binding-include {
|
||||
compatible = "binding-include-test";
|
||||
foo = <0>;
|
||||
bar = <1>;
|
||||
baz = <2>;
|
||||
qaz = <3>;
|
||||
};
|
||||
|
||||
//
|
||||
// For testing Node.props (derived from 'properties:' in the binding)
|
||||
//
|
||||
|
||||
props {
|
||||
compatible = "props";
|
||||
existent-boolean;
|
||||
int = <1>;
|
||||
array = <1 2 3>;
|
||||
uint8-array = [ 12 34 ];
|
||||
string = "foo";
|
||||
string-array = "foo", "bar", "baz";
|
||||
phandle-ref = < &{/ctrl-1} >;
|
||||
phandle-refs = < &{/ctrl-1} &{/ctrl-2} >;
|
||||
phandle-array-foos = < &{/ctrl-1} 1 &{/ctrl-2} 2 3 >;
|
||||
foo-gpios = < &{/ctrl-1} 1 >;
|
||||
path = &{/ctrl-1};
|
||||
};
|
||||
|
||||
ctrl-1 {
|
||||
compatible = "phandle-array-controller-1";
|
||||
#phandle-array-foo-cells = <1>;
|
||||
#gpio-cells = <1>;
|
||||
};
|
||||
|
||||
ctrl-2 {
|
||||
compatible = "phandle-array-controller-2";
|
||||
#phandle-array-foo-cells = <2>;
|
||||
};
|
||||
|
||||
props-2 {
|
||||
compatible = "props";
|
||||
phandle-array-foos = < &{/ctrl-0-1} 0 &{/ctrl-0-2} >;
|
||||
phandle-array-foo-names = "a", "missing", "b";
|
||||
};
|
||||
|
||||
ctrl-0-1 {
|
||||
compatible = "phandle-array-controller-0";
|
||||
#phandle-array-foo-cells = <0>;
|
||||
};
|
||||
|
||||
ctrl-0-2 {
|
||||
compatible = "phandle-array-controller-0";
|
||||
#phandle-array-foo-cells = <0>;
|
||||
};
|
||||
|
||||
//
|
||||
// Test <prefix>-map, via gpio-map
|
||||
//
|
||||
|
||||
gpio-map {
|
||||
source {
|
||||
compatible = "gpio-src";
|
||||
foo-gpios = <&{/gpio-map/connector} 3 4
|
||||
&{/gpio-map/connector} 1 2>;
|
||||
};
|
||||
connector {
|
||||
#gpio-cells = <2>;
|
||||
// Use different data lengths for source and
|
||||
// destination to make it a bit trickier
|
||||
gpio-map = <1 2 &{/gpio-map/destination} 5
|
||||
3 4 &{/gpio-map/destination} 6>;
|
||||
};
|
||||
destination {
|
||||
compatible = "gpio-dst";
|
||||
gpio-controller;
|
||||
#gpio-cells = <1>;
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// For testing Node.props with 'default:' values in binding
|
||||
//
|
||||
|
||||
defaults {
|
||||
compatible = "defaults";
|
||||
// Should override the 'default:' in the binding
|
||||
default-not-used = <234>;
|
||||
};
|
||||
|
||||
//
|
||||
// For testing 'enum:'
|
||||
//
|
||||
|
||||
enums {
|
||||
compatible = "enums";
|
||||
int-enum = <1>;
|
||||
string-enum = "foo_bar";
|
||||
tokenizable-enum = "123 is ok";
|
||||
tokenizable-lower-enum = "bar";
|
||||
no-enum = "baz";
|
||||
};
|
||||
|
||||
//
|
||||
// For testing 'bus:' and 'on-bus:'
|
||||
//
|
||||
|
||||
buses {
|
||||
// The 'node' nodes below will map to different bindings since
|
||||
// they appear on different buses
|
||||
foo-bus {
|
||||
compatible = "foo-bus";
|
||||
node1 {
|
||||
compatible = "on-bus", "on-any-bus";
|
||||
nested {
|
||||
compatible = "on-bus";
|
||||
};
|
||||
};
|
||||
node2 {
|
||||
compatible = "on-any-bus", "on-bus";
|
||||
};
|
||||
};
|
||||
bar-bus {
|
||||
compatible = "bar-bus";
|
||||
node {
|
||||
compatible = "on-bus";
|
||||
};
|
||||
};
|
||||
no-bus-node {
|
||||
compatible = "on-any-bus";
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// Node with 'child-binding:' in binding (along with a recursive
|
||||
// 'child-binding:')
|
||||
//
|
||||
|
||||
child-binding {
|
||||
compatible = "top-binding";
|
||||
child-1 {
|
||||
child-prop = <1>;
|
||||
grandchild {
|
||||
grandchild-prop = <2>;
|
||||
};
|
||||
};
|
||||
child-2 {
|
||||
child-prop = <3>;
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// zephyr,user binding inference
|
||||
//
|
||||
|
||||
zephyr,user {
|
||||
boolean;
|
||||
bytes = [81 82 83];
|
||||
number = <23>;
|
||||
numbers = <1>, <2>, <3>;
|
||||
string = "text";
|
||||
strings = "a", "b", "c";
|
||||
handle = <&{/ctrl-1}>;
|
||||
phandles = <&{/ctrl-1}>, <&{/ctrl-2}>;
|
||||
phandle-array-foos = <&{/ctrl-2} 1 2>;
|
||||
};
|
||||
|
||||
//
|
||||
// For testing that neither 'include: [foo.yaml, bar.yaml]' nor
|
||||
// 'include: [bar.yaml, foo.yaml]' causes errors when one of the files
|
||||
// has 'required: true' and the other 'required: false'
|
||||
//
|
||||
|
||||
include-order {
|
||||
node-1 {
|
||||
compatible = "order-1";
|
||||
foo = <1>;
|
||||
};
|
||||
node-2 {
|
||||
compatible = "order-2";
|
||||
foo = <2>;
|
||||
};
|
||||
};
|
||||
|
||||
//
|
||||
// For testing deprecated property
|
||||
//
|
||||
test-deprecated {
|
||||
compatible = "test-deprecated";
|
||||
oldprop = <4>; /* deprecated property */
|
||||
curprop = <5>;
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// For testing deprecated features
|
||||
//
|
||||
|
||||
deprecated {
|
||||
compatible = "deprecated";
|
||||
required = <1>;
|
||||
required-2 = <2>;
|
||||
#foo-cells = <2>;
|
||||
sub-node {
|
||||
foos = <&{/deprecated} 1 2>;
|
||||
};
|
||||
};
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,588 +0,0 @@
|
||||
# Copyright (c) 2019 Nordic Semiconductor ASA
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
|
||||
import contextlib
|
||||
import io
|
||||
from logging import WARNING
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from devicetree import edtlib
|
||||
|
||||
# Test suite for edtlib.py.
|
||||
#
|
||||
# Run it using pytest (https://docs.pytest.org/en/stable/usage.html):
|
||||
#
|
||||
# $ pytest testedtlib.py
|
||||
#
|
||||
# See the comment near the top of testdtlib.py for additional pytest advice.
|
||||
#
|
||||
# test.dts is the main test file. test-bindings/ and test-bindings-2/ has
|
||||
# bindings. The tests mostly use string comparisons via the various __repr__()
|
||||
# methods.
|
||||
|
||||
HERE = os.path.dirname(__file__)
|
||||
|
||||
@contextlib.contextmanager
|
||||
def from_here():
|
||||
# Convenience hack to minimize diff from zephyr.
|
||||
cwd = os.getcwd()
|
||||
try:
|
||||
os.chdir(HERE)
|
||||
yield
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
||||
def hpath(filename):
|
||||
'''Convert 'filename' to the host path syntax.'''
|
||||
return os.fspath(Path(filename))
|
||||
|
||||
def test_warnings(caplog):
|
||||
'''Tests for situations that should cause warnings.'''
|
||||
|
||||
with from_here(): edtlib.EDT("test.dts", ["test-bindings"])
|
||||
|
||||
enums_hpath = hpath('test-bindings/enums.yaml')
|
||||
expected_warnings = [
|
||||
f"'oldprop' is marked as deprecated in 'properties:' in {hpath('test-bindings/deprecated.yaml')} for node /test-deprecated.",
|
||||
"unit address and first address in 'reg' (0x1) don't match for /reg-zero-size-cells/node",
|
||||
"unit address and first address in 'reg' (0x5) don't match for /reg-ranges/parent/node",
|
||||
"unit address and first address in 'reg' (0x30000000200000001) don't match for /reg-nested-ranges/grandparent/parent/node",
|
||||
f"compatible 'enums' in binding '{enums_hpath}' has non-tokenizable enum for property 'string-enum': 'foo bar', 'foo_bar'",
|
||||
f"compatible 'enums' in binding '{enums_hpath}' has enum for property 'tokenizable-lower-enum' that is only tokenizable in lowercase: 'bar', 'BAR'",
|
||||
]
|
||||
assert caplog.record_tuples == [('devicetree.edtlib', WARNING, warning_message)
|
||||
for warning_message in expected_warnings]
|
||||
|
||||
def test_interrupts():
|
||||
'''Tests for the interrupts property.'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
filenames = {i: hpath(f'test-bindings/interrupt-{i}-cell.yaml')
|
||||
for i in range(1, 4)}
|
||||
|
||||
assert str(edt.get_node("/interrupt-parent-test/node").interrupts) == \
|
||||
f"[<ControllerAndData, name: foo, controller: <Node /interrupt-parent-test/controller in 'test.dts', binding {filenames[3]}>, data: OrderedDict([('one', 1), ('two', 2), ('three', 3)])>, <ControllerAndData, name: bar, controller: <Node /interrupt-parent-test/controller in 'test.dts', binding {filenames[3]}>, data: OrderedDict([('one', 4), ('two', 5), ('three', 6)])>]"
|
||||
|
||||
assert str(edt.get_node("/interrupts-extended-test/node").interrupts) == \
|
||||
f"[<ControllerAndData, controller: <Node /interrupts-extended-test/controller-0 in 'test.dts', binding {filenames[1]}>, data: OrderedDict([('one', 1)])>, <ControllerAndData, controller: <Node /interrupts-extended-test/controller-1 in 'test.dts', binding {filenames[2]}>, data: OrderedDict([('one', 2), ('two', 3)])>, <ControllerAndData, controller: <Node /interrupts-extended-test/controller-2 in 'test.dts', binding {filenames[3]}>, data: OrderedDict([('one', 4), ('two', 5), ('three', 6)])>]"
|
||||
|
||||
assert str(edt.get_node("/interrupt-map-test/node@0").interrupts) == \
|
||||
f"[<ControllerAndData, controller: <Node /interrupt-map-test/controller-0 in 'test.dts', binding {filenames[1]}>, data: OrderedDict([('one', 0)])>, <ControllerAndData, controller: <Node /interrupt-map-test/controller-1 in 'test.dts', binding {filenames[2]}>, data: OrderedDict([('one', 0), ('two', 1)])>, <ControllerAndData, controller: <Node /interrupt-map-test/controller-2 in 'test.dts', binding {filenames[3]}>, data: OrderedDict([('one', 0), ('two', 0), ('three', 2)])>]"
|
||||
|
||||
assert str(edt.get_node("/interrupt-map-test/node@1").interrupts) == \
|
||||
f"[<ControllerAndData, controller: <Node /interrupt-map-test/controller-0 in 'test.dts', binding {filenames[1]}>, data: OrderedDict([('one', 3)])>, <ControllerAndData, controller: <Node /interrupt-map-test/controller-1 in 'test.dts', binding {filenames[2]}>, data: OrderedDict([('one', 0), ('two', 4)])>, <ControllerAndData, controller: <Node /interrupt-map-test/controller-2 in 'test.dts', binding {filenames[3]}>, data: OrderedDict([('one', 0), ('two', 0), ('three', 5)])>]"
|
||||
|
||||
assert str(edt.get_node("/interrupt-map-bitops-test/node@70000000E").interrupts) == \
|
||||
f"[<ControllerAndData, controller: <Node /interrupt-map-bitops-test/controller in 'test.dts', binding {filenames[2]}>, data: OrderedDict([('one', 3), ('two', 2)])>]"
|
||||
|
||||
def test_ranges():
|
||||
'''Tests for the ranges property'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
|
||||
assert str(edt.get_node("/reg-ranges/parent").ranges) == \
|
||||
"[<Range, child-bus-cells: 0x1, child-bus-addr: 0x1, parent-bus-cells: 0x2, parent-bus-addr: 0xa0000000b, length-cells 0x1, length 0x1>, <Range, child-bus-cells: 0x1, child-bus-addr: 0x2, parent-bus-cells: 0x2, parent-bus-addr: 0xc0000000d, length-cells 0x1, length 0x2>, <Range, child-bus-cells: 0x1, child-bus-addr: 0x4, parent-bus-cells: 0x2, parent-bus-addr: 0xe0000000f, length-cells 0x1, length 0x1>]"
|
||||
|
||||
assert str(edt.get_node("/reg-nested-ranges/grandparent").ranges) == \
|
||||
"[<Range, child-bus-cells: 0x2, child-bus-addr: 0x0, parent-bus-cells: 0x3, parent-bus-addr: 0x30000000000000000, length-cells 0x2, length 0x200000002>]"
|
||||
|
||||
assert str(edt.get_node("/reg-nested-ranges/grandparent/parent").ranges) == \
|
||||
"[<Range, child-bus-cells: 0x1, child-bus-addr: 0x0, parent-bus-cells: 0x2, parent-bus-addr: 0x200000000, length-cells 0x1, length 0x2>]"
|
||||
|
||||
assert str(edt.get_node("/ranges-zero-cells/node").ranges) == "[]"
|
||||
|
||||
assert str(edt.get_node("/ranges-zero-parent-cells/node").ranges) == \
|
||||
"[<Range, child-bus-cells: 0x1, child-bus-addr: 0xa, parent-bus-cells: 0x0, length-cells 0x0>, <Range, child-bus-cells: 0x1, child-bus-addr: 0x1a, parent-bus-cells: 0x0, length-cells 0x0>, <Range, child-bus-cells: 0x1, child-bus-addr: 0x2a, parent-bus-cells: 0x0, length-cells 0x0>]"
|
||||
|
||||
assert str(edt.get_node("/ranges-one-address-cells/node").ranges) == \
|
||||
"[<Range, child-bus-cells: 0x1, child-bus-addr: 0xa, parent-bus-cells: 0x0, length-cells 0x1, length 0xb>, <Range, child-bus-cells: 0x1, child-bus-addr: 0x1a, parent-bus-cells: 0x0, length-cells 0x1, length 0x1b>, <Range, child-bus-cells: 0x1, child-bus-addr: 0x2a, parent-bus-cells: 0x0, length-cells 0x1, length 0x2b>]"
|
||||
|
||||
assert str(edt.get_node("/ranges-one-address-two-size-cells/node").ranges) == \
|
||||
"[<Range, child-bus-cells: 0x1, child-bus-addr: 0xa, parent-bus-cells: 0x0, length-cells 0x2, length 0xb0000000c>, <Range, child-bus-cells: 0x1, child-bus-addr: 0x1a, parent-bus-cells: 0x0, length-cells 0x2, length 0x1b0000001c>, <Range, child-bus-cells: 0x1, child-bus-addr: 0x2a, parent-bus-cells: 0x0, length-cells 0x2, length 0x2b0000002c>]"
|
||||
|
||||
assert str(edt.get_node("/ranges-two-address-cells/node@1").ranges) == \
|
||||
"[<Range, child-bus-cells: 0x2, child-bus-addr: 0xa0000000b, parent-bus-cells: 0x1, parent-bus-addr: 0xc, length-cells 0x1, length 0xd>, <Range, child-bus-cells: 0x2, child-bus-addr: 0x1a0000001b, parent-bus-cells: 0x1, parent-bus-addr: 0x1c, length-cells 0x1, length 0x1d>, <Range, child-bus-cells: 0x2, child-bus-addr: 0x2a0000002b, parent-bus-cells: 0x1, parent-bus-addr: 0x2c, length-cells 0x1, length 0x2d>]"
|
||||
|
||||
assert str(edt.get_node("/ranges-two-address-two-size-cells/node@1").ranges) == \
|
||||
"[<Range, child-bus-cells: 0x2, child-bus-addr: 0xa0000000b, parent-bus-cells: 0x1, parent-bus-addr: 0xc, length-cells 0x2, length 0xd0000000e>, <Range, child-bus-cells: 0x2, child-bus-addr: 0x1a0000001b, parent-bus-cells: 0x1, parent-bus-addr: 0x1c, length-cells 0x2, length 0x1d0000001e>, <Range, child-bus-cells: 0x2, child-bus-addr: 0x2a0000002b, parent-bus-cells: 0x1, parent-bus-addr: 0x2c, length-cells 0x2, length 0x2d0000001d>]"
|
||||
|
||||
assert str(edt.get_node("/ranges-three-address-cells/node@1").ranges) == \
|
||||
"[<Range, child-bus-cells: 0x3, child-bus-addr: 0xa0000000b0000000c, parent-bus-cells: 0x2, parent-bus-addr: 0xd0000000e, length-cells 0x1, length 0xf>, <Range, child-bus-cells: 0x3, child-bus-addr: 0x1a0000001b0000001c, parent-bus-cells: 0x2, parent-bus-addr: 0x1d0000001e, length-cells 0x1, length 0x1f>, <Range, child-bus-cells: 0x3, child-bus-addr: 0x2a0000002b0000002c, parent-bus-cells: 0x2, parent-bus-addr: 0x2d0000002e, length-cells 0x1, length 0x2f>]"
|
||||
|
||||
assert str(edt.get_node("/ranges-three-address-two-size-cells/node@1").ranges) == \
|
||||
"[<Range, child-bus-cells: 0x3, child-bus-addr: 0xa0000000b0000000c, parent-bus-cells: 0x2, parent-bus-addr: 0xd0000000e, length-cells 0x2, length 0xf00000010>, <Range, child-bus-cells: 0x3, child-bus-addr: 0x1a0000001b0000001c, parent-bus-cells: 0x2, parent-bus-addr: 0x1d0000001e, length-cells 0x2, length 0x1f00000110>, <Range, child-bus-cells: 0x3, child-bus-addr: 0x2a0000002b0000002c, parent-bus-cells: 0x2, parent-bus-addr: 0x2d0000002e, length-cells 0x2, length 0x2f00000210>]"
|
||||
|
||||
def test_reg():
|
||||
'''Tests for the regs property'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
|
||||
assert str(edt.get_node("/reg-zero-address-cells/node").regs) == \
|
||||
"[<Register, size: 0x1>, <Register, size: 0x2>]"
|
||||
|
||||
assert str(edt.get_node("/reg-zero-size-cells/node").regs) == \
|
||||
"[<Register, addr: 0x1>, <Register, addr: 0x2>]"
|
||||
|
||||
assert str(edt.get_node("/reg-ranges/parent/node").regs) == \
|
||||
"[<Register, addr: 0x5, size: 0x1>, <Register, addr: 0xe0000000f, size: 0x1>, <Register, addr: 0xc0000000e, size: 0x1>, <Register, addr: 0xc0000000d, size: 0x1>, <Register, addr: 0xa0000000b, size: 0x1>, <Register, addr: 0x0, size: 0x1>]"
|
||||
|
||||
assert str(edt.get_node("/reg-nested-ranges/grandparent/parent/node").regs) == \
|
||||
"[<Register, addr: 0x30000000200000001, size: 0x1>]"
|
||||
|
||||
def test_pinctrl():
|
||||
'''Test 'pinctrl-<index>'.'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
|
||||
assert str(edt.get_node("/pinctrl/dev").pinctrls) == \
|
||||
"[<PinCtrl, name: zero, configuration nodes: []>, <PinCtrl, name: one, configuration nodes: [<Node /pinctrl/pincontroller/state-1 in 'test.dts', no binding>]>, <PinCtrl, name: two, configuration nodes: [<Node /pinctrl/pincontroller/state-1 in 'test.dts', no binding>, <Node /pinctrl/pincontroller/state-2 in 'test.dts', no binding>]>]"
|
||||
|
||||
def test_hierarchy():
|
||||
'''Test Node.parent and Node.children'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
|
||||
assert edt.get_node("/").parent is None
|
||||
|
||||
assert str(edt.get_node("/parent/child-1").parent) == \
|
||||
"<Node /parent in 'test.dts', no binding>"
|
||||
|
||||
assert str(edt.get_node("/parent/child-2/grandchild").parent) == \
|
||||
"<Node /parent/child-2 in 'test.dts', no binding>"
|
||||
|
||||
assert str(edt.get_node("/parent").children) == \
|
||||
"OrderedDict([('child-1', <Node /parent/child-1 in 'test.dts', no binding>), ('child-2', <Node /parent/child-2 in 'test.dts', no binding>)])"
|
||||
|
||||
assert edt.get_node("/parent/child-1").children == {}
|
||||
|
||||
def test_include():
|
||||
'''Test 'include:' and the legacy 'inherits: !include ...' in bindings'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
|
||||
assert str(edt.get_node("/binding-include").description) == \
|
||||
"Parent binding"
|
||||
|
||||
assert str(edt.get_node("/binding-include").props) == \
|
||||
"OrderedDict([('foo', <Property, name: foo, type: int, value: 0>), ('bar', <Property, name: bar, type: int, value: 1>), ('baz', <Property, name: baz, type: int, value: 2>), ('qaz', <Property, name: qaz, type: int, value: 3>)])"
|
||||
|
||||
def test_include_filters():
|
||||
'''Test property-allowlist and property-blocklist in an include.'''
|
||||
|
||||
fname2path = {'include.yaml': 'test-bindings-include/include.yaml',
|
||||
'include-2.yaml': 'test-bindings-include/include-2.yaml'}
|
||||
|
||||
with pytest.raises(edtlib.EDTError) as e:
|
||||
with from_here():
|
||||
edtlib.Binding("test-bindings-include/allow-and-blocklist.yaml", fname2path)
|
||||
assert ("should not specify both 'property-allowlist:' and 'property-blocklist:'"
|
||||
in str(e.value))
|
||||
|
||||
with pytest.raises(edtlib.EDTError) as e:
|
||||
with from_here():
|
||||
edtlib.Binding("test-bindings-include/allow-and-blocklist-child.yaml", fname2path)
|
||||
assert ("should not specify both 'property-allowlist:' and 'property-blocklist:'"
|
||||
in str(e.value))
|
||||
|
||||
with pytest.raises(edtlib.EDTError) as e:
|
||||
with from_here():
|
||||
edtlib.Binding("test-bindings-include/allow-not-list.yaml", fname2path)
|
||||
value_str = str(e.value)
|
||||
assert value_str.startswith("'property-allowlist' value")
|
||||
assert value_str.endswith("should be a list")
|
||||
|
||||
with pytest.raises(edtlib.EDTError) as e:
|
||||
with from_here():
|
||||
edtlib.Binding("test-bindings-include/block-not-list.yaml", fname2path)
|
||||
value_str = str(e.value)
|
||||
assert value_str.startswith("'property-blocklist' value")
|
||||
assert value_str.endswith("should be a list")
|
||||
|
||||
with pytest.raises(edtlib.EDTError) as e:
|
||||
with from_here():
|
||||
binding = edtlib.Binding("test-bindings-include/include-invalid-keys.yaml", fname2path)
|
||||
value_str = str(e.value)
|
||||
assert value_str.startswith(
|
||||
"'include:' in test-bindings-include/include-invalid-keys.yaml should not have these "
|
||||
"unexpected contents: ")
|
||||
assert 'bad-key-1' in value_str
|
||||
assert 'bad-key-2' in value_str
|
||||
|
||||
with pytest.raises(edtlib.EDTError) as e:
|
||||
with from_here():
|
||||
binding = edtlib.Binding("test-bindings-include/include-invalid-type.yaml", fname2path)
|
||||
value_str = str(e.value)
|
||||
assert value_str.startswith(
|
||||
"'include:' in test-bindings-include/include-invalid-type.yaml "
|
||||
"should be a string or list, but has type ")
|
||||
|
||||
with pytest.raises(edtlib.EDTError) as e:
|
||||
with from_here():
|
||||
binding = edtlib.Binding("test-bindings-include/include-no-name.yaml", fname2path)
|
||||
value_str = str(e.value)
|
||||
assert value_str.startswith("'include:' element")
|
||||
assert value_str.endswith(
|
||||
"in test-bindings-include/include-no-name.yaml should have a 'name' key")
|
||||
|
||||
with from_here():
|
||||
binding = edtlib.Binding("test-bindings-include/allowlist.yaml", fname2path)
|
||||
assert set(binding.prop2specs.keys()) == {'x'} # 'x' is allowed
|
||||
|
||||
binding = edtlib.Binding("test-bindings-include/empty-allowlist.yaml", fname2path)
|
||||
assert set(binding.prop2specs.keys()) == set() # nothing is allowed
|
||||
|
||||
binding = edtlib.Binding("test-bindings-include/blocklist.yaml", fname2path)
|
||||
assert set(binding.prop2specs.keys()) == {'y', 'z'} # 'x' is blocked
|
||||
|
||||
binding = edtlib.Binding("test-bindings-include/empty-blocklist.yaml", fname2path)
|
||||
assert set(binding.prop2specs.keys()) == {'x', 'y', 'z'} # nothing is blocked
|
||||
|
||||
binding = edtlib.Binding("test-bindings-include/intermixed.yaml", fname2path)
|
||||
assert set(binding.prop2specs.keys()) == {'x', 'a'}
|
||||
|
||||
binding = edtlib.Binding("test-bindings-include/include-no-list.yaml", fname2path)
|
||||
assert set(binding.prop2specs.keys()) == {'x', 'y', 'z'}
|
||||
|
||||
binding = edtlib.Binding("test-bindings-include/filter-child-bindings.yaml", fname2path)
|
||||
child = binding.child_binding
|
||||
grandchild = child.child_binding
|
||||
assert set(binding.prop2specs.keys()) == {'x'}
|
||||
assert set(child.prop2specs.keys()) == {'child-prop-2'}
|
||||
assert set(grandchild.prop2specs.keys()) == {'grandchild-prop-1'}
|
||||
|
||||
|
||||
def test_bus():
|
||||
'''Test 'bus:' and 'on-bus:' in bindings'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
|
||||
assert edt.get_node("/buses/foo-bus").bus == "foo"
|
||||
|
||||
# foo-bus does not itself appear on a bus
|
||||
assert edt.get_node("/buses/foo-bus").on_bus is None
|
||||
assert edt.get_node("/buses/foo-bus").bus_node is None
|
||||
|
||||
# foo-bus/node1 is not a bus node...
|
||||
assert edt.get_node("/buses/foo-bus/node1").bus is None
|
||||
# ...but is on a bus
|
||||
assert edt.get_node("/buses/foo-bus/node1").on_bus == "foo"
|
||||
assert edt.get_node("/buses/foo-bus/node1").bus_node.path == \
|
||||
"/buses/foo-bus"
|
||||
|
||||
# foo-bus/node2 is not a bus node...
|
||||
assert edt.get_node("/buses/foo-bus/node2").bus is None
|
||||
# ...but is on a bus
|
||||
assert edt.get_node("/buses/foo-bus/node2").on_bus == "foo"
|
||||
|
||||
# no-bus-node is not a bus node...
|
||||
assert edt.get_node("/buses/no-bus-node").bus is None
|
||||
# ... and is not on a bus
|
||||
assert edt.get_node("/buses/no-bus-node").on_bus is None
|
||||
|
||||
# Same compatible string, but different bindings from being on different
|
||||
# buses
|
||||
assert str(edt.get_node("/buses/foo-bus/node1").binding_path) == \
|
||||
hpath("test-bindings/device-on-foo-bus.yaml")
|
||||
assert str(edt.get_node("/buses/foo-bus/node2").binding_path) == \
|
||||
hpath("test-bindings/device-on-any-bus.yaml")
|
||||
assert str(edt.get_node("/buses/bar-bus/node").binding_path) == \
|
||||
hpath("test-bindings/device-on-bar-bus.yaml")
|
||||
assert str(edt.get_node("/buses/no-bus-node").binding_path) == \
|
||||
hpath("test-bindings/device-on-any-bus.yaml")
|
||||
|
||||
# foo-bus/node/nested also appears on the foo-bus bus
|
||||
assert edt.get_node("/buses/foo-bus/node1/nested").on_bus == "foo"
|
||||
assert str(edt.get_node("/buses/foo-bus/node1/nested").binding_path) == \
|
||||
hpath("test-bindings/device-on-foo-bus.yaml")
|
||||
|
||||
def test_child_binding():
|
||||
'''Test 'child-binding:' in bindings'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
child1 = edt.get_node("/child-binding/child-1")
|
||||
child2 = edt.get_node("/child-binding/child-2")
|
||||
grandchild = edt.get_node("/child-binding/child-1/grandchild")
|
||||
|
||||
assert str(child1.binding_path) == hpath("test-bindings/child-binding.yaml")
|
||||
assert str(child1.description) == "child node"
|
||||
assert str(child1.props) == "OrderedDict([('child-prop', <Property, name: child-prop, type: int, value: 1>)])"
|
||||
|
||||
assert str(child2.binding_path) == hpath("test-bindings/child-binding.yaml")
|
||||
assert str(child2.description) == "child node"
|
||||
assert str(child2.props) == "OrderedDict([('child-prop', <Property, name: child-prop, type: int, value: 3>)])"
|
||||
|
||||
assert str(grandchild.binding_path) == hpath("test-bindings/child-binding.yaml")
|
||||
assert str(grandchild.description) == "grandchild node"
|
||||
assert str(grandchild.props) == "OrderedDict([('grandchild-prop', <Property, name: grandchild-prop, type: int, value: 2>)])"
|
||||
|
||||
with from_here():
|
||||
binding_file = Path("test-bindings/child-binding.yaml").resolve()
|
||||
top = edtlib.Binding(binding_file, {})
|
||||
child = top.child_binding
|
||||
assert Path(top.path) == binding_file
|
||||
assert Path(child.path) == binding_file
|
||||
assert top.compatible == 'top-binding'
|
||||
assert child.compatible is None
|
||||
|
||||
with from_here():
|
||||
binding_file = Path("test-bindings/child-binding-with-compat.yaml").resolve()
|
||||
top = edtlib.Binding(binding_file, {})
|
||||
child = top.child_binding
|
||||
assert Path(top.path) == binding_file
|
||||
assert Path(child.path) == binding_file
|
||||
assert top.compatible == 'top-binding-with-compat'
|
||||
assert child.compatible == 'child-compat'
|
||||
|
||||
def test_props():
|
||||
'''Test Node.props (derived from DT and 'properties:' in the binding)'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
filenames = {i: hpath(f'test-bindings/phandle-array-controller-{i}.yaml')
|
||||
for i in range(0, 4)}
|
||||
|
||||
assert str(edt.get_node("/props").props["int"]) == \
|
||||
"<Property, name: int, type: int, value: 1>"
|
||||
|
||||
assert str(edt.get_node("/props").props["existent-boolean"]) == \
|
||||
"<Property, name: existent-boolean, type: boolean, value: True>"
|
||||
|
||||
assert str(edt.get_node("/props").props["nonexistent-boolean"]) == \
|
||||
"<Property, name: nonexistent-boolean, type: boolean, value: False>"
|
||||
|
||||
assert str(edt.get_node("/props").props["array"]) == \
|
||||
"<Property, name: array, type: array, value: [1, 2, 3]>"
|
||||
|
||||
assert str(edt.get_node("/props").props["uint8-array"]) == \
|
||||
r"<Property, name: uint8-array, type: uint8-array, value: b'\x124'>"
|
||||
|
||||
assert str(edt.get_node("/props").props["string"]) == \
|
||||
"<Property, name: string, type: string, value: 'foo'>"
|
||||
|
||||
assert str(edt.get_node("/props").props["string-array"]) == \
|
||||
"<Property, name: string-array, type: string-array, value: ['foo', 'bar', 'baz']>"
|
||||
|
||||
assert str(edt.get_node("/props").props["phandle-ref"]) == \
|
||||
f"<Property, name: phandle-ref, type: phandle, value: <Node /ctrl-1 in 'test.dts', binding {filenames[1]}>>"
|
||||
|
||||
assert str(edt.get_node("/props").props["phandle-refs"]) == \
|
||||
f"<Property, name: phandle-refs, type: phandles, value: [<Node /ctrl-1 in 'test.dts', binding {filenames[1]}>, <Node /ctrl-2 in 'test.dts', binding {filenames[2]}>]>"
|
||||
|
||||
assert str(edt.get_node("/props").props["phandle-array-foos"]) == \
|
||||
f"<Property, name: phandle-array-foos, type: phandle-array, value: [<ControllerAndData, controller: <Node /ctrl-1 in 'test.dts', binding {filenames[1]}>, data: OrderedDict([('one', 1)])>, <ControllerAndData, controller: <Node /ctrl-2 in 'test.dts', binding {filenames[2]}>, data: OrderedDict([('one', 2), ('two', 3)])>]>"
|
||||
|
||||
assert str(edt.get_node("/props-2").props["phandle-array-foos"]) == \
|
||||
("<Property, name: phandle-array-foos, type: phandle-array, value: ["
|
||||
f"<ControllerAndData, name: a, controller: <Node /ctrl-0-1 in 'test.dts', binding {filenames[0]}>, data: OrderedDict()>, "
|
||||
"None, "
|
||||
f"<ControllerAndData, name: b, controller: <Node /ctrl-0-2 in 'test.dts', binding {filenames[0]}>, data: OrderedDict()>]>")
|
||||
|
||||
assert str(edt.get_node("/props").props["foo-gpios"]) == \
|
||||
f"<Property, name: foo-gpios, type: phandle-array, value: [<ControllerAndData, controller: <Node /ctrl-1 in 'test.dts', binding {filenames[1]}>, data: OrderedDict([('gpio-one', 1)])>]>"
|
||||
|
||||
assert str(edt.get_node("/props").props["path"]) == \
|
||||
f"<Property, name: path, type: path, value: <Node /ctrl-1 in 'test.dts', binding {filenames[1]}>>"
|
||||
|
||||
def test_nexus():
|
||||
'''Test <prefix>-map via gpio-map (the most common case).'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
filename = hpath('test-bindings/gpio-dst.yaml')
|
||||
|
||||
assert str(edt.get_node("/gpio-map/source").props["foo-gpios"]) == \
|
||||
f"<Property, name: foo-gpios, type: phandle-array, value: [<ControllerAndData, controller: <Node /gpio-map/destination in 'test.dts', binding {filename}>, data: OrderedDict([('val', 6)])>, <ControllerAndData, controller: <Node /gpio-map/destination in 'test.dts', binding {filename}>, data: OrderedDict([('val', 5)])>]>"
|
||||
|
||||
assert str(edt.get_node("/gpio-map/source").props["foo-gpios"].val[0].basename) == f"gpio"
|
||||
|
||||
def test_prop_defaults():
|
||||
'''Test property default values given in bindings'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
|
||||
assert str(edt.get_node("/defaults").props) == \
|
||||
r"OrderedDict([('int', <Property, name: int, type: int, value: 123>), ('array', <Property, name: array, type: array, value: [1, 2, 3]>), ('uint8-array', <Property, name: uint8-array, type: uint8-array, value: b'\x89\xab\xcd'>), ('string', <Property, name: string, type: string, value: 'hello'>), ('string-array', <Property, name: string-array, type: string-array, value: ['hello', 'there']>), ('default-not-used', <Property, name: default-not-used, type: int, value: 234>)])"
|
||||
|
||||
def test_prop_enums():
|
||||
'''test properties with enum: in the binding'''
|
||||
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"])
|
||||
props = edt.get_node('/enums').props
|
||||
int_enum = props['int-enum']
|
||||
string_enum = props['string-enum']
|
||||
tokenizable_enum = props['tokenizable-enum']
|
||||
tokenizable_lower_enum = props['tokenizable-lower-enum']
|
||||
no_enum = props['no-enum']
|
||||
|
||||
assert int_enum.val == 1
|
||||
assert int_enum.enum_index == 0
|
||||
assert not int_enum.spec.enum_tokenizable
|
||||
assert not int_enum.spec.enum_upper_tokenizable
|
||||
|
||||
assert string_enum.val == 'foo_bar'
|
||||
assert string_enum.enum_index == 1
|
||||
assert not string_enum.spec.enum_tokenizable
|
||||
assert not string_enum.spec.enum_upper_tokenizable
|
||||
|
||||
assert tokenizable_enum.val == '123 is ok'
|
||||
assert tokenizable_enum.val_as_token == '123_is_ok'
|
||||
assert tokenizable_enum.enum_index == 2
|
||||
assert tokenizable_enum.spec.enum_tokenizable
|
||||
assert tokenizable_enum.spec.enum_upper_tokenizable
|
||||
|
||||
assert tokenizable_lower_enum.val == 'bar'
|
||||
assert tokenizable_lower_enum.val_as_token == 'bar'
|
||||
assert tokenizable_lower_enum.enum_index == 0
|
||||
assert tokenizable_lower_enum.spec.enum_tokenizable
|
||||
assert not tokenizable_lower_enum.spec.enum_upper_tokenizable
|
||||
|
||||
assert no_enum.enum_index is None
|
||||
assert not no_enum.spec.enum_tokenizable
|
||||
assert not no_enum.spec.enum_upper_tokenizable
|
||||
|
||||
def test_binding_inference():
|
||||
'''Test inferred bindings for special zephyr-specific nodes.'''
|
||||
warnings = io.StringIO()
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"], warnings)
|
||||
|
||||
assert str(edt.get_node("/zephyr,user").props) == r"OrderedDict()"
|
||||
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test.dts", ["test-bindings"], warnings,
|
||||
infer_binding_for_paths=["/zephyr,user"])
|
||||
filenames = {i: hpath(f'test-bindings/phandle-array-controller-{i}.yaml')
|
||||
for i in range(1, 3)}
|
||||
|
||||
assert str(edt.get_node("/zephyr,user").props) == \
|
||||
rf"OrderedDict([('boolean', <Property, name: boolean, type: boolean, value: True>), ('bytes', <Property, name: bytes, type: uint8-array, value: b'\x81\x82\x83'>), ('number', <Property, name: number, type: int, value: 23>), ('numbers', <Property, name: numbers, type: array, value: [1, 2, 3]>), ('string', <Property, name: string, type: string, value: 'text'>), ('strings', <Property, name: strings, type: string-array, value: ['a', 'b', 'c']>), ('handle', <Property, name: handle, type: phandle, value: <Node /ctrl-1 in 'test.dts', binding {filenames[1]}>>), ('phandles', <Property, name: phandles, type: phandles, value: [<Node /ctrl-1 in 'test.dts', binding {filenames[1]}>, <Node /ctrl-2 in 'test.dts', binding {filenames[2]}>]>), ('phandle-array-foos', <Property, name: phandle-array-foos, type: phandle-array, value: [<ControllerAndData, controller: <Node /ctrl-2 in 'test.dts', binding {filenames[2]}>, data: OrderedDict([('one', 1), ('two', 2)])>]>)])"
|
||||
|
||||
def test_multi_bindings():
|
||||
'''Test having multiple directories with bindings'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test-multidir.dts", ["test-bindings", "test-bindings-2"])
|
||||
|
||||
assert str(edt.get_node("/in-dir-1").binding_path) == \
|
||||
hpath("test-bindings/multidir.yaml")
|
||||
|
||||
assert str(edt.get_node("/in-dir-2").binding_path) == \
|
||||
hpath("test-bindings-2/multidir.yaml")
|
||||
|
||||
def test_dependencies():
|
||||
''''Test dependency relations'''
|
||||
with from_here():
|
||||
edt = edtlib.EDT("test-multidir.dts", ["test-bindings", "test-bindings-2"])
|
||||
|
||||
assert edt.get_node("/").dep_ordinal == 0
|
||||
assert edt.get_node("/in-dir-1").dep_ordinal == 1
|
||||
assert edt.get_node("/") in edt.get_node("/in-dir-1").depends_on
|
||||
assert edt.get_node("/in-dir-1") in edt.get_node("/").required_by
|
||||
|
||||
def test_slice_errs(tmp_path):
|
||||
'''Test error messages from the internal _slice() helper'''
|
||||
|
||||
dts_file = tmp_path / "error.dts"
|
||||
|
||||
verify_error("""
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <2>;
|
||||
|
||||
sub {
|
||||
reg = <3>;
|
||||
};
|
||||
};
|
||||
""",
|
||||
dts_file,
|
||||
f"'reg' property in <Node /sub in '{dts_file}'> has length 4, which is not evenly divisible by 12 (= 4*(<#address-cells> (= 1) + <#size-cells> (= 2))). Note that #*-cells properties come either from the parent node or from the controller (in the case of 'interrupts').")
|
||||
|
||||
verify_error("""
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
sub {
|
||||
interrupts = <1>;
|
||||
interrupt-parent = < &{/controller} >;
|
||||
};
|
||||
controller {
|
||||
interrupt-controller;
|
||||
#interrupt-cells = <2>;
|
||||
};
|
||||
};
|
||||
""",
|
||||
dts_file,
|
||||
f"'interrupts' property in <Node /sub in '{dts_file}'> has length 4, which is not evenly divisible by 8 (= 4*<#interrupt-cells>). Note that #*-cells properties come either from the parent node or from the controller (in the case of 'interrupts').")
|
||||
|
||||
verify_error("""
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
#address-cells = <1>;
|
||||
|
||||
sub-1 {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <3>;
|
||||
ranges = <4 5>;
|
||||
|
||||
sub-2 {
|
||||
reg = <1 2 3 4 5>;
|
||||
};
|
||||
};
|
||||
};
|
||||
""",
|
||||
dts_file,
|
||||
f"'ranges' property in <Node /sub-1 in '{dts_file}'> has length 8, which is not evenly divisible by 24 (= 4*(<#address-cells> (= 2) + <#address-cells for parent> (= 1) + <#size-cells> (= 3))). Note that #*-cells properties come either from the parent node or from the controller (in the case of 'interrupts').")
|
||||
|
||||
def test_bad_compatible(tmp_path):
|
||||
# An invalid compatible should cause an error, even on a node with
|
||||
# no binding.
|
||||
|
||||
dts_file = tmp_path / "error.dts"
|
||||
|
||||
verify_error("""
|
||||
/dts-v1/;
|
||||
|
||||
/ {
|
||||
foo {
|
||||
compatible = "no, whitespace";
|
||||
};
|
||||
};
|
||||
""",
|
||||
dts_file,
|
||||
r"node '/foo' compatible 'no, whitespace' must match this regular expression: '^[a-zA-Z][a-zA-Z0-9,+\-._]+$'")
|
||||
|
||||
def test_wrong_props():
|
||||
'''Test Node.wrong_props (derived from DT and 'properties:' in the binding)'''
|
||||
|
||||
with from_here():
|
||||
with pytest.raises(edtlib.EDTError) as e:
|
||||
edtlib.Binding("test-wrong-bindings/wrong-specifier-space-type.yaml", None)
|
||||
assert ("'specifier-space' in 'properties: wrong-type-for-specifier-space' has type 'phandle', expected 'phandle-array'"
|
||||
in str(e.value))
|
||||
|
||||
with pytest.raises(edtlib.EDTError) as e:
|
||||
edtlib.Binding("test-wrong-bindings/wrong-phandle-array-name.yaml", None)
|
||||
value_str = str(e.value)
|
||||
assert value_str.startswith("'wrong-phandle-array-name' in 'properties:'")
|
||||
assert value_str.endswith("but no 'specifier-space' was provided.")
|
||||
|
||||
|
||||
def verify_error(dts, dts_file, expected_err):
|
||||
# Verifies that parsing a file 'dts_file' with the contents 'dts'
|
||||
# (a string) raises an EDTError with the message 'expected_err'.
|
||||
#
|
||||
# The path 'dts_file' is written with the string 'dts' before the
|
||||
# test is run.
|
||||
|
||||
with open(dts_file, "w", encoding="utf-8") as f:
|
||||
f.write(dts)
|
||||
f.flush() # Can't have unbuffered text IO, so flush() instead
|
||||
|
||||
with pytest.raises(edtlib.EDTError) as e:
|
||||
edtlib.EDT(dts_file, [])
|
||||
|
||||
assert str(e.value) == expected_err
|
||||
@@ -1,19 +0,0 @@
|
||||
[tox]
|
||||
envlist=py3
|
||||
|
||||
[testenv]
|
||||
deps =
|
||||
setuptools-scm
|
||||
pytest
|
||||
types-PyYAML
|
||||
mypy
|
||||
setenv =
|
||||
TOXTEMPDIR={envtmpdir}
|
||||
commands =
|
||||
python -m pytest {posargs:tests}
|
||||
python -m mypy --config-file={toxinidir}/tox.ini --package=devicetree
|
||||
|
||||
[mypy]
|
||||
mypy_path=src
|
||||
ignore_missing_imports=True
|
||||
|
||||
@@ -10,7 +10,7 @@ extra_args=
|
||||
baudrate=921600
|
||||
device=
|
||||
ip="127.0.0.1"
|
||||
while getopts ":b:d:p:qsr:f:i:loa" opt; do
|
||||
while getopts ":b:d:p:qsr:f:i:loat" opt; do
|
||||
case $opt in
|
||||
b)
|
||||
baudrate=$OPTARG
|
||||
@@ -40,7 +40,10 @@ while getopts ":b:d:p:qsr:f:i:loa" opt; do
|
||||
extra_args="$extra_args -disponly"
|
||||
;;
|
||||
a)
|
||||
extra_args="$extra_args -fw" # aircraft
|
||||
extra_args="$extra_args -fw" # aircraft model
|
||||
;;
|
||||
t)
|
||||
extra_args="$extra_args -ts" # tailsitter model
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
|
||||
@@ -156,7 +156,6 @@ bl_update,CONFIG_SYSTEMCMDS_BL_UPDATE=y
|
||||
dmesg,CONFIG_SYSTEMCMDS_DMESG=y
|
||||
dumpfile,CONFIG_SYSTEMCMDS_DUMPFILE=y
|
||||
dyn,CONFIG_SYSTEMCMDS_DYN=y
|
||||
esc_calib,CONFIG_SYSTEMCMDS_ESC_CALIB=y
|
||||
failure,CONFIG_SYSTEMCMDS_FAILURE=y
|
||||
gpio,CONFIG_SYSTEMCMDS_GPIO=y
|
||||
hardfault_log,CONFIG_SYSTEMCMDS_HARDFAULT_LOG=y
|
||||
@@ -165,7 +164,6 @@ led_control,CONFIG_SYSTEMCMDS_LED_CONTROL=y
|
||||
mft,CONFIG_SYSTEMCMDS_MFT=y
|
||||
microbench,CONFIG_SYSTEMCMDS_MICROBENCH=y
|
||||
mixer,CONFIG_SYSTEMCMDS_MIXER=y
|
||||
motor_ramp,CONFIG_SYSTEMCMDS_MOTOR_RAMP=y
|
||||
motor_test,CONFIG_SYSTEMCMDS_MOTOR_TEST=y
|
||||
mtd,CONFIG_SYSTEMCMDS_MTD=y
|
||||
netman,CONFIG_SYSTEMCMDS_NETMAN=y
|
||||
|
||||
@@ -142,7 +142,6 @@ def get_actuator_output(yaml_config, output_functions, timer_config_file, verbos
|
||||
}
|
||||
if 'show_subgroups_if' in actuator_output_yaml:
|
||||
actuator_output['show-subgroups-if'] = actuator_output_yaml['show_subgroups_if']
|
||||
add_reverse_range_param = actuator_output_yaml.get('add_reverse_range_param', False)
|
||||
|
||||
# config parameters
|
||||
def get_config_params(param_list):
|
||||
@@ -257,14 +256,13 @@ def get_actuator_output(yaml_config, output_functions, timer_config_file, verbos
|
||||
per_channel_params.append(param)
|
||||
|
||||
|
||||
if add_reverse_range_param:
|
||||
param = {
|
||||
'label': 'Rev Range\n(for Servos)',
|
||||
'name': param_prefix+'_REV',
|
||||
'index-offset': -1,
|
||||
'show-as': 'bitset',
|
||||
}
|
||||
per_channel_params.append(param)
|
||||
param = {
|
||||
'label': 'Rev Range\n(for Servos)',
|
||||
'name': param_prefix+'_REV',
|
||||
'index-offset': -1,
|
||||
'show-as': 'bitset',
|
||||
}
|
||||
per_channel_params.append(param)
|
||||
|
||||
# TODO: support non-standard per-channel parameters
|
||||
|
||||
|
||||
@@ -178,7 +178,6 @@ def get_actuator_output_params(yaml_config, output_functions,
|
||||
all_params = {}
|
||||
group_idx = 0
|
||||
|
||||
add_reverse_range_param = yaml_config['actuator_output'].get('add_reverse_range_param', False)
|
||||
all_param_prefixes = {}
|
||||
|
||||
def add_local_param(param_name, param_def):
|
||||
@@ -299,13 +298,9 @@ Note that non-motor outputs might already be active in prearm state if COM_PREAR
|
||||
'''
|
||||
minimum_description = \
|
||||
'''Minimum output value (when not disarmed).
|
||||
|
||||
The output range can be reversed by setting Min > Max.
|
||||
'''
|
||||
maximum_description = \
|
||||
'''Maxmimum output value (when not disarmed).
|
||||
|
||||
The output range can be reversed by setting Min > Max.
|
||||
'''
|
||||
failsafe_description = \
|
||||
'''This is the output value that is set when in failsafe mode.
|
||||
@@ -346,29 +341,29 @@ When set to -1 (default), the value depends on the function (see {:}).
|
||||
}
|
||||
add_local_param(param_prefix+'_'+param_suffix+'${i}', param)
|
||||
|
||||
if add_reverse_range_param:
|
||||
for param_prefix in all_param_prefixes:
|
||||
groups = all_param_prefixes[param_prefix]
|
||||
# collect the bits
|
||||
channel_bits = {}
|
||||
for instance_start, instance_start_label, num_instances, label in groups:
|
||||
for instance in range(instance_start, instance_start+num_instances):
|
||||
instance_label = instance - instance_start + instance_start_label
|
||||
channel_bits[instance-1] = label + ' ' + str(instance_label)
|
||||
# add reverse range param
|
||||
for param_prefix in all_param_prefixes:
|
||||
groups = all_param_prefixes[param_prefix]
|
||||
# collect the bits
|
||||
channel_bits = {}
|
||||
for instance_start, instance_start_label, num_instances, label in groups:
|
||||
for instance in range(instance_start, instance_start+num_instances):
|
||||
instance_label = instance - instance_start + instance_start_label
|
||||
channel_bits[instance-1] = label + ' ' + str(instance_label)
|
||||
|
||||
param = {
|
||||
'description': {
|
||||
'short': 'Reverse Output Range for '+module_name,
|
||||
'long':
|
||||
param = {
|
||||
'description': {
|
||||
'short': 'Reverse Output Range for '+module_name,
|
||||
'long':
|
||||
'''Allows to reverse the output range for each channel.
|
||||
Note: this is only useful for servos.
|
||||
'''.format(channel_label),
|
||||
},
|
||||
'type': 'bitmask',
|
||||
'default': 0,
|
||||
'bit': channel_bits
|
||||
}
|
||||
add_local_param(param_prefix+'_REV', param)
|
||||
},
|
||||
'type': 'bitmask',
|
||||
'default': 0,
|
||||
'bit': channel_bits
|
||||
}
|
||||
add_local_param(param_prefix+'_REV', param)
|
||||
|
||||
if verbose: print('adding actuator params: {:}'.format(all_params))
|
||||
return all_params
|
||||
|
||||
@@ -48,7 +48,6 @@ echo "Installing PX4 general dependencies"
|
||||
sudo pacman -Sy --noconfirm --needed \
|
||||
astyle \
|
||||
base-devel \
|
||||
ccache \
|
||||
clang \
|
||||
cmake \
|
||||
cppcheck \
|
||||
|
||||
@@ -77,7 +77,6 @@ sudo apt-get update -y --quiet
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends install \
|
||||
astyle \
|
||||
build-essential \
|
||||
ccache \
|
||||
cmake \
|
||||
cppcheck \
|
||||
file \
|
||||
@@ -101,12 +100,6 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends i
|
||||
zip \
|
||||
;
|
||||
|
||||
if [[ "${UBUNTU_RELEASE}" == "16.04" ]]; then
|
||||
echo "Installing Ubuntu 16.04 PX4-compatible ccache version"
|
||||
wget -O /tmp/ccache_3.4.1-1_amd64.deb http://launchpadlibrarian.net/356662933/ccache_3.4.1-1_amd64.deb
|
||||
sudo dpkg -i /tmp/ccache_3.4.1-1_amd64.deb
|
||||
fi
|
||||
|
||||
# Python3 dependencies
|
||||
echo
|
||||
echo "Installing PX4 Python3 dependencies"
|
||||
|
||||
@@ -79,14 +79,12 @@ CONFIG_MODULES_VTOL_ATT_CONTROL=y
|
||||
CONFIG_SYSTEMCMDS_BL_UPDATE=y
|
||||
CONFIG_SYSTEMCMDS_ACTUATOR_TEST=y
|
||||
CONFIG_SYSTEMCMDS_DUMPFILE=y
|
||||
CONFIG_SYSTEMCMDS_ESC_CALIB=y
|
||||
CONFIG_SYSTEMCMDS_GPIO=y
|
||||
CONFIG_SYSTEMCMDS_HARDFAULT_LOG=y
|
||||
CONFIG_SYSTEMCMDS_I2CDETECT=y
|
||||
CONFIG_SYSTEMCMDS_LED_CONTROL=y
|
||||
CONFIG_SYSTEMCMDS_MFT=y
|
||||
CONFIG_SYSTEMCMDS_MIXER=y
|
||||
CONFIG_SYSTEMCMDS_MOTOR_RAMP=y
|
||||
CONFIG_SYSTEMCMDS_MOTOR_TEST=y
|
||||
CONFIG_SYSTEMCMDS_MTD=y
|
||||
CONFIG_SYSTEMCMDS_NSHTERM=y
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# board specific defaults
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
param set-default BAT1_V_DIV 10.177939394
|
||||
param set-default BAT1_A_PER_V 15.391030303
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user