mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-06-01 21:10:05 +08:00
Compare commits
283 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2057dd3381 | |||
| 771049799f | |||
| a3d5466ac3 | |||
| 4243be3a4b | |||
| af8c6d3cef | |||
| cf9584c36a | |||
| fb9de0c32a | |||
| e82c68da8b | |||
| 3de4e46cdc | |||
| 85ab62dd67 | |||
| b26ba88d40 | |||
| 5132ffc0e0 | |||
| 195082ccd1 | |||
| f0f82b6994 | |||
| e0dc8166dd | |||
| c181aefff7 | |||
| 963e5f5df9 | |||
| 991b288afb | |||
| f3bfad4e8a | |||
| 0d319f7a2f | |||
| c09f7af718 | |||
| a2fc0f7924 | |||
| ae0ba7cd98 | |||
| 083a043776 | |||
| 854d529c81 | |||
| 419c849a8e | |||
| c19ed79237 | |||
| 104ea0c53a | |||
| fc8cdb0b6f | |||
| 64276b0c8d | |||
| 939186fa7d | |||
| fc7e422821 | |||
| 92deb37f64 | |||
| c6a019a9d3 | |||
| 3358712b92 | |||
| ec441fdba6 | |||
| 3fecf8a23c | |||
| 48c32f7795 | |||
| 0c8a5b3da1 | |||
| 2761112466 | |||
| cb06f82f0f | |||
| d92244b664 | |||
| f3e2a197ad | |||
| e387f302f9 | |||
| f8a090e85e | |||
| a4206ba553 | |||
| 2b1229786e | |||
| ed475ca324 | |||
| e554f0174d | |||
| ae0bb8371d | |||
| 973116c7a4 | |||
| cd560da57c | |||
| 405852b5c8 | |||
| 5ec21835a4 | |||
| 1911ec0085 | |||
| 52a9040c62 | |||
| 955aad0dfb | |||
| d10f9030ad | |||
| 3af315f2c3 | |||
| 8eed43b515 | |||
| 367b6123e1 | |||
| f49bd9956b | |||
| 95b5bc0d84 | |||
| 70872d94c8 | |||
| 3a6ebe5fc1 | |||
| 1f9ace3901 | |||
| 999737ddd5 | |||
| ad447ab223 | |||
| 90358f078f | |||
| 463ac8e8a1 | |||
| 3862a24b8e | |||
| 3b277667ff | |||
| 274d0d65c6 | |||
| 058302ecdb | |||
| 32c53ff2dd | |||
| 9e999a39be | |||
| a2dc6e63cf | |||
| 0104b84289 | |||
| d2ce9a8560 | |||
| 70704ff9d6 | |||
| 4c75f1d505 | |||
| e1f2bff9be | |||
| 705171eb53 | |||
| 138f584e70 | |||
| 4c3234af38 | |||
| e959fcf9d1 | |||
| fe5059b0e8 | |||
| 1326c51a1c | |||
| 03c0a2d56c | |||
| 91b812fc42 | |||
| 700c13cdff | |||
| 68729e8ec0 | |||
| d181fe0cee | |||
| 76d4b6c7d0 | |||
| 7bb33e65ae | |||
| 98906c224b | |||
| 54f1e12684 | |||
| 51ceb9a85e | |||
| 714df398eb | |||
| ff4eae2c9b | |||
| d94cc1e114 | |||
| 49d9d1c987 | |||
| f499749c23 | |||
| 0ddf76ed7f | |||
| 425d03d909 | |||
| 996b01acbc | |||
| c8349811d1 | |||
| ae3070bbf1 | |||
| 3f25349eb9 | |||
| 2945ce7c87 | |||
| 82e88a9547 | |||
| d20e46567e | |||
| 1502d77df2 | |||
| 42404ade77 | |||
| 7c55229db7 | |||
| d73d8f390b | |||
| 38de07186d | |||
| b9fb8490ba | |||
| e0337a484b | |||
| 661496ab24 | |||
| 8525a8e520 | |||
| 4671a741dc | |||
| bbc2b703c3 | |||
| 8d03e71c16 | |||
| 8217e0f335 | |||
| 5ded1aedcb | |||
| 4c6e746360 | |||
| ee98a3336d | |||
| 07e6c274d5 | |||
| ed28b216c7 | |||
| 6203ad25c7 | |||
| 92769bd2b2 | |||
| 4de9c598fa | |||
| a11fe60135 | |||
| 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 |
@@ -60,6 +60,8 @@ pipeline {
|
||||
"holybro_kakutef7_default",
|
||||
"holybro_pix32v5_default",
|
||||
"matek_h743-slim",
|
||||
"matek_gnss-m9n-f4_canbootloader",
|
||||
"matek_gnss-m9n-f4_default",
|
||||
"modalai_fc-v1_default",
|
||||
"modalai_fc-v1_rtps",
|
||||
"modalai_fc-v2_default",
|
||||
|
||||
@@ -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,154 @@
|
||||
# build docker images on:
|
||||
# * every pull request
|
||||
# * push to master
|
||||
# * stable release published
|
||||
# * tag name is:
|
||||
# - commit sha if pull request
|
||||
# - 'latest' if push to master
|
||||
# - release name if release
|
||||
|
||||
# pushes to registry if:
|
||||
# * is not a pull request
|
||||
# * is master branch
|
||||
# * is the result of release
|
||||
|
||||
# builds all nuttx targets and deploys metadata
|
||||
|
||||
name: Build docker
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
set_docker_tag:
|
||||
name: Set docker tag
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
DOCKER_TAG: "px4io/px4-dev"
|
||||
outputs:
|
||||
docker_tag: ${{ steps.set-outputs.outputs.docker_tag }}
|
||||
|
||||
steps:
|
||||
- name: Set pull request docker tag
|
||||
if: github.event_name == 'pull_request'
|
||||
run: echo "DOCKER_TAG=px4io/px4-dev:${{ github.sha }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Set push docker tag
|
||||
if: github.event_name == 'push'
|
||||
run: echo "DOCKER_TAG=px4io/px4-dev:latest" >> $GITHUB_ENV
|
||||
|
||||
- name: Set release docker tag
|
||||
if: github.event_name == 'release'
|
||||
run: echo "DOCKER_TAG=px4io/px4-dev:${{ github.event.release.name }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Set docker tag outputs
|
||||
id: set-outputs
|
||||
run: echo "::set-output name=docker_tag::$DOCKER_TAG"
|
||||
|
||||
build_docker:
|
||||
name: Build Docker image
|
||||
runs-on: ubuntu-latest
|
||||
needs: set_docker_tag
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Login to Github Registry
|
||||
uses: docker/login-action@v1
|
||||
if: github.event_name == 'push'
|
||||
with:
|
||||
registry: ghrc.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Set up image builder
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Build image
|
||||
uses: docker/build-push-action@v2
|
||||
id: docker_build
|
||||
with:
|
||||
file: Tools/setup/Dockerfile
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ needs.set_docker_tag.outputs.docker_tag }}
|
||||
outputs: type=tar,dest=/tmp/px4_docker_image.tar
|
||||
|
||||
- name: Save container to artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: px4_docker_image
|
||||
path: /tmp/px4_docker_image.tar
|
||||
|
||||
- name: Push to Github Registry
|
||||
uses: docker/build-push-action@v2
|
||||
if: github.event_name == 'push'
|
||||
|
||||
- name: Image Digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
|
||||
list_targets:
|
||||
name: Generate target list
|
||||
runs-on: ubuntu-latest
|
||||
needs: build_docker
|
||||
outputs:
|
||||
matrix: ${{ steps.set-matrix.outputs.matrix }}
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.9
|
||||
|
||||
#- name: Install Python packages
|
||||
#run: pip install -r Tools/setup/requirements.txt
|
||||
#run: pip install kconfiglib
|
||||
|
||||
- id: set-matrix
|
||||
name: Get all nuttx targets
|
||||
run: echo "::set-output name=matrix::$(./Tools/generate_board_targets_json.py -a)"
|
||||
|
||||
build_px4:
|
||||
name: Build targets with Docker
|
||||
runs-on: ubuntu-latest
|
||||
needs: [list_targets, set_docker_tag]
|
||||
#strategy:
|
||||
#matrix: ${{ fromJson(needs.enumerate_targets.outputs.matrix) }}
|
||||
|
||||
steps:
|
||||
- name: Get container from artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: px4_docker_image
|
||||
path: /tmp
|
||||
|
||||
- name: Load Docker image
|
||||
run: |
|
||||
docker import /tmp/px4_docker_image.tar ${{ needs.set_docker_tag.outputs.docker_tag }}
|
||||
docker image ls -a
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Build targets
|
||||
#run: |
|
||||
#docker run --rm -w "${GITHUB_ACTION_PATH}" \
|
||||
#--env=LOCAL_USER_ID="$(id -u)" \
|
||||
#--volume=/tmp:/tmp:rw \
|
||||
#--volume=${GITHUB_ACTION_PATH}:${GITHUB_ACTION_PATH}:rw \
|
||||
#px4io/px4-dev:${{ needs.set_docker_tag.outputs.docker_tag }} /bin/bash -c "make ${{ matrix.target }}"
|
||||
|
||||
run: |
|
||||
docker run --rm -w ${{ github.workspace }} \
|
||||
--env=LOCAL_USER_ID="$(id -u)" \
|
||||
--volume=/tmp:/tmp:rw \
|
||||
--volume=${{ github.workspace }}:${{ github.workspace }}:rw \
|
||||
${{ needs.set_docker_tag.outputs.docker_tag }} /bin/bash -c "make px4_fmu-v6x"
|
||||
@@ -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".
|
||||
@@ -1,54 +0,0 @@
|
||||
name: Linux Targets
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container: px4io/px4-dev-armhf:2021-09-08
|
||||
strategy:
|
||||
matrix:
|
||||
config: [
|
||||
beaglebone_blue_default,
|
||||
emlid_navio2_default,
|
||||
px4_raspberrypi_default,
|
||||
scumaker_pilotpi_default,
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
token: ${{secrets.ACCESS_TOKEN}}
|
||||
|
||||
- name: Prepare ccache timestamp
|
||||
id: ccache_cache_timestamp
|
||||
shell: cmake -P {0}
|
||||
run: |
|
||||
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
|
||||
message("::set-output name=timestamp::${current_date}")
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: ${{matrix.config}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
|
||||
restore-keys: ${{matrix.config}}-ccache-
|
||||
- name: setup ccache
|
||||
run: |
|
||||
mkdir -p ~/.ccache
|
||||
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
|
||||
echo "compression = true" >> ~/.ccache/ccache.conf
|
||||
echo "compression_level = 6" >> ~/.ccache/ccache.conf
|
||||
echo "max_size = 100M" >> ~/.ccache/ccache.conf
|
||||
echo "hash_dir = false" >> ~/.ccache/ccache.conf
|
||||
ccache -s
|
||||
ccache -z
|
||||
|
||||
- name: make ${{matrix.config}}
|
||||
run: make ${{matrix.config}}
|
||||
- name: ccache post-run
|
||||
run: ccache -s
|
||||
@@ -1,51 +0,0 @@
|
||||
name: Linux ARM64 Targets
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container: px4io/px4-dev-aarch64:2021-09-08
|
||||
strategy:
|
||||
matrix:
|
||||
config: [
|
||||
scumaker_pilotpi_arm64,
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
token: ${{secrets.ACCESS_TOKEN}}
|
||||
|
||||
- name: Prepare ccache timestamp
|
||||
id: ccache_cache_timestamp
|
||||
shell: cmake -P {0}
|
||||
run: |
|
||||
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
|
||||
message("::set-output name=timestamp::${current_date}")
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: ${{matrix.config}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
|
||||
restore-keys: ${{matrix.config}}-ccache-
|
||||
- name: setup ccache
|
||||
run: |
|
||||
mkdir -p ~/.ccache
|
||||
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
|
||||
echo "compression = true" >> ~/.ccache/ccache.conf
|
||||
echo "compression_level = 6" >> ~/.ccache/ccache.conf
|
||||
echo "max_size = 100M" >> ~/.ccache/ccache.conf
|
||||
echo "hash_dir = false" >> ~/.ccache/ccache.conf
|
||||
ccache -s
|
||||
ccache -z
|
||||
|
||||
- name: make ${{matrix.config}}
|
||||
run: make ${{matrix.config}}
|
||||
- name: ccache post-run
|
||||
run: ccache -s
|
||||
@@ -1,118 +0,0 @@
|
||||
name: Nuttx Targets
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
pull_request:
|
||||
branches:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container: px4io/px4-dev-nuttx-focal:2021-09-08
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config: [
|
||||
airmind_mindpx-v2,
|
||||
ark_can-flow,
|
||||
ark_can-gps,
|
||||
ark_can-rtk-gps,
|
||||
atl_mantis-edu,
|
||||
av_x-v1,
|
||||
bitcraze_crazyflie,
|
||||
bitcraze_crazyflie21,
|
||||
cuav_can-gps-v1,
|
||||
cuav_nora,
|
||||
cuav_x7pro,
|
||||
cubepilot_cubeorange,
|
||||
cubepilot_cubeyellow,
|
||||
freefly_can-rtk-gps,
|
||||
holybro_can-gps-v1,
|
||||
holybro_durandal-v1,
|
||||
holybro_kakutef7,
|
||||
holybro_pix32v5,
|
||||
matek_h743-slim,
|
||||
modalai_fc-v1,
|
||||
modalai_fc-v2,
|
||||
mro_ctrl-zero-f7,
|
||||
mro_ctrl-zero-f7-oem,
|
||||
mro_ctrl-zero-h7,
|
||||
mro_ctrl-zero-h7-oem,
|
||||
mro_pixracerpro,
|
||||
mro_x21,
|
||||
mro_x21-777,
|
||||
nxp_fmuk66-e,
|
||||
nxp_fmuk66-v3,
|
||||
nxp_fmurt1062-v1,
|
||||
nxp_ucans32k146,
|
||||
omnibus_f4sd,
|
||||
raspberrypi_pico,
|
||||
px4_fmu-v2,
|
||||
px4_fmu-v3,
|
||||
px4_fmu-v4,
|
||||
px4_fmu-v4pro,
|
||||
px4_fmu-v5,
|
||||
px4_fmu-v5x,
|
||||
px4_fmu-v6u,
|
||||
px4_fmu-v6x,
|
||||
spracing_h7extreme,
|
||||
uvify_core
|
||||
]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
token: ${{secrets.ACCESS_TOKEN}}
|
||||
|
||||
- name: Prepare ccache timestamp
|
||||
id: ccache_cache_timestamp
|
||||
shell: cmake -P {0}
|
||||
run: |
|
||||
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
|
||||
message("::set-output name=timestamp::${current_date}")
|
||||
- name: ccache cache files
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.ccache
|
||||
key: ${{matrix.config}}-ccache-${{steps.ccache_cache_timestamp.outputs.timestamp}}
|
||||
restore-keys: ${{matrix.config}}-ccache-
|
||||
- name: setup ccache
|
||||
run: |
|
||||
mkdir -p ~/.ccache
|
||||
echo "base_dir = ${GITHUB_WORKSPACE}" > ~/.ccache/ccache.conf
|
||||
echo "compression = true" >> ~/.ccache/ccache.conf
|
||||
echo "compression_level = 6" >> ~/.ccache/ccache.conf
|
||||
echo "max_size = 120M" >> ~/.ccache/ccache.conf
|
||||
echo "hash_dir = false" >> ~/.ccache/ccache.conf
|
||||
ccache -s
|
||||
ccache -z
|
||||
|
||||
- name: make all_variants_${{matrix.config}}
|
||||
run: make all_variants_${{matrix.config}}
|
||||
timeout-minutes: 45
|
||||
- name: make ${{matrix.config}} bloaty_compileunits
|
||||
run: make ${{matrix.config}} bloaty_compileunits || true
|
||||
- name: make ${{matrix.config}} bloaty_inlines
|
||||
run: make ${{matrix.config}} bloaty_inlines || true
|
||||
- name: make ${{matrix.config}} bloaty_segments
|
||||
run: make ${{matrix.config}} bloaty_segments || true
|
||||
- name: make ${{matrix.config}} bloaty_symbols
|
||||
run: make ${{matrix.config}} bloaty_symbols || true
|
||||
- name: make ${{matrix.config}} bloaty_templates
|
||||
run: make ${{matrix.config}} bloaty_templates || true
|
||||
- name: make ${{matrix.config}} bloaty_ram
|
||||
run: make ${{matrix.config}} bloaty_ram || true
|
||||
- name: make ${{matrix.config}} bloaty_compare_master
|
||||
run: make ${{matrix.config}} bloaty_compare_master || true
|
||||
- name: ccache post-run
|
||||
run: ccache -s
|
||||
|
||||
- name: Upload px4 package
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: px4_package_${{matrix.config}}
|
||||
path: |
|
||||
build/**/*.px4
|
||||
build/**/*.bin
|
||||
@@ -1,11 +1,17 @@
|
||||
name: Deploy metadata for all targets
|
||||
name: Build and deploy all targets with metadata
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
create:
|
||||
tags:
|
||||
- 'v*'
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- 'release/*'
|
||||
- 'pr-metadata-test'
|
||||
- 'build_and_deploy_mix'
|
||||
|
||||
jobs:
|
||||
enumerate_targets:
|
||||
@@ -18,8 +24,8 @@ jobs:
|
||||
with:
|
||||
token: ${{secrets.ACCESS_TOKEN}}
|
||||
- id: set-matrix
|
||||
run: echo "::set-output name=matrix::$(./Tools/generate_board_targets_json.py)"
|
||||
build:
|
||||
run: echo "::set-output name=matrix::$(./Tools/generate_board_targets_json.py -a)"
|
||||
build_all:
|
||||
runs-on: ubuntu-latest
|
||||
needs: enumerate_targets
|
||||
strategy:
|
||||
@@ -34,21 +40,4 @@ jobs:
|
||||
run: make ${{matrix.target}}
|
||||
|
||||
- name: parameter & events metadata
|
||||
run: |
|
||||
make ${{matrix.target}} ver_gen events_json actuators_json
|
||||
./src/lib/version/get_git_tag_or_branch_version.sh build/${{ matrix.target }} >> $GITHUB_ENV
|
||||
cd build/${{ matrix.target }}
|
||||
mkdir _metadata || true
|
||||
cp parameters.* events/*.xz actuators.json* _metadata
|
||||
|
||||
- uses: jakejarvis/s3-sync-action@master
|
||||
with:
|
||||
args: --acl public-read
|
||||
env:
|
||||
AWS_S3_BUCKET: 'px4-travis'
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||
AWS_REGION: 'us-west-1'
|
||||
SOURCE_DIR: 'build/${{ matrix.target }}/_metadata/'
|
||||
DEST_DIR: 'Firmware/${{ env.version }}/${{ matrix.target }}/'
|
||||
|
||||
run: make ${{matrix.target}} ver_gen events_json actuators_json
|
||||
|
||||
@@ -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
+10
@@ -196,6 +196,16 @@ CONFIG:
|
||||
buildType: MinSizeRel
|
||||
settings:
|
||||
CONFIG: matek_h743-slim_default
|
||||
matek_gnss-m9n-f4_canbootloader:
|
||||
short: matek_gnss-m9n-f4_canbootloader
|
||||
buildType: MiniSizeRel
|
||||
settings:
|
||||
CONFIG: matek_m9nf4can_canbootloader
|
||||
matek_gnss-m9n-f4_default:
|
||||
short: matek_gnss-m9n-f4_default
|
||||
buildType: MiniSizeRel
|
||||
settings:
|
||||
CONFIG: matek_gnss-m9n-f4_default
|
||||
modalai_fc-v1_default:
|
||||
short: modalai_fc-v1
|
||||
buildType: MinSizeRel
|
||||
|
||||
+6
-2
@@ -125,6 +125,11 @@ define_property(GLOBAL PROPERTY PX4_MODULE_LIBRARIES
|
||||
FULL_DOCS "List of all PX4 module libraries"
|
||||
)
|
||||
|
||||
define_property(GLOBAL PROPERTY PX4_KERNEL_MODULE_LIBRARIES
|
||||
BRIEF_DOCS "PX4 kernel side module libs"
|
||||
FULL_DOCS "List of all PX4 kernel module libraries"
|
||||
)
|
||||
|
||||
define_property(GLOBAL PROPERTY PX4_MODULE_PATHS
|
||||
BRIEF_DOCS "PX4 module paths"
|
||||
FULL_DOCS "List of paths to all PX4 modules"
|
||||
@@ -142,6 +147,7 @@ set(CONFIG "px4_sitl_default" CACHE STRING "desired configuration")
|
||||
|
||||
include(px4_add_module)
|
||||
set(config_module_list)
|
||||
set(config_kernel_list)
|
||||
|
||||
# Find Python
|
||||
# If using catkin, Python 2 is found since it points
|
||||
@@ -413,8 +419,6 @@ add_subdirectory(src/lib EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(platforms/${PX4_PLATFORM}/src/px4)
|
||||
add_subdirectory(platforms EXCLUDE_FROM_ALL)
|
||||
|
||||
include(dts)
|
||||
|
||||
if(EXISTS "${PX4_BOARD_DIR}/CMakeLists.txt")
|
||||
add_subdirectory(${PX4_BOARD_DIR})
|
||||
endif()
|
||||
|
||||
@@ -118,6 +118,11 @@ config BOARD_CRYPTO
|
||||
help
|
||||
Enable PX4 Crypto Support. Select the implementation under drivers
|
||||
|
||||
config BOARD_PROTECTED
|
||||
bool "Memory protection"
|
||||
help
|
||||
Enable memory protection via MPU/MMU
|
||||
|
||||
menu "Serial ports"
|
||||
|
||||
config BOARD_SERIAL_URT6
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -10,7 +10,7 @@ fi
|
||||
|
||||
if [ ! -f replay_params.txt ]; then
|
||||
echo "Creating $(pwd)/replay_params.txt"
|
||||
ulog_params -i "${replay}" -d ' ' | grep -e '^EKF2' > replay_params.txt
|
||||
ulog_params -i "${replay}" -l ' ' | grep -e '^EKF2' > replay_params.txt
|
||||
fi
|
||||
|
||||
publisher_rules_file="orb_publisher.rules"
|
||||
@@ -21,6 +21,7 @@ ignore_others: false
|
||||
EOF
|
||||
|
||||
param set SDLOG_DIRS_MAX 7
|
||||
param set SDLOG_PROFILE 3
|
||||
|
||||
# apply all params before ekf starts, as some params cannot be changed after startup
|
||||
replay tryapplyparams
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -130,6 +130,13 @@ then
|
||||
fi
|
||||
fi
|
||||
|
||||
# SHT3x temperature and hygrometer sensor, external I2C
|
||||
if param compare -s SENS_EN_SHT3X 1
|
||||
then
|
||||
sht3x start -X
|
||||
sht3x start -X -a 0x45
|
||||
fi
|
||||
|
||||
# TE MS4525 differential pressure sensor external I2C
|
||||
if param compare -s SENS_EN_MS4525 1
|
||||
then
|
||||
|
||||
@@ -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 \
|
||||
|
||||
+15
-52
@@ -1,35 +1,5 @@
|
||||
#! /bin/bash
|
||||
|
||||
if [ -z ${PX4_DOCKER_REPO+x} ]; then
|
||||
echo "guessing PX4_DOCKER_REPO based on input";
|
||||
if [[ $@ =~ .*px4_fmu.* ]]; then
|
||||
# nuttx-px4fmu-v{1,2,3,4,5}
|
||||
PX4_DOCKER_REPO="px4io/px4-dev-nuttx-focal:2021-09-08"
|
||||
elif [[ $@ =~ .*navio2.* ]] || [[ $@ =~ .*raspberry.* ]] || [[ $@ =~ .*beaglebone.* ]] || [[ $@ =~ .*pilotpi.default ]]; then
|
||||
# beaglebone_blue_default, emlid_navio2_default, px4_raspberrypi_default, scumaker_pilotpi_default
|
||||
PX4_DOCKER_REPO="px4io/px4-dev-armhf:2021-08-18"
|
||||
elif [[ $@ =~ .*pilotpi.arm64 ]]; then
|
||||
# scumaker_pilotpi_arm64
|
||||
PX4_DOCKER_REPO="px4io/px4-dev-aarch64:latest"
|
||||
elif [[ $@ =~ .*navio2.* ]] || [[ $@ =~ .*raspberry.* ]] || [[ $@ =~ .*bebop.* ]]; then
|
||||
# posix_rpi_cross, posix_bebop_default
|
||||
PX4_DOCKER_REPO="px4io/px4-dev-armhf:2021-08-18"
|
||||
elif [[ $@ =~ .*clang.* ]] || [[ $@ =~ .*scan-build.* ]]; then
|
||||
# clang tools
|
||||
PX4_DOCKER_REPO="px4io/px4-dev-clang:2021-02-04"
|
||||
elif [[ $@ =~ .*tests* ]]; then
|
||||
# run all tests with simulation
|
||||
PX4_DOCKER_REPO="px4io/px4-dev-simulation-bionic:2021-12-11"
|
||||
fi
|
||||
else
|
||||
echo "PX4_DOCKER_REPO is set to '$PX4_DOCKER_REPO'";
|
||||
fi
|
||||
|
||||
# otherwise default to nuttx
|
||||
if [ -z ${PX4_DOCKER_REPO+x} ]; then
|
||||
PX4_DOCKER_REPO="px4io/px4-dev-nuttx-focal:2021-09-08"
|
||||
fi
|
||||
|
||||
# docker hygiene
|
||||
|
||||
#Delete all stopped containers (including data-only containers)
|
||||
@@ -38,30 +8,23 @@ fi
|
||||
#Delete all 'untagged/dangling' (<none>) images
|
||||
#docker rmi $(docker images -q -f dangling=true)
|
||||
|
||||
echo "PX4_DOCKER_REPO: $PX4_DOCKER_REPO";
|
||||
if [[ -z "${DOCKER_TAG}" ]]; then
|
||||
TAG_NAME=""
|
||||
else
|
||||
TAG_NAME=":${DOCKER_TAG}"
|
||||
fi
|
||||
|
||||
PX4_DOCKER_REPO="px4io/px4-dev$TAG_NAME"
|
||||
|
||||
echo $PX4_DOCKER_REPO
|
||||
|
||||
PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
SRC_DIR=$PWD/../
|
||||
|
||||
CCACHE_DIR=${HOME}/.ccache
|
||||
mkdir -p "${CCACHE_DIR}"
|
||||
|
||||
docker run -it --rm -w "${SRC_DIR}" \
|
||||
--env=AWS_ACCESS_KEY_ID \
|
||||
--env=AWS_SECRET_ACCESS_KEY \
|
||||
--env=BRANCH_NAME \
|
||||
--env=CCACHE_DIR="${CCACHE_DIR}" \
|
||||
--env=CI \
|
||||
--env=CODECOV_TOKEN \
|
||||
--env=COVERALLS_REPO_TOKEN \
|
||||
--env=LOCAL_USER_ID="$(id -u)" \
|
||||
--env=PX4_ASAN \
|
||||
--env=PX4_MSAN \
|
||||
--env=PX4_TSAN \
|
||||
--env=PX4_UBSAN \
|
||||
--env=TRAVIS_BRANCH \
|
||||
--env=TRAVIS_BUILD_ID \
|
||||
--publish 14556:14556/udp \
|
||||
--volume=${CCACHE_DIR}:${CCACHE_DIR}:rw \
|
||||
--volume=${SRC_DIR}:${SRC_DIR}:rw \
|
||||
${PX4_DOCKER_REPO} /bin/bash -c "$1 $2 $3"
|
||||
--env=LOCAL_USER_ID="$(id -u)" \
|
||||
--publish 14556:14556/udp \
|
||||
--volume=/tmp/.X11-unix:/tmp/.X11-unix \
|
||||
--volume=/tmp:/tmp:rw \
|
||||
--volume=${SRC_DIR}:${SRC_DIR}:rw \
|
||||
${PX4_DOCKER_REPO} /bin/bash -c "$1 $2 $3"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -39,7 +39,7 @@ function spawn_model() {
|
||||
|
||||
echo "Spawning ${MODEL}_${N} at ${X} ${Y}"
|
||||
|
||||
gz model --spawn-file=/tmp/${MODEL}_${N}.sdf --model-name=${MODEL}_${N} -x ${X} -y ${Y} -z 0.0
|
||||
gz model --spawn-file=/tmp/${MODEL}_${N}.sdf --model-name=${MODEL}_${N} -x ${X} -y ${Y} -z 0.83
|
||||
|
||||
popd &>/dev/null
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user