diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe0f5cd67..b27c260b1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,6 +54,26 @@ jobs: run: | echo EXTRA_ZEPHYR_MODULES="$(pwd)/$MODULE_PATH" >> $GITHUB_ENV + - name: Fetch the Arduino API + run: | + west blobs --auto-accept fetch arduino-api + + - name: Apply Zephyr patches + run: | + bash $MODULE_PATH/extra/apply_zephyr_patches.sh + + - name: Build PSE84 blinky + run: | + west build -p -b kit_pse84_ai/pse846gps2dbzc4a/m33 $MODULE_PATH/samples/blinky_arduino + + - name: Build PSE84 hello + run: | + west build -p -b kit_pse84_ai/pse846gps2dbzc4a/m33 $MODULE_PATH/samples/hello_arduino + + - name: Build PSE84 threads + run: | + west build -p -b kit_pse84_ai/pse846gps2dbzc4a/m33 $MODULE_PATH/samples/threads_arduino + - name: Build fade run: | west build -p -b arduino_nano_33_ble//sense $MODULE_PATH/samples/fade diff --git a/.github/workflows/commit_check.yml b/.github/workflows/commit_check.yml index da0408a74..19424d5aa 100644 --- a/.github/workflows/commit_check.yml +++ b/.github/workflows/commit_check.yml @@ -19,7 +19,7 @@ jobs: with: pattern: '^[^!]+: [A-Za-z]+.+ .+$' flags: 'gm' - error: 'Commit subject line must match the following pattern: : ' + error: 'Commit subject line / PR title must match the following pattern: : ' excludeTitle: 'false' excludeDescription: 'true' checkAllCommitMessages: 'true' @@ -29,7 +29,7 @@ jobs: with: pattern: '^[^#].{10,80}$' error: 'Commit subject line maximum line length of 80 characters is exceeded.' - excludeTitle: 'false' + excludeTitle: 'true' excludeDescription: 'true' checkAllCommitMessages: 'true' accessToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/format_check.yml b/.github/workflows/format_check.yml index c0726a87d..0d29ea846 100644 --- a/.github/workflows/format_check.yml +++ b/.github/workflows/format_check.yml @@ -35,7 +35,7 @@ jobs: cores/arduino/api/** loader/llext_exports.c loader/blobs/4343WA1_*.c - loader/blobs/wifi_nvram_image.h + loader/blobs/wifi_nvram_image_data.h libraries/examples/** libraries/extras/** libraries/ea_malloc/** diff --git a/.github/workflows/package_core.yml b/.github/workflows/package_core.yml index 4c64c8b37..08a84c3cb 100644 --- a/.github/workflows/package_core.yml +++ b/.github/workflows/package_core.yml @@ -53,10 +53,13 @@ jobs: ARTIFACTS: ${{ env.ARTIFACTS }} # List of architectures the artifacts will be built for SUB_ARCHES: ${{ env.SUB_ARCHES }} + # URL of the latest ci-builds index for this branch, if any + CI_BUILDS_URL: ${{ env.CI_BUILDS_URL }} steps: - name: Install OS dependencies working-directory: /opt + timeout-minutes: 5 # early error on Github network issues run: | sudo apt-get remove --purge man-db -y # skips the mandb triggers sudo apt-get update @@ -69,10 +72,8 @@ jobs: persist-credentials: false fetch-tags: true # needed for get_core_version.sh - - name: Initialize Zephyr environment + - name: Identify current version and board set run: | - # Install Zephyr as a core user would, but faster - yes | ./extra/bootstrap.sh -o=--filter=tree:0 # Set up basic environment for later steps echo "CORE_HASH=$(git describe --always $HEAD_REF)" >> "$GITHUB_ENV" echo "ALL_BOARD_DATA=$(extra/get_board_details.sh | jq -c 'sort_by(.variant)')" >> "$GITHUB_ENV" @@ -88,15 +89,48 @@ jobs: [[ -n "$BRANCH" ]] || { echo "::error::No branch found containing tag ${{ github.ref_name }}"; exit 1; } echo "CORE_BRANCH=${BRANCH}" >> "$GITHUB_ENV" else - echo "CORE_BRANCH=${{ github.head_ref || github.ref_name }}" >> "$GITHUB_ENV" + echo "CORE_BRANCH=${{ github.base_ref || github.ref_name }}" >> "$GITHUB_ENV" fi echo "ALL_BOARD_FQBNS=$(jq -c 'map((. + {link_mode: "static"}), (. + {link_mode: "dynamic"}))' <<< ${ALL_BOARD_DATA})" >> "$GITHUB_ENV" echo "ARTIFACTS=$(jq -c '["zephyr"] + (map(.artifact) | unique)' <<< ${ALL_BOARD_DATA})" >> "$GITHUB_ENV" echo "SUB_ARCHES=$(jq -c 'map(.subarch) | unique' <<< ${ALL_BOARD_DATA})" >> "$GITHUB_ENV" + + - name: Cache west modules and blobs + uses: actions/cache@v5 + with: + key: west-cache-${{ hashFiles('west.yml', 'boards.txt') }} + restore-keys: | + west-blobs- + path: ${{ runner.temp }}/west-cache + + - name: Initialize Zephyr environment + timeout-minutes: 10 # early error on Github network issues + env: + WEST_CACHE: ${{ runner.temp }}/west-cache + run: | + # Install Zephyr as a core user would, but faster + yes | ./extra/bootstrap.sh -o=--filter=tree:0 # Archive the build environment for later jobs (cd && tar cphf - .cmake work zephyr-sdk-* | zstd > build-env.tar.zstd) - # The API is only needed for packaging, not for building, so it's separate - tar cphf - cores/arduino/api | zstd > arduino-api.tar.zstd + + - name: Get ci-builds package index link + if: ${{ github.repository == 'arduino/ArduinoCore-zephyr' }} + run: | + # for pull requests and pushes to the official Arduino repo, use the latest ci-built core as a reference + CI_BUILDS_URL="https://arduino.github.io/core-ci-builds/package_arduino_zephyr_${CORE_BRANCH}_ci_index.json" + if ! wget -q --method=HEAD "$CI_BUILDS_URL" >& /dev/null ; then + CLOSEST_BRANCH=$(git branch -r | grep -vE "HEAD|/$(git branch --show-current)$" | while read -r b; do \ + echo "$(git rev-list --count $b..HEAD) $b" ; \ + done | sort -n | head -n 1 | awk '{print $2}' | cut -d / -f 2) + [ -z "$CLOSEST_BRANCH" ] && CLOSEST_BRANCH="main" + echo "::warning::No ci-builds index found for branch $CORE_BRANCH, using $CLOSEST_BRANCH" + CI_BUILDS_URL="https://arduino.github.io/core-ci-builds/package_arduino_zephyr_${CLOSEST_BRANCH}_ci_index.json" + if ! wget -q --method=HEAD "$CI_BUILDS_URL" >& /dev/null ; then + echo "::warning::No ci-builds index found for branch $CLOSEST_BRANCH, using main" + CI_BUILDS_URL="https://arduino.github.io/core-ci-builds/package_arduino_zephyr_main_ci_index.json" + fi + fi + echo "CI_BUILDS_URL=$CI_BUILDS_URL" >> "$GITHUB_ENV" - name: Download test data run: | @@ -117,14 +151,6 @@ jobs: retention-days: 1 archive: false - - name: Archive API snapshot - uses: actions/upload-artifact@v7 - with: - name: arduino-api - path: arduino-api.tar.zstd - retention-days: 1 - archive: false - # Extract the build environment and compile the loader project for each board @@ -152,11 +178,14 @@ jobs: steps: - uses: actions/download-artifact@v8 + timeout-minutes: 10 # early error on Github network issues with: path: /home/runner name: build-env.tar.zstd - name: Restore build environment + id: restore-env + timeout-minutes: 5 # early error on Github network issues run: | sudo apt-get remove --purge man-db -y # skips the mandb triggers sudo apt-get update @@ -208,7 +237,7 @@ jobs: echo "::endgroup::" - name: Package board artifacts - if: ${{ !cancelled() }} + if: ${{ steps.restore-env.outcome == 'success' && !cancelled() }} run: | # add the config file to the report files, list them for later archiving cp firmwares/zephyr-${{ matrix.variant }}.config $REPORT.config @@ -223,11 +252,12 @@ jobs: firmwares/*${{ matrix.variant }}* \ variants/${{ matrix.variant }}/ \ boards.local_${{ matrix.variant }}.txt \ + cores/arduino/api/ \ ${FULL_BUILD_DIR} \ | zstd > binaries-${ARTIFACT_TAG}.tar.zstd - name: Archive board binaries - if: ${{ !cancelled() }} + if: ${{ steps.restore-env.outcome == 'success' && !cancelled() }} uses: actions/upload-artifact@v7 with: # prefix the name with 'failed-' if the build failed, so that it is not removed @@ -237,7 +267,7 @@ jobs: archive: false - name: Archive build reports - if: ${{ !cancelled() }} + if: ${{ steps.restore-env.outcome == 'success' && !cancelled() }} uses: actions/upload-artifact@v7 with: name: build-report-${{ env.ARTIFACT_TAG }} @@ -275,12 +305,6 @@ jobs: persist-credentials: false fetch-tags: true - # Get the API snapshot - - uses: actions/download-artifact@v8 - with: - path: . - name: arduino-api.tar.zstd - # Get all built binaries - uses: actions/download-artifact@v8 with: @@ -290,9 +314,8 @@ jobs: - name: Package core run: | - # Extract the API snapshot and board binaries in place - rm -f cores/arduino/api # remove broken symlink - tar --use-compress-program=unzstd -xpf arduino-api.tar.zstd + # Extract the board binaries in place + # (each will also include the same copy of the API) for f in binaries-*.tar.zstd ; do tar --use-compress-program=unzstd -xpf $f done @@ -301,22 +324,113 @@ jobs: ./extra/package_core.sh ${{ matrix.artifact }} ${CORE_TAG} distrib/${CORE_ARTIFACT} - uses: actions/upload-artifact@v7 + id: upload-core if: ${{ success() || failure() }} with: name: ${{ env.CORE_ARTIFACT }} path: distrib/${{ env.CORE_ARTIFACT }} archive: false + - name: Archive artifact ID + run: | + echo '${{ steps.upload-core.outputs.artifact-id }}' > ${{ matrix.artifact }}.id + + - uses: actions/upload-artifact@v7 + with: + name: artifact-id-${{ matrix.artifact }} + path: ${{ matrix.artifact }}.id + - # After generating the final cores, the API and per-board binary archives are no longer needed. - # The build environment archive can also be removed. + # Prepare this PR's temporary package index JSON by merging the newly + # built core packages with the latest package index from ci-builds. + + package-index: + name: Package index URL for offline tests + runs-on: ubuntu-latest + needs: + - build-env + - package-core + if: ${{ github.event_name == 'pull_request' && needs.build-env.outputs.CI_BUILDS_URL != '' }} + env: + CORE_HASH: ${{ needs.build-env.outputs.CORE_HASH }} + CORE_BRANCH: ${{ needs.build-env.outputs.CORE_BRANCH }} + ARTIFACTS: ${{ needs.build-env.outputs.ARTIFACTS }} + CI_BUILDS_URL: ${{ needs.build-env.outputs.CI_BUILDS_URL }} + steps: + + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + persist-credentials: false + fetch-tags: true + + - uses: actions/download-artifact@v8 + with: + pattern: ArduinoCore-*.tar.bz2 + path: . + merge-multiple: true + + - uses: actions/download-artifact@v8 + with: + pattern: artifact-id-* + path: . + merge-multiple: true + + - name: Prepare PR package index + run: | + wget ${CI_BUILDS_URL} -O ci_index.json + # clear other platforms from the index + jq '.packages[0].platforms = []' ci_index.json > ci_index.tmp && mv ci_index.tmp ci_index.json + + mkdir -p snippets/platforms/ + jq -cr '.[]' <<< ${ARTIFACTS} | while read -r artifact; do + [ $artifact == "zephyr" ] && continue + ARTIFACT_FILE=ArduinoCore-${artifact}-${CORE_HASH}.tar.bz2 + PACKAGE_JSON=snippets/platforms/${artifact}.json + ./extra/gen_package_index_json.sh ${artifact} ${ARTIFACT_FILE} ${PACKAGE_JSON} + # replace the download URL with this PR's artifact link + ARTIFACT_ID=$(cat ${artifact}.id) + ARTIFACT_URL="https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${ARTIFACT_ID}/zip" + sed -i -e "s!\"url\":.*!\"url\": \"${ARTIFACT_URL}\",!" ${PACKAGE_JSON} + # append the new snippet to the index + jq -s '.[0].packages[0].platforms += .[1].packages[0].platforms | .[0]' \ + ci_index.json ${PACKAGE_JSON} > ci_index.tmp && mv ci_index.tmp ci_index.json + done + PACKAGE_INDEX_FILE="package_arduino_zephyr_pr_${{ github.event.pull_request.number }}_ci_index.json" + echo "PACKAGE_INDEX_FILE=${PACKAGE_INDEX_FILE}" >> $GITHUB_ENV + mv ci_index.json ${PACKAGE_INDEX_FILE} + + - name: Archive PR package index + id: package-index-json + uses: actions/upload-artifact@v7 + with: + name: ${{ env.PACKAGE_INDEX_FILE }} + path: ${{ env.PACKAGE_INDEX_FILE }} + archive: false + + - name: Display final URL in the summary + run: | + ARTIFACT_ID=${{ steps.package-index-json.outputs.artifact-id }} + PACKAGE_INDEX_URL="https://api.github.com/repos/${{ github.repository }}/actions/artifacts/${ARTIFACT_ID}/zip" + PACKAGE_INDEX_URL="${PACKAGE_INDEX_URL}#${{ env.PACKAGE_INDEX_FILE }}" + echo "[${PACKAGE_INDEX_URL}](${PACKAGE_INDEX_URL})" >> $GITHUB_STEP_SUMMARY + + + + # After generating the final cores, the following temporary artifacts are + # no longer used and can be removed: + # + # - the Zephyr build environment + # - the API and per-board binaries + # - the artifact download URLs cleanup-build: name: Clean up intermediates runs-on: ubuntu-latest needs: - package-core + - package-index steps: - uses: geekyeggo/delete-artifact@v6 @@ -325,6 +439,7 @@ jobs: arduino-api.tar.zstd binaries-* build-env.tar.zstd + artifact-id-* failOnError: false @@ -350,6 +465,7 @@ jobs: FQBN: arduino:${{ matrix.subarch }}:${{ matrix.board }}:link_mode=${{ matrix.link_mode }} CORE_ARTIFACT: ArduinoCore-${{ matrix.artifact }}-${{ needs.build-env.outputs.CORE_HASH }}.tar.bz2 ARTIFACT_TAG: ${{ needs.build-env.outputs.CORE_HASH }}-${{ matrix.board }}-${{ matrix.link_mode }} + CI_BUILDS_URL: ${{ needs.build-env.outputs.CI_BUILDS_URL }} if: ${{ !cancelled() && needs.build-env.result == 'success' }} steps: @@ -378,6 +494,21 @@ jobs: tar xf ${CORE_ARTIFACT} # will create ArduinoCore-zephyr/ echo "REPORT_FILE=$(echo ${FQBN} | tr ':' '-').json" >> $GITHUB_ENV + - name: Install arm-zephyr-eabi 1.0.1 for zephyr_contrib boards + # zephyr_contrib boards (e.g. kit_pse84_ai) use Zephyr 4.4.0 + SDK 1.0.1. + # The Board Manager only ships arm-zephyr-eabi-0.16.8 (for SDK 0.16.8/Zephyr 4.2.0). + # We install 1.0.1 manually into the arduino-cli packages path so that + # {runtime.tools.arm-zephyr-eabi-1.0.1.path} resolves correctly during compilation. + if: ${{ matrix.subarch == 'zephyr_contrib' }} + run: | + TOOL_DIR=~/.arduino15/packages/zephyr/tools/arm-zephyr-eabi/1.0.1 + if [ ! -d "$TOOL_DIR/bin" ]; then + mkdir -p "$TOOL_DIR" + wget -q https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v1.0.1/toolchain_gnu_linux-x86_64_arm-zephyr-eabi.tar.xz -O /tmp/arm-zephyr-eabi.tar.xz + tar -xf /tmp/arm-zephyr-eabi.tar.xz -C "$TOOL_DIR" --strip-components=1 + rm /tmp/arm-zephyr-eabi.tar.xz + fi + - name: Get test sketches run: | # sets ALL_TESTS and ALL_LIBRARIES env vars in GITHUB_ENV @@ -386,10 +517,12 @@ jobs: - name: Compile tests for ${{ matrix.board }} uses: pillo79/compile-sketches@next with: + # Use ci-builds core, if possible, to use the exact set of tools required by the source fqbn: ${{ env.FQBN }} platforms: | # Use Board Manager version first to install the tools - name: ${{ env.PLAT }} + ${{ env.CI_BUILDS_URL != '' && format('source-url: {0}', env.CI_BUILDS_URL) || '' }} # ... then replace that with the local version - name: ${{ env.PLAT }} source-path: "ArduinoCore-zephyr" @@ -566,7 +699,7 @@ jobs: publish-core: name: Publish core runs-on: ubuntu-latest - if: ${{ github.event_name == 'push' && github.repository == 'arduino/ArduinoCore-zephyr' }} + if: ${{ github.event_name == 'push' && github.repository == 'arduino/ArduinoCore-zephyr' && !startsWith(github.ref_name, 'dependabot/') }} needs: - build-env - package-core @@ -601,6 +734,8 @@ jobs: done aws s3 cp size-reports-*.tar.bz2 s3://${{ secrets.S3_BUCKET }}/size-reports/ + + # Prepare the package index JSON snippets for the newly built core packages. prepare-json: @@ -650,9 +785,15 @@ jobs: name: snippets-${{ env.CORE_TAG }} path: snippets/ + + + # Upload the newly built core packages and package index snippets to the + # ci-builds repository so the build is fully logged and the next PRs can + # use them as a reference for testing. + ci-builds-upload: name: Upload to ci-builds - if: ${{ github.event_name == 'push' && github.repository == 'arduino/ArduinoCore-zephyr' }} + if: ${{ github.event_name == 'push' && github.repository == 'arduino/ArduinoCore-zephyr' && !startsWith(github.ref_name, 'dependabot/') }} runs-on: ubuntu-latest needs: - build-env diff --git a/.github/workflows/release_pse84.yml b/.github/workflows/release_pse84.yml new file mode 100644 index 000000000..f10445c68 --- /dev/null +++ b/.github/workflows/release_pse84.yml @@ -0,0 +1,171 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + +# PSE84-specific release workflow: triggered automatically when package_core.yml +# completes successfully on main. Bumps the version, tags the commit, and +# publishes the ArduinoCore-zephyr_contrib package as a GitHub Release. + +name: Release PSE84 + +on: + workflow_run: + workflows: ["Package, test and upload core"] + types: [completed] + branches: [main] + +jobs: + + bump-version-and-tag: + name: Bump version, tag, and create release + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' && endsWith(github.repository, '/ArduinoCore-zephyr') && github.triggering_actor != 'github-actions[bot]' }} + permissions: + contents: write + outputs: + release_tag: ${{ steps.release_tag.outputs.release_tag }} + steps: + + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + fetch-tags: true + + - name: Compute next release tag + id: release_tag + env: + RELEASE_BUMP: patch + run: | + git fetch --tags + + EXISTING_TAG=$(git tag --points-at "${{ github.event.workflow_run.head_sha }}" --list '[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | head -n1) + if [ -n "${EXISTING_TAG}" ]; then + echo "Using existing tag on HEAD: ${EXISTING_TAG}" + echo "release_tag=${EXISTING_TAG}" >> "$GITHUB_OUTPUT" + exit 0 + fi + + LAST_TAG=$(git tag --list '[0-9]*.[0-9]*.[0-9]*' --sort=-v:refname | head -n1) + if [ -z "${LAST_TAG}" ]; then + LAST_TAG="0.0.0" + fi + + IFS='.' read -r MAJOR MINOR PATCH <<< "${LAST_TAG}" + case "${RELEASE_BUMP}" in + major) + MAJOR=$((MAJOR + 1)) + MINOR=0 + PATCH=0 + ;; + minor) + MINOR=$((MINOR + 1)) + PATCH=0 + ;; + *) + PATCH=$((PATCH + 1)) + ;; + esac + + NEW_TAG="${MAJOR}.${MINOR}.${PATCH}" + echo "release_tag=${NEW_TAG}" >> "$GITHUB_OUTPUT" + + - name: Create release (and tag if missing) + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ steps.release_tag.outputs.release_tag }} + run: | + if gh release view "${TAG}" >/dev/null 2>&1; then + echo "Release ${TAG} already exists" + else + gh release create "${TAG}" \ + --target "${{ github.event.workflow_run.head_sha }}" \ + --title "ArduinoCore-zephyr-pse84 ${TAG}" \ + --notes "Automated release for ${{ github.event.workflow_run.head_sha }}." + fi + + + publish-pse84-release: + name: Publish PSE84 release assets + runs-on: ubuntu-latest + needs: + - bump-version-and-tag + if: ${{ needs.bump-version-and-tag.result == 'success' }} + permissions: + contents: write + actions: read + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + TAG: ${{ needs.bump-version-and-tag.outputs.release_tag }} + steps: + + - uses: actions/checkout@v6 + with: + fetch-depth: 0 + persist-credentials: false + fetch-tags: true + + - name: Download zephyr_contrib artifact from triggering workflow run + uses: actions/download-artifact@v8 + with: + pattern: ArduinoCore-zephyr_contrib-* + path: release-assets + merge-multiple: true + run-id: ${{ github.event.workflow_run.id }} + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Normalize artifact filename for release tag + run: | + if [ -z "${TAG}" ]; then + echo "Release tag is empty" >&2 + exit 1 + fi + + TAR_FILE=$(ls release-assets/ArduinoCore-zephyr_contrib-*.tar.bz2 | head -n1) + if [ -z "${TAR_FILE}" ]; then + echo "Downloaded artifact does not contain expected tarball" >&2 + exit 1 + fi + + OLD_BASENAME=$(basename "${TAR_FILE}") + NEW_BASENAME="ArduinoCore-zephyr_contrib-${TAG}.tar.bz2" + + if [ "${OLD_BASENAME}" != "${NEW_BASENAME}" ]; then + mv "${TAR_FILE}" "release-assets/${NEW_BASENAME}" + echo "Renamed ${OLD_BASENAME} -> ${NEW_BASENAME}" + fi + + echo "TAR_BASENAME=${NEW_BASENAME}" >> "$GITHUB_ENV" + + - name: Generate package index JSON + run: | + ARTIFACT_PATH="release-assets/${TAR_BASENAME}" + SIZE=$(wc -c < "${ARTIFACT_PATH}") + SHA256=$(sha256sum "${ARTIFACT_PATH}" | cut -d' ' -f1) + URL="https://github.com/${GH_REPO}/releases/download/${TAG}/${TAR_BASENAME}" + + python3 - <> $env:GITHUB_ENV + + - name: Compute SHA-256 and size + run: | + $hash = (Get-FileHash -Algorithm SHA256 $env:TAR_NAME).Hash.ToLower() + $size = (Get-Item $env:TAR_NAME).Length + echo "TAR_SHA256=$hash" >> $env:GITHUB_ENV + echo "TAR_SIZE=$size" >> $env:GITHUB_ENV + + - name: Upload to GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ github.event.inputs.release_tag }} + files: ${{ env.TAR_NAME }} + + - name: Print package index values + run: | + Write-Host "" + Write-Host "=== Paste these into the Windows entry of the package index template ===" + Write-Host "archiveFileName : $env:TAR_NAME" + Write-Host "url : https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.release_tag }}/$env:TAR_NAME" + Write-Host "checksum : SHA-256:$env:TAR_SHA256" + Write-Host "size : $env:TAR_SIZE" diff --git a/.gitignore b/.gitignore index 53a2144bc..c5bd8e79e 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ /firmwares/* /venv/ /boards.local.txt +/platform.local.txt +/loader/VERSION llext-edk/ cflags.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index 90b51eead..59aeebe90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,13 @@ # SPDX-License-Identifier: Apache-2.0 +# Do nothing unless the Arduino API is enabled in the Zephyr project +if(NOT CONFIG_ARDUINO_API) + return() +endif() + +# Keep this in sync with zephyr/module.yml +set(ARDUINO_API_BLOB_VERSION 1.5.2) + string(REPLACE "__" "_" NORMALIZED_BOARD_TARGET "${NORMALIZED_BOARD_TARGET}") # Define custom pinctrl state "arduino" for dynamic pin multiplexing. @@ -12,14 +20,46 @@ if (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/variants/${BOARD}) elseif (IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/variants/${NORMALIZED_BOARD_TARGET}) set(variant_dir variants/${NORMALIZED_BOARD_TARGET}) else() -if (CONFIG_ARDUINO_API) message(FATAL_ERROR "Variant dir not found: variants/${BOARD}, variants/${NORMALIZED_BOARD_TARGET}") endif() + +# API archives embed an 'ArduinoCore-API-' directory +set(ARDUINO_API_BLOB_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zephyr/blobs/ArduinoCore-API/) +set(ARDUINO_API_BLOB_DIR ${ARDUINO_API_BLOB_ROOT_DIR}/ArduinoCore-API-${ARDUINO_API_BLOB_VERSION}) +set(ARDUINO_API_BLOB_ARCHIVE ${ARDUINO_API_BLOB_DIR}.tar.gz) + +if(NOT EXISTS ${ARDUINO_API_BLOB_ARCHIVE}) + message(FATAL_ERROR "Arduino API ${ARDUINO_API_BLOB_VERSION} must be downloaded with 'west blobs fetch'.") +endif() + +if(NOT IS_DIRECTORY ${ARDUINO_API_BLOB_DIR}) + # A new version of the API was downloaded, so extract it to the blob + # directory and copy it to cores/arduino/api + file(ARCHIVE_EXTRACT + INPUT ${ARDUINO_API_BLOB_ARCHIVE} + DESTINATION ${ARDUINO_API_BLOB_ROOT_DIR} + PATTERNS */api/* # only extract the 'api' directory from the archive + ) + set(update_api_copy TRUE) +elseif(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/cores/arduino/api) + # There's nothing where the API should be, copy the extracted API files + set(update_api_copy TRUE) +else() + set(update_api_copy FALSE) endif() -if (CONFIG_ARDUINO_API AND NOT CONFIG_LLEXT) -add_subdirectory(cores) -add_subdirectory(libraries) -zephyr_include_directories(${variant_dir}) +if(update_api_copy) + file(REMOVE_RECURSE ${CMAKE_CURRENT_SOURCE_DIR}/cores/arduino/api) + file(COPY ${ARDUINO_API_BLOB_DIR}/api DESTINATION ${CMAKE_CURRENT_SOURCE_DIR}/cores/arduino) endif() +if (NOT CONFIG_LLEXT_EDK) + add_subdirectory(cores) + add_subdirectory(libraries) + zephyr_include_directories(${variant_dir}) + + # It's fine to use GLOB here because the API files will only change when + # ARDUINO_API_BLOB_VERSION is modified above, triggering a re-run of CMake. + file(GLOB ARDUINO_API_SOURCES "cores/arduino/api/*.cpp") + zephyr_sources(${ARDUINO_API_SOURCES}) +endif() diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000..72d5247e7 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,289 @@ +## Development Notes + +This core uses Zephyr plus a board-specific loader. Sketches are built as loadable artifacts and executed by the preflashed loader firmware. + +- Loader and boot integration: [loader](loader) +- Core implementation: [cores/arduino](cores/arduino) +- PSOC™ Edge E84 variant files: [variants/kit_pse84_ai_pse846gps2dbzc4a_m33](variants/kit_pse84_ai_pse846gps2dbzc4a_m33) + +Key implementation areas in this repository: + +- Board definition and upload tooling: [boards.txt](boards.txt) +- Variant for KIT-PSE84-AI: [variants/kit_pse84_ai_pse846gps2dbzc4a_m33](variants/kit_pse84_ai_pse846gps2dbzc4a_m33) +- Core implementation: [cores/arduino](cores/arduino) + +If you are extending support, start by validating small samples first (for example blinky, hello, threads) and then move to subsystem-specific libraries. + +### Development Workflows + +Pushing to the `main` branch of this repository automatically triggers a workflow that builds and publishes a new release. Three development paths are available — choose the one that fits your setup: + +#### Fork-based (no local toolchain required) + +Fork this repository and push changes to your fork's `main` branch. GitHub Actions will build and publish a release automatically. You can then add the released JSON index URL to your Arduino IDE to test. + +Best for: quick feature work or experimentation without installing any toolchain. + +#### Local setup — without Zephyr + +Clone the repository and use the [`sync-zephyr-artifacts`](#-shortcut-using-the-core-in-arduino-idecli-without-installing-zephyr) utility to download pre-built loader binaries. Allows you to work on core and library code without a full Zephyr environment. + +Best for: changes to [cores/arduino](cores/arduino) or [libraries](libraries) that do not require rebuilding the loader. + +→ See: [Shortcut: using the Core without installing Zephyr](#-shortcut-using-the-core-in-arduino-idecli-without-installing-zephyr) + +#### Local setup — full Zephyr + +Set up a complete Zephyr build environment to rebuild the loader from source. Faster iteration than the fork-based workflow once set up. + +Best for: loader changes, new board support, or Kconfig/DTS work. + +→ See: [Setup a Zephyr build environment](#️-setup-a-zephyr-build-environment) + +## 🧢 Under the hood + +Unlike traditional Arduino implementations, where the final output is a standalone binary loaded by a bootloader, this core generates a freestanding `elf` file. This file is dynamically loaded by a precompiled Zephyr firmware, referred to as the `loader`. + +The `loader` is responsible for managing the interaction between your sketches and the underlying Zephyr system. After the initial bootloader installation, the `loader` takes over the sketch loading process automatically. + +To ensure flexibility, the `loader` project is designed to be generic. Any necessary modifications for specific boards should be made in the corresponding "DTS overlay" or a special "fixup" file, using appropriate guards to maintain compatibility. + +The behavior of the `loader` can be adjusted through the `Mode` menu of the IDE: +- `Standard`: The sketch is loaded automatically. +- `Debug`: The user must type `sketch` in Zephyr's shell, which is accessible via the default Serial. + +The most important components of this project are: + +* [Zephyr based loader](/loader) +* [LLEXT](https://docs.zephyrproject.org/latest/services/llext/index.html) +* [Actual core](/cores/arduino) with [variants](/variants) and the usual [platform](/platform.txt) and [boards](/boards) files +* [ArduinoCore-API](https://github.com/arduino/ArduinoCore-API) +* [zephyr-sketch-tool](/tools/zephyr-sketch-tool) + +## 🏃 Shortcut: using the Core in Arduino IDE/CLI without installing Zephyr + +> [!TIP] +> +> If you are only interested in developing features in the [core](/cores/arduino) +> or [libraries](/libraries), and do not want to set up a full Zephyr build +> environment, you can use the [`sync-zephyr-artifacts`](/extra/sync-zephyr-artifacts) +> utility to download a pre-built version of the files needed to compile +> sketches and flash the loader. +> +> To do so, after cloning this repo, compile the `sync-zephyr-artifacts` +> utility via `go build` and run it as `sync-zephyr-artifacts .` to retrieve +> the precompiled files for the current revision of the core. +> +> Next, follow the instructions in [Using the Core in Arduino IDE/CLI](#using-the-core-in-arduino-idecli) +> or [Using the Core in the Arduino App Lab](#using-the-core-in-the-arduino-app-lab) +> to start using the core in your preferred Arduino software. +> Remember to [update the loader on your board](#flash-the-loader) as well. + +## 🛠️ Setup a Zephyr build environment + +> [!WARNING] +> If you checked out this repo before 0.3.2 was released, please note that +> development has switched to the `main` branch; the old `arduino` branch will +> be removed in the short future. Please follow this +> [migration guide](https://github.com/arduino/ArduinoCore-zephyr/issues/163) +> to update your local branches and outstanding PRs. + +In this section, we’ll guide you through setting up your environment to work on and update the Zephyr core. + +Shell scripts are available to simplify the installation process (Windows is not directly supported at the moment 😔, but there are some tricks - see below). + +### Pre-requirements +Before running the installation script, ensure that Python, `pip` and `venv` are installed on your system. The script will automatically install `west` and manage the necessary dependencies. + +#### On Ubuntu or similar apt-based distros +```bash +sudo apt install python3-pip python3-setuptools python3-venv build-essential git cmake ninja-build zstd jq rsync +``` +#### On macOS +Make sure you have Homebrew installed. Then run: + +```bash +# Install Xcode Command Line Tools (needed for compilers and make) +xcode-select --install + +# Install required tools and libraries +brew install python cmake ninja zstd jq git +``` +Note: Homebrew’s Python installation already includes `pip`, `setuptools` and `venv`. + +#### On Windows +Building natively on Windows is not currently supported; however, it is possible to setup and build the loader using [WSL](https://learn.microsoft.com/windows/wsl/about). Once you have that installed, you will need to follow these instructions as if you had Ubuntu. + +There are two strategies to set up the sources for building the loader on Windows: +1) Install the sources in the native Windows filesystem (NTFS, FAT32, etc) and within WSL, cd to the root directory where you installed your sources, like: `/mnt/d/github/ArduinoCore-zephyr`. +2) Install the sources within the WSL file system, like: `~/git/ArduinoCore-zephyr` + +There are pros and cons to both strategies: +1) Builds on the native Windows file system are relatively very slow, but once done, you can use the results directly within the Arduino IDE. +2) Builds on WSL's file system are a lot faster, however, you need to copy the resulting build back to somewhere in your Windows directory structure. Use this location in the Arduino IDE as mentioned below in the [Using the Core in Arduino IDE/CLI](#using-the-core-in-arduino-idecli) section. + +After `bootstrap.sh` has completed, you may also have to update the `cores\arduino\api` link to the path of the ArduinoCore-API's `api` folder. + +### Clone the repository +```bash +mkdir my_new_zephyr_folder && cd my_new_zephyr_folder +git clone https://github.com/arduino/ArduinoCore-zephyr +``` + +### Run the ```bootstrap``` script +```bash +cd ArduinoCore-zephyr +./extra/bootstrap.sh +``` + +This will take care of installing `west`, the Zephyr build tool. It will then +download all packages required for a Zephyr build in addition to the toolchains +in the Zephyr SDK. + +> [!NOTE] +> This core is validated with version v0.16.8 of the SDK. Compatibility with later versions has not been tested yet. + +## 🛠️ Regenerate the compiled core files + +### Build the Loader + +The loader is compiled for each board by running the `./extra/build.sh` script. +The target can be specified either with the Arduino board name (as defined in +boards.txt), or with the Zephyr board name and any additional arguments that +may be required by the Zephyr build system. + +For example, to build for the Arduino Portenta H7, you can use either the +Arduino name: +```bash +./extra/build.sh portentah7 +``` + +or the Zephyr board target: + +```bash +./extra/build.sh arduino_portenta_h7//m7 +``` + +The firmwares will be copied to the [firmware](/firmware) folder, and the +associated variant will be updated. + +### Flash the Loader + +To flash the loader, run: + +```bash +west flash -d build/ +``` + +The `` appears in the build output when you run the build script. For example: + +```bash +% ./extra/build.sh portentah7 + +Build target: arduino_portenta_h7@1.0.0//m7 +Build variant: arduino_portenta_h7_stm32h747xx_m7 +-- west build: generating a build system +... +``` + +In this case, you would flash with: +```bash +west flash -d build/arduino_portenta_h7_stm32h747xx_m7 +``` + +This can also be performed via the "Burn bootloader" action in the IDE if the core is properly installed, as detailed below. + +### Using the Core in Arduino IDE/CLI + +After running the `bootstrap.sh` script, you can create a symlink from the +`ArduinoCore-zephyr` folder to `${sketchbook}/hardware/arduino-git/zephyr`, +or manually copy the whole folder to that location. + +> [!IMPORTANT] +> Make sure the final location of the `boards.txt` file is exactly +> `${sketchbook}/hardware/arduino-git/zephyr/boards.txt`. +> +> The `zephyr` folder name above is used as part of the FQBN architecture +> (`packager:architecture:board`) and is considered for library +> compatibility checks. +> Using a different architecture folder name may result in: +> - an unsupported FQBN (e.g. `arduino-git:wrong_zephyr_folder:unoq`) +> - architecture-specific libraries (e.g. `architectures=zephyr`) not being selected + +Once this is done, your development folder will appear in the IDE/CLI package +list as `arduino-git:zephyr`, and the Fully Qualified Board Name (FQBN) to use +will be `arduino-git:zephyr:name_from_boards_txt`. + +Remember to also install and/or update the officially published core in the IDE Board Manager to get the latest tools and dependencies. +[⚙️ Installation](#️-installation). + +### Using the Core in the Arduino App Lab + +> [!WARNING] +> Arduino App Lab expects a hardcoded FQBN (`arduino:zephyr:unoq` for the UNO Q), so the [technique used for Arduino IDE/CLI](#using-the-core-in-arduino-idecli) **does not** work. A small workaround is required. + +1. Disable the release core + +```bash +mv ~/.arduino15/packages/arduino/hardware/zephyr ~/.arduino15/packages/arduino/hardware/zephyr.disable +``` +This ensures the installation of the development version of the core will be used instead of the release installation. + +2. Install your custom core + +Place your custom core in the following path: +```bash +~/Arduino/hardware/arduino/zephyr +``` + +3. Flash the new loader + +Build and flash the loader from your custom core to overwrite the release version. +For example, on UNO Q: +```bash +arduino-cli burn-bootloader -b arduino:zephyr:unoq -P jlink +``` + +#### Revert to release core + +If you want to use the official core again, change the directory names so the one in `~/.arduino15` is `zephyr`, and the one in your sketchbook's hardware folder is `zephyr.disable`: +```bash +mv ~/.arduino15/packages/arduino/hardware/zephyr.disable ~/.arduino15/packages/arduino/hardware/zephyr +mv ~/Arduino/hardware/arduino/zephyr ~/Arduino/hardware/arduino/zephyr.disable +``` + +## 🚀 Adding a new target + +> [!TIP] +> +> While Zephyr supports a lot of different hardware targets, only the few +> currently used by the Arduino core are installed by default. To add the +> support for every Zephyr target to your workspace, run the following +> commands: +> +> ```bash +> . venv/bin/activate +> west config -d manifest.project-filter +> west sdk install --version 0.17.0 +> west update +> ``` + +To add a new board that is already supported by mainline Zephyr with the target `$your_board`, follow these steps: + +* Get the variant name from your board by running `extra/get_variant_name.sh $your_board`. +* Create a folder in the [`variants/`](/variants) directory with the same name as the variant for your new board. +* Create the DTS `.overlay` and Kconfig `.conf` files in that directory. + + The overlay must include: + * A flash partition called `user_sketch`, typically located near the end of the flash. + * A `zephyr,user` section containing the description for GPIOs, Analog, UART, SPI and I2C devices. Feel free to leave some fields empty in case Zephyr support is missing. This will result in some APIs not being available at runtime (eg. `analogWrite` if PWM section is empty). + + The Kconfig file must include any board-specific options required by this target. +* Build the Loader: run `./extra/build.sh $your_board` (with any additional arguments as required) and start debugging the errors. :grin: +* Update the `boards.txt`: add an entry for your board, manually filling the required fields. + + Make sure to set: + * `build.zephyr_target` and `build.zephyr_args` to the arguments used in the `build.sh` call; + * `build.zephyr_hals` to the (space-separated list of) HAL modules required by the board; + * `build.variant` to the variant name identified above. +* Implement touch support: if your board supports the "1200bps touch" method, implement `_on_1200_bps` in a file located inside the variant folder of your board. diff --git a/Kconfig b/Kconfig index edd4710db..b6c45a10d 100644 --- a/Kconfig +++ b/Kconfig @@ -12,6 +12,7 @@ config ARDUINO_API imply NEWLIB_LIBC_FLOAT_PRINTF imply CBPRINTF_FP_SUPPORT imply RING_BUFFER + imply PINCTRL_KEEP_SLEEP_STATE select UART_INTERRUPT_DRIVEN default n @@ -24,7 +25,7 @@ config QEMU_ICOUNT config ARDUINO_API_SERIAL_BUFFER_SIZE int "Buffer size for Arduino Serial API" - default 64 + default 1024 config ARDUINO_ENTRY bool "Provide arduino setup and loop entry points" diff --git a/README.gsoc.md b/README.gsoc.md index 2d2309097..b40655fd5 100644 --- a/README.gsoc.md +++ b/README.gsoc.md @@ -26,19 +26,11 @@ The **Arduino Core API** module for zephyr leverages the power of Zephyr under a west update ``` -* **Note:** For ***Linux users only*** there exists an ``install.sh`` script in this project that can be run to quickly link the ArduinoCore-API to this module. -If you are able to run that script successfully then you can skip the next steps. +* You also need to fetch the ArduinoCore-API sources using the following command: -* To "complete" the core you need to copy or symlink the api folder from the [ArduinoCore-API](https://github.com/arduino/ArduinoCore-API.git) repo to the target's ``cores/arduino`` folder: ```sh -$ git clone git@github.com:arduino/ArduinoCore-API # Any location -$ ln -s ///ArduinoCore-API/api cores/arduino/. +west blobs fetch arduino-api ``` -The `cores` folder can be found at `~/zephyrproject/modules/lib/Arduino-Zephyr-API/cores`. - -**Known Bug(s):** - -__NOTE:__ You can skip this step as well if you ran ``install.sh``. **Maintainers**: - [DhruvaG2000](https://github.com/DhruvaG2000) diff --git a/README.md b/README.md index 042bbd517..d4864b3f4 100644 --- a/README.md +++ b/README.md @@ -1,363 +1,137 @@ -> [!IMPORTANT] -> This core is in **BETA**. 🧪 -> Features may change, and bugs may be present. Use for testing only and provide feedback to help us improve. -> -> [![Default branch status](https://github.com/arduino/ArduinoCore-zephyr/actions/workflows/package_core.yml/badge.svg?branch=arduino&event=push)](https://github.com/arduino/ArduinoCore-zephyr/actions/workflows/package_core.yml) +# Infineon PSOC™ Edge Zephyr-based Arduino Core +[![Default branch status](https://github.com/Infineon/ArduinoCore-zephyr/actions/workflows/package_core.yml/badge.svg?branch=main&event=push)](https://github.com/Infineon/ArduinoCore-zephyr/actions/workflows/package_core.yml) -# 🚧 Arduino Core for Zephyr - -This repository is a downstream fork of the [Arduino Core for Zephyr RTOS-based -boards](https://github.com/zephyrproject-rtos/arduino-core-zephyr) that -includes support for Arduino software tools, allowing it to be seamlessly used -by the [Arduino IDE](https://docs.arduino.cc/software/ide/), -[Arduino CLI](https://docs.arduino.cc/arduino-cli/) and -[Arduino App Lab](https://docs.arduino.cc/software/app-lab/). - -## 🧐 What is Zephyr? - -[Zephyr RTOS](https://zephyrproject.org/) is an open-source, real-time operating system designed for low-power, resource-constrained devices. It's modular, scalable, and supports multiple architectures. - -![Zephyr RTOS Logo](doc/zephyr_logo.jpg) - -## ⚙️ Installation - -Install the core and its toolchains via Board Manager: -* Download and install the latest [Arduino IDE](https://www.arduino.cc/en/software) (only versions `2.x.x` are supported). -* Open the *'Settings / Preferences'* window. -* Open the *'Boards Manager'* from the side menu and search for *'Zephyr'*. - * If it doesn’t appear, add the following URL to the *'Additional Boards Manager URLs'* field: `https://downloads.arduino.cc/packages/package_zephyr_index.json` (if you have multiple URLs, separate them with a comma). -* Install the `Arduino Zephyr Boards` platform. - -Alternatively, to install the core using the command line, run the following command with the Arduino CLI: - -```bash -arduino-cli core install arduino:zephyr --additional-urls https://downloads.arduino.cc/packages/package_zephyr_index.json -``` - -## 🏗️ First Use - -To get started with your board: -* Put the board in bootloader mode by double-clicking the RESET button. -* Run the `Burn Bootloader` option from the IDE/CLI. - * Note that due to limitations in the Arduino IDE, you may need to select any programmer from the `Programmers` menu. -* Once the bootloader is installed, you can load your first sketch by placing the board into bootloader mode again. - -> [!NOTE] -> After the initial setup, future sketches will be loaded automatically without needing to reset the board. - -## 🔧 Troubleshooting - -### Common Issues - -#### **Q: My Sketch doesn't start (Serial doesn't appear)** -**A:** Connect a USB-to-UART adapter to the default UART (eg. TX0/RX0 on Giga, TX/RX on Nano) and read the error message (with the sketch compiled in `Default` mode). If you don't own a USB-to-UART adapter, compile the sketch in `Debug` mode; this will force the shell to wait until you open the Serial Monitor. Then, run `sketch` command and *probably* you'll be able to read the error (if generated by `llext`). For OS crashes, the USB-to-UART adapter is the only way to collect the crash. - ---- - -#### **Q: I did it and I get the error: ` llext: Undefined symbol with no entry in symbol table ...`** -**A:** This means you are trying to use a Zephyr function which has not yet been exported. Open `llext_exports.c`, add the function you need and recompile/upload the loader. - ---- - -#### **Q: I want to use a Zephyr subsystem which is not compiled in** -**A:** Open the `.conf` file for your board, add the required `CONFIG_`, recompile/upload the loader. - ---- - -#### **Q: I get an OS crash, like ` os: ***** USAGE FAULT *****`** -**A:** This is usually due to a buffer overflow or coding error in the user's own code. However, since the project is still in beta 🧪, a [good bug report](#-bug-reporting) could help identify any issues in our code. - ---- - -#### **Q: I get an out of memory error** -**A:** Since collecting bug reports is very important at this time, we are keeping Zephyr's shell enabled to allow loading a full sketch (which requires a large stack). Adjust your board's `.conf` file to reduce the stack size if your platform doesn't have enough RAM. - ---- - -#### **Q: I get a compilation error during library detection, but the mentioned libraries are installed** -**A:** If you have installed the core locally in your Arduino sketchbook, make sure the Zephyr core is installed in a folder named `zephyr` (`${sketchbook}/hardware/arduino-git/zephyr`). -See the [Using the Core in Arduino IDE/CLI](#using-the-core-in-arduino-idecli) section for further details on the installation. - ---- - -#### **Q: Wi-Fi is not working, or I get `Communication with WiFi module failed!` in the Serial Monitor** -**A:** You are probably missing the Wi-Fi firmware, or the firmware is corrupted. Boards should come with the Wi-Fi firmware already flashed, but in case Wi-Fi is not working run the [`FlashFormat`](libraries/Storage/examples/FlashFormat/FlashFormat.ino) sketch to restore the firmware. - -## 📚 Libraries - -### Included with the core: ### - -### Separately supplied: ### -- **ArduinoBLE**: This library is enabled only for the Arduino Nano 33 BLE. Please use [this branch](https://github.com/facchinm/ArduinoBLE/tree/zephyr_hci) to test it. - -## 🧢 Under the hood - -Unlike traditional Arduino implementations, where the final output is a standalone binary loaded by a bootloader, this core generates a freestanding `elf` file. This file is dynamically loaded by a precompiled Zephyr firmware, referred to as the `loader`. - -The `loader` is responsible for managing the interaction between your sketches and the underlying Zephyr system. After the initial bootloader installation, the `loader` takes over the sketch loading process automatically. - -To ensure flexibility, the `loader` project is designed to be generic. Any necessary modifications for specific boards should be made in the corresponding "DTS overlay" or a special "fixup" file, using appropriate guards to maintain compatibility. - -The behavior of the `loader` can be adjusted through the `Mode` menu of the IDE: -- `Standard`: The sketch is loaded automatically. -- `Debug`: The user must type `sketch` in Zephyr's shell, which is accessible via the default Serial. - -The most important components of this project are: - -* [Zephyr based loader](/loader) -* [LLEXT](https://docs.zephyrproject.org/latest/services/llext/index.html) -* [Actual core](/cores/arduino) with [variants](/variants) and the usual [platform](/platform.txt) and [boards](/boards) files -* [ArduinoCore-API](https://github.com/arduino/ArduinoCore-API) -* [zephyr-sketch-tool](/extra/zephyr-sketch-tool) +> [!IMPORTANT] +> This project is a work in progress. +> It does not yet cover the full Arduino API or all PSOC™ Edge features. -## 🏃 Shortcut: using the Core in Arduino IDE/CLI without installing Zephyr +This repository contains the Zephyr-based Arduino core for: -> [!TIP] -> -> If you are only interested in developing features in the [core](/cores/arduino) -> or [libraries](/libraries), and do not want to set up a full Zephyr build -> environment, you can use the [`sync-zephyr-artifacts`](/extra/sync-zephyr-artifacts) -> utility to download a pre-built version of the files needed to compile -> sketches and flash the loader. -> -> To do so, after cloning this repo, compile the `sync-zephyr-artifacts` -> utility via `go build` and run it as `sync-zephyr-artifacts .` to retrieve -> the precompiled files for the current revision of the core. -> -> Next, follow the instructions in [Using the Core in Arduino IDE/CLI](#using-the-core-in-arduino-idecli) -> or [Using the Core in the Arduino App Lab](#using-the-core-in-the-arduino-app-lab) -> to start using the core in your preferred Arduino software. -> Remember to [update the loader on your board](#flash-the-loader) as well. +- [Infineon KIT-PSE84-AI (PSOC™ Edge E84)](https://www.infineon.com/cms/en/product/evaluation-boards/kit-pse84-ai/) -## 🛠️ Setup a Zephyr build environment +You can install the core through the Boards Manager in Arduino IDE, or via the Arduino CLI. +After installing the core, the **loader has to be flashed** and your first sketch can be uploaded. Steps are provided for both, [Arduino IDE](#installation--usage-in-arduino-ide) and [Arduino CLI](#installation--usage-in-arduino-cli). -> [!WARNING] -> If you checked out this repo before 0.3.2 was released, please note that -> development has switched to the `main` branch; the old `arduino` branch will -> be removed in the short future. Please follow this -> [migration guide](https://github.com/arduino/ArduinoCore-zephyr/issues/163) -> to update your local branches and outstanding PRs. +## Installation & Usage in Arduino IDE -In this section, we’ll guide you through setting up your environment to work on and update the Zephyr core. +### Installation -Shell scripts are available to simplify the installation process (Windows is not directly supported at the moment 😔, but there are some tricks - see below). +Use Arduino IDE 2.x and install the platform through Arduino's Boards Manager. -### Pre-requirements -Before running the installation script, ensure that Python, `pip` and `venv` are installed on your system. The script will automatically install `west` and manage the necessary dependencies. +1. Open Arduino IDE. +2. Navigate to *'File > Preferences'*. +3. In Additional boards manager URLs, add: -#### On Ubuntu or similar apt-based distros -```bash -sudo apt install python3-pip python3-setuptools python3-venv build-essential git cmake ninja-build zstd jq rsync +```text +https://github.com/Infineon/ArduinoCore-zephyr/releases/latest/download/package_infineon_pse84_index.json ``` -#### On macOS -Make sure you have Homebrew installed. Then run: -```bash -# Install Xcode Command Line Tools (needed for compilers and make) -xcode-select --install +4. Open *'Boards Manager'* (left side menu). +5. Search for *'PSOC Edge'* and install `Infineon PSOC Edge Boards`. This may take a moment. -# Install required tools and libraries -brew install python cmake ninja zstd jq git -``` -Note: Homebrew’s Python installation already includes `pip`, `setuptools` and `venv`. +### Usage -#### On Windows -Building natively on Windows is not currently supported; however, it is possible to setup and build the loader using [WSL](https://learn.microsoft.com/windows/wsl/about). Once you have that installed, you will need to follow these instructions as if you had Ubuntu. +1. Select the PSOC™ Edge board and the correct serial port: `Tools > Board > Infineon PSOC Edge Boards > Infineon KIT-PSE84-AI (PSOC Edge E84)` and `Tools > Port`. +2. Flash the loader: `Tools > Burn Bootloader`. +3. Open or write a sketch and click *Upload*. -There are two strategies to set up the sources for building the loader on Windows: -1) Install the sources in the native Windows filesystem (NTFS, FAT32, etc) and within WSL, cd to the root directory where you installed your sources, like: `/mnt/d/github/ArduinoCore-zephyr`. -2) Install the sources within the WSL file system, like: `~/git/ArduinoCore-zephyr` +## Installation & Usage in Arduino CLI -There are pros and cons to both strategies: -1) Builds on the native Windows file system are relatively very slow, but once done, you can use the results directly within the Arduino IDE. -2) Builds on WSL's file system are a lot faster, however, you need to copy the resulting build back to somewhere in your Windows directory structure. Use this location in the Arduino IDE as mentioned below in the [Using the Core in Arduino IDE/CLI](#using-the-core-in-arduino-idecli) section. +### Installation -After `bootstrap.sh` has completed, you may also have to update the `cores\arduino\api` link to the path of the ArduinoCore-API's `api` folder. +Simply use the following command: -### Clone the repository ```bash -mkdir my_new_zephyr_folder && cd my_new_zephyr_folder -git clone https://github.com/arduino/ArduinoCore-zephyr +arduino-cli core install infineon:zephyr_pse84 --additional-urls https://github.com/Infineon/ArduinoCore-zephyr/releases/latest/download/package_infineon_pse84_index.json ``` -### Run the ```bootstrap``` script -```bash -cd ArduinoCore-zephyr -./extra/bootstrap.sh -``` - -This will take care of installing `west`, the Zephyr build tool. It will then -download all packages required for a Zephyr build in addition to the toolchains -in the Zephyr SDK. - -> [!NOTE] -> This core is validated with version v0.16.8 of the SDK. Compatibility with later versions has not been tested yet. - -## 🛠️ Regenerate the compiled core files +### Usage -### Build the Loader +The FQBN for the Infineon KIT-PSE84-AI (PSOC Edge E84) is `infineon:zephyr_pse84:kit_pse84_ai`. -The loader is compiled for each board by running the `./extra/build.sh` script. -The target can be specified either with the Arduino board name (as defined in -boards.txt), or with the Zephyr board name and any additional arguments that -may be required by the Zephyr build system. +1. Flash the loader: -For example, to build for the Arduino Portenta H7, you can use either the -Arduino name: ```bash -./extra/build.sh portentah7 +arduino-cli burn-bootloader -b infineon:zephyr_pse84:kit_pse84_ai ``` -or the Zephyr board target: +2. Compile and upload a sketch: ```bash -./extra/build.sh arduino_portenta_h7//m7 +arduino-cli compile -b infineon:zephyr_pse84:kit_pse84_ai MySketch +arduino-cli upload -b infineon:zephyr_pse84:kit_pse84_ai -p MySketch ``` -The firmwares will be copied to the [firmware](/firmware) folder, and the -associated variant will be updated. +## Arduino API Documentation for PSOC™ Edge -### Flash the Loader +### Pinout -To flash the loader, run: +![Pinout](doc/KIT_PSE84_AI_Pinout.svg) -```bash -west flash -d build/ -``` +### Macros -The `` appears in the build output when you run the build script. For example: +For the exact macro definitions, refer to [`variants/kit_pse84_ai_pse846gps2dbzc4a_m33/variant.h`](variants/kit_pse84_ai_pse846gps2dbzc4a_m33/variant.h). +Here is a general explanation: -```bash -% ./extra/build.sh portentah7 +- Every exposed GPIO pin from the pinout has a macro identical to the documentation name, e.g. `P17_3`, `P16_0`, `P15_3`, etc. +- Digital pins have a macro in the format `Dx`, where `x` is the index of the arduino pin in the range [0, 47], e.g. `D0`, `D15`, `D47`, etc. +- Analog pins have a macro in the format `Ax`, where `x` is the index of the arduino pin in the range [0, 15], e.g. `A0`, `A1`, `A15`, etc. +- Onboard LED pin name macros are: + - `LED_BUILTIN `: `P10_7` + - `LED_BUILTIN_1 `: `P10_7` + - `LED_BUILTIN_2 `: `P10_5` + - `LED_BUILTIN_ACTIVE`: `HIGH` + - `LED_RED `: `P20_6` + - `LED_GREEN `: `P20_4` + - `LED_BLUE `: `P20_5` + - `BTN_BUILTIN `: `P7_0` (`SW1`) +- I2C pins are defined as `SDA`/`SCL` and `SDA1`/`SCL1` for the internal (`Wire`), and external (`Wire1`) I2C bus respectively. +- Expansion header pins include the macros as printed on the board: `SERIAL_INTx` where `x` is the index in the range [0, 3], e.g. `SERIAL_INT0`. -Build target: arduino_portenta_h7@1.0.0//m7 -Build variant: arduino_portenta_h7_stm32h747xx_m7 --- west build: generating a build system -... -``` - -In this case, you would flash with: -```bash -west flash -d build/arduino_portenta_h7_stm32h747xx_m7 -``` - -This can also be performed via the "Burn bootloader" action in the IDE if the core is properly installed, as detailed below. - -### Using the Core in Arduino IDE/CLI - -After running the `bootstrap.sh` script, you can create a symlink from the -`ArduinoCore-zephyr` folder to `${sketchbook}/hardware/arduino-git/zephyr`, -or manually copy the whole folder to that location. +### PSOC™ Edge Arduino API Coverage > [!IMPORTANT] -> Make sure the final location of the `boards.txt` file is exactly -> `${sketchbook}/hardware/arduino-git/zephyr/boards.txt`. -> -> The `zephyr` folder name above is used as part of the FQBN architecture -> (`packager:architecture:board`) and is considered for library -> compatibility checks. -> Using a different architecture folder name may result in: -> - an unsupported FQBN (e.g. `arduino-git:wrong_zephyr_folder:unoq`) -> - architecture-specific libraries (e.g. `architectures=zephyr`) not being selected +> Not all Arduino API calls are currently supported. Check the tracking document before relying on a specific API. -Once this is done, your development folder will appear in the IDE/CLI package -list as `arduino-git:zephyr`, and the Fully Qualified Board Name (FQBN) to use -will be `arduino-git:zephyr:name_from_boards_txt`. +Refer to the [API coverage tracking document](./api_support_tracking.md) for the implementation status and known limitations of each Arduino API call. -Remember to also install and/or update the officially published core in the IDE Board Manager to get the latest tools and dependencies. -[⚙️ Installation](#️-installation). +## Known Scope And Limits -### Using the Core in the Arduino App Lab +- This is an early PSOC™ Edge port focused on enabling core Arduino workflows on Zephyr. +- API compatibility is incomplete and may change between releases. +- Some subsystems compile but are not yet fully validated on KIT-PSE84-AI. -> [!WARNING] -> Arduino App Lab expects a hardcoded FQBN (`arduino:zephyr:unoq` for the UNO Q), so the [technique used for Arduino IDE/CLI](#using-the-core-in-arduino-idecli) **does not** work. A small workaround is required. +## Contributing And Feedback -1. Disable the release core +Feedback and contributions are highly encouraged. -```bash -mv ~/.arduino15/packages/arduino/hardware/zephyr ~/.arduino15/packages/arduino/hardware/zephyr.disable -``` -This ensures the installation of the development version of the core will be used instead of the release installation. - -2. Install your custom core - -Place your custom core in the following path: -```bash -~/Arduino/hardware/arduino/zephyr -``` +### Feedback -3. Flash the new loader +- Report bugs and request features in [Issues](/../../issues) +- Ask questions and discuss roadmap in [Discussions](/../../discussions) -Build and flash the loader from your custom core to overwrite the release version. -For example, on UNO Q: -```bash -arduino-cli burn-bootloader -b arduino:zephyr:unoq -P jlink -``` - -#### Revert to release core - -If you want to use the official core again, change the directory names so the one in `~/.arduino15` is `zephyr`, and the one in your sketchbook's hardware folder is `zephyr.disable`: -```bash -mv ~/.arduino15/packages/arduino/hardware/zephyr.disable ~/.arduino15/packages/arduino/hardware/zephyr -mv ~/Arduino/hardware/arduino/zephyr ~/Arduino/hardware/arduino/zephyr.disable -``` +When reporting issues, please include: -## 🚀 Adding a new target +- Board and host OS +- Core version +- Minimal sketch to reproduce +- Full build/upload logs -> [!TIP] -> -> While Zephyr supports a lot of different hardware targets, only the few -> currently used by the Arduino core are installed by default. To add the -> support for every Zephyr target to your workspace, run the following -> commands: -> -> ```bash -> . venv/bin/activate -> west config -d manifest.project-filter -> west sdk install --version 0.17.0 -> west update -> ``` +### Contributing +Contributions are welcome through [Pull Requests](/../../pulls). Please refer to [CONTRIBUTING.md](./CONTRIBUTING.md) for more information. -To add a new board that is already supported by mainline Zephyr with the target `$your_board`, follow these steps: +## Troubleshooting -* Get the variant name from your board by running `extra/get_variant_name.sh $your_board`. -* Create a folder in the [`variants/`](/variants) directory with the same name as the variant for your new board. -* Create the DTS `.overlay` and Kconfig `.conf` files in that directory. - - The overlay must include: - * A flash partition called `user_sketch`, typically located near the end of the flash. - * A `zephyr,user` section containing the description for GPIOs, Analog, UART, SPI and I2C devices. Feel free to leave some fields empty in case Zephyr support is missing. This will result in some APIs not being available at runtime (eg. `analogWrite` if PWM section is empty). - - The Kconfig file must include any board-specific options required by this target. -* Build the Loader: run `./extra/build.sh $your_board` (with any additional arguments as required) and start debugging the errors. :grin: -* Update the `boards.txt`: add an entry for your board, manually filling the required fields. - - Make sure to set: - * `build.zephyr_target` and `build.zephyr_args` to the arguments used in the `build.sh` call; - * `build.zephyr_hals` to the (space-separated list of) HAL modules required by the board; - * `build.variant` to the variant name identified above. -* Implement touch support: if your board supports the "1200bps touch" method, implement `_on_1200_bps` in a file located inside the variant folder of your board. - -## 🐛 Bug Reporting - -To report a bug, open the [issues](/../../issues) and follow the instructions. Any issue opened without the needed information will be discarded. - -## 🙌 Contributions - -Contributions are always welcome. The preferred way to receive code contribution is by submitting a [Pull request](/../../pulls). +### Common Issues -> [!WARNING] -> At this stage of development, we only accept Pull requests for bug fixes and features. We do **not** accept support for new targets. +#### `llext` Undefined Symbol Errors -## 📌 Upcoming features +If upload succeeds but execution fails with an `Undefined symbol` error, the sketch is using a symbol not exported by the loader image for this build. -- [ ] USB: switch to `USB_DEVICE_STACK_NEXT` to support PluggableUSB -- [x] Relocate RODATA in flash to accommodate sketches with large assets -- [ ] Provide better error reporting for failed llext operations -- [ ] Replace [`llext_exports.c`](/loader/llext_exports.c) with proper symbols generation (via includes) -- [ ] Fix corner cases with `std::` includes (like ``) -- [ ] Get rid of all warnings +- Rebuild and flash the bootloader for this board. +- If needed, extend exported symbols in loader integration sources and rebuild. -## 🌟 Acknowledgments +--- -This effort would have been very hard without the [GSoC project](/README.gsoc.md) and the Zephyr community. +#### **Q: I get an OS crash, like ` os: ***** USAGE FAULT *****`** +**A:** This is usually due to a buffer overflow or coding error in the user's own code. However, since the project is still in beta 🧪, a [good bug report](/../../issues) could help identify any issues in our code. diff --git a/api_support_tracking.md b/api_support_tracking.md new file mode 100644 index 000000000..f717596f6 --- /dev/null +++ b/api_support_tracking.md @@ -0,0 +1,162 @@ +### PSE84 Arduino API Support Tracking + +#### Legend +| Symbol | Meaning | +|--------|---------| +| ✅ | Confirmed working | +| ⚠️ | Not yet tested | +| ❌ | Not yet supported | + +--- + +#### API Support Table + +| Function | Scope | Status | +|----------|-------|--------| +| **Digital I/O** | | | +| `digitalRead()` | Digital GPIO | ✅ | +| `digitalWrite()` | Digital GPIO | ✅ | +| `pinMode()` | Digital GPIO | ✅ | +| **Analog I/O** | | | +| `analogRead()` | Analog | ❌ | +| `analogReadResolution()` | Analog | ❌ | +| `analogReference()` | Analog | ❌ | +| `analogWrite()` | Analog | ❌ | +| `analogWriteResolution()` | Analog | ❌ | +| **Advanced I/O** | | | +| `tone()` | Digital GPIO | ⚠️ | +| `noTone()` | Digital GPIO | ⚠️ | +| `pulseIn()` | Digital GPIO | ⚠️ | +| `pulseInLong()` | Digital GPIO | ⚠️ | +| `shiftIn()` | Digital GPIO | ⚠️ | +| `shiftOut()` | Digital GPIO | ⚠️ | +| **Time** | | | +| `delay()` | Timing | ✅ | +| `delayMicroseconds()` | Timing | ⚠️ | +| `millis()` | Timing | ✅ | +| `micros()` | Timing | ✅ | +| **Math** | | | +| `abs()` | Math | ⚠️ | +| `constrain()` | Math | ⚠️ | +| `map()` | Math | ⚠️ | +| `max()` | Math | ⚠️ | +| `min()` | Math | ⚠️ | +| `pow()` | Math | ⚠️ | +| `sq()` | Math | ⚠️ | +| `sqrt()` | Math | ⚠️ | +| **Trigonometry** | | | +| `cos()` | Math | ⚠️ | +| `sin()` | Math | ⚠️ | +| `tan()` | Math | ⚠️ | +| **Characters** | | | +| `isAlpha()` | Characters | ⚠️ | +| `isAlphaNumeric()` | Characters | ⚠️ | +| `isAscii()` | Characters | ⚠️ | +| `isControl()` | Characters | ⚠️ | +| `isDigit()` | Characters | ⚠️ | +| `isGraph()` | Characters | ⚠️ | +| `isHexadecimalDigit()` | Characters | ⚠️ | +| `isLowerCase()` | Characters | ⚠️ | +| `isPrintable()` | Characters | ⚠️ | +| `isPunct()` | Characters | ⚠️ | +| `isSpace()` | Characters | ⚠️ | +| `isUpperCase()` | Characters | ⚠️ | +| `isWhitespace()` | Characters | ⚠️ | +| **Random Numbers** | | | +| `random()` | Random | ⚠️ | +| `randomSeed()` | Random | ⚠️ | +| **Bits and Bytes** | | | +| `bit()` | Bits & Bytes | ⚠️ | +| `bitClear()` | Bits & Bytes | ⚠️ | +| `bitRead()` | Bits & Bytes | ⚠️ | +| `bitSet()` | Bits & Bytes | ⚠️ | +| `bitWrite()` | Bits & Bytes | ⚠️ | +| `highByte()` | Bits & Bytes | ⚠️ | +| `lowByte()` | Bits & Bytes | ⚠️ | +| **External Interrupts** | | | +| `attachInterrupt()` | Interrupts | ✅ | +| `detachInterrupt()` | Interrupts | ✅ | +| `digitalPinToInterrupt()` | Interrupts | ✅ | +| **Interrupts** | | | +| `interrupts()` | Interrupts | ⚠️ | +| `noInterrupts()` | Interrupts | ⚠️ | +| **Stream** | | | +| `available()` | Serial / UART | ⚠️ | +| `read()` | Serial / UART | ⚠️ | +| `flush()` | Serial / UART | ⚠️ | +| `find()` | Serial / UART | ⚠️ | +| `findUntil()` | Serial / UART | ⚠️ | +| `peek()` | Serial / UART | ⚠️ | +| `readBytes()` | Serial / UART | ⚠️ | +| `readBytesUntil()` | Serial / UART | ⚠️ | +| `readString()` | Serial / UART | ⚠️ | +| `readStringUntil()` | Serial / UART | ⚠️ | +| `parseInt()` | Serial / UART | ⚠️ | +| `parseFloat()` | Serial / UART | ⚠️ | +| `setTimeout()` | Serial / UART | ⚠️ | +| **Serial** | | | +| `if(Serial)` | Serial / UART | ⚠️ | +| `Serial1` / `Serial2` | Serial / UART | ⚠️ | +| USB Serial | Serial / UART | ⚠️ | +| `Serial.available()` | Serial / UART | ⚠️ | +| `Serial.availableForWrite()` | Serial / UART | ⚠️ | +| `Serial.begin()` | Serial / UART | ✅ | +| `Serial.end()` | Serial / UART | ⚠️ | +| `Serial.find()` | Serial / UART | ⚠️ | +| `Serial.findUntil()` | Serial / UART | ⚠️ | +| `Serial.flush()` | Serial / UART | ⚠️ | +| `Serial.parseFloat()` | Serial / UART | ⚠️ | +| `Serial.parseInt()` | Serial / UART | ⚠️ | +| `Serial.peek()` | Serial / UART | ⚠️ | +| `Serial.print()` | Serial / UART | ✅ | +| `Serial.println()` | Serial / UART | ✅ | +| `Serial.read()` | Serial / UART | ⚠️ | +| `Serial.readBytes()` | Serial / UART | ⚠️ | +| `Serial.readBytesUntil()` | Serial / UART | ⚠️ | +| `Serial.readString()` | Serial / UART | ⚠️ | +| `Serial.readStringUntil()` | Serial / UART | ⚠️ | +| `Serial.setTimeout()` | Serial / UART | ⚠️ | +| `Serial.write()` | Serial / UART | ⚠️ | +| `Serial.serialEvent()` | Serial / UART | ⚠️ | +| **SPI** | | | +| `SPI` | SPI | ❌ | +| I2C (Wire) | | | +| `Wire` / `Wire1` | I2C | ✅ | +| `Wire.begin()` | I2C | ⚠️ | +| `Wire.end()` | I2C | ⚠️ | +| `Wire.requestFrom()` | I2C | ⚠️ | +| `Wire.beginTransmission()` | I2C | ⚠️ | +| `Wire.endTransmission()` | I2C | ⚠️ | +| `Wire.write()` | I2C | ⚠️ | +| `Wire.available()` | I2C | ⚠️ | +| `Wire.read()` | I2C | ⚠️ | +| `Wire.setClock()` | I2C | ⚠️ | +| `Wire.onReceive()` | I2C | ⚠️ | +| `Wire.onRequest()` | I2C | ⚠️ | +| `Wire.setWireTimeout()` | I2C | ⚠️ | +| `Wire.clearWireTimeoutFlag()` | I2C | ⚠️ | +| `Wire.getWireTimeoutFlag()` | I2C | ⚠️ | +| **Sketch** | | | +| `loop()` | Core | ✅ | +| `setup()` | Core | ✅ | +| **Other** | | | +| `init()` | Core | ⚠️ | +| `initVariant()` | Core | ⚠️ | +| `yield()` | Timing | ✅ | +| Threads | Libraries | ❌ | +| CAN | Libraries | ❌ | +| Ethernet | Libraries | ❌ | +| RTC | Libraries | ❌ | +| WiFi | Libraries | ❌ | +| USB Peripherals | Libraries | ❌ | + +--- + +#### Reference Links + +| Resource | URL | +|----------|-----| +| Arduino API Reference | https://www.arduino.cc/reference/en/ | +| Arduino API Programming Reference | https://docs.arduino.cc/learn/programming/reference/ | +| ArduinoCore-API (source of truth) | https://github.com/arduino/ArduinoCore-API | +| ArduinoCore-API `/api` folder | https://github.com/arduino/ArduinoCore-API/tree/master/api | \ No newline at end of file diff --git a/boards.txt b/boards.txt index e7b6325a1..0053aafb3 100644 --- a/boards.txt +++ b/boards.txt @@ -25,7 +25,7 @@ menu.wait_linux_boot=Startup mode giga.name=Arduino Giga R1 giga.build.core=arduino giga.build.crossprefix=arm-zephyr-eabi- -giga.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +giga.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ giga.menu.debug.false=Standard giga.menu.debug.true=Debug @@ -39,23 +39,20 @@ giga.menu.link_mode.static.upload.extension=bin-zsk.bin giga.build.zephyr_target=arduino_giga_r1//m7 giga.build.zephyr_args=--shield arduino_giga_display_shield giga.build.zephyr_hals=hal_stm32 hal_infineon +giga.build.zephyr_toolchain=arm-zephyr-eabi giga.build.variant=arduino_giga_r1_stm32h747xx_m7 giga.build.artifact=zephyr_main giga.build.extra_flags= giga.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit giga.build.board=GIGA -giga.vid.0=0x2341 -giga.pid.0=0x0066 giga.upload_port.0.vid=0x2341 -giga.upload_port.0.pid=0x0066 +giga.upload_port.0.pid=0x0666 giga.upload.tool=dfu-util giga.upload.tool.default=dfu-util giga.upload.protocol= giga.upload.transport= -giga.upload.vid=0x2341 -giga.upload.pid=0x0366 giga.upload.interface=0 giga.upload.use_1200bps_touch=true giga.upload.wait_for_upload_port=true @@ -63,7 +60,6 @@ giga.upload.native_usb=true giga.bootloader.tool=dfu-util giga.bootloader.tool.default=dfu-util -giga.bootloader.vid=0x2341 giga.bootloader.pid=0x0366 giga.bootloader.interface=0 giga.bootloader.file=zephyr-{build.variant}.bin @@ -81,7 +77,7 @@ giga.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd nano33ble.name=Arduino Nano 33 BLE nano33ble.build.core=arduino nano33ble.build.crossprefix=arm-zephyr-eabi- -nano33ble.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +nano33ble.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ nano33ble.menu.debug.false=Standard nano33ble.menu.debug.true=Debug @@ -95,24 +91,20 @@ nano33ble.menu.link_mode.static.upload.extension=bin-zsk.bin nano33ble.build.zephyr_target=arduino_nano_33_ble//sense nano33ble.build.zephyr_args= nano33ble.build.zephyr_hals=hal_nordic +nano33ble.build.zephyr_toolchain=arm-zephyr-eabi nano33ble.build.artifact=zephyr_main nano33ble.build.variant=arduino_nano_33_ble_nrf52840_sense nano33ble.build.extra_flags= nano33ble.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit nano33ble.build.board=NANO33BLE -nano33ble.vid.0=0x2341 -nano33ble.pid.0=0x035a nano33ble.upload_port.0.vid=0x2341 -nano33ble.upload_port.0.pid=0x005a +nano33ble.upload_port.0.pid=0x065a nano33ble.upload.tool=bossac nano33ble.upload.tool.default=bossac nano33ble.upload.protocol= nano33ble.upload.transport= -nano33ble.upload.vid=0x2341 -nano33ble.upload.pid=0x005a -nano33ble.upload.interface=0 nano33ble.upload.use_1200bps_touch=true nano33ble.upload.wait_for_upload_port=true nano33ble.upload.native_usb=true @@ -120,9 +112,6 @@ nano33ble.upload.offset=0x10000 # bootloader skips its own partition nano33ble.bootloader.tool=bossac nano33ble.bootloader.tool.default=bossac -nano33ble.bootloader.vid=0x2341 -nano33ble.bootloader.pid=0x035b -nano33ble.bootloader.interface=0 nano33ble.bootloader.file=zephyr-{build.variant}.bin nano33ble.bootloader.address=0x0000 @@ -137,7 +126,7 @@ nano33ble.debug.cortex-debug.custom.request=attach ek_ra8d1.name=Renesas RA8D1 EK ek_ra8d1.build.core=arduino ek_ra8d1.build.crossprefix=arm-zephyr-eabi- -ek_ra8d1.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +ek_ra8d1.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ ek_ra8d1.menu.debug.false=Standard ek_ra8d1.menu.debug.true=Debug @@ -151,6 +140,7 @@ ek_ra8d1.menu.link_mode.static.upload.extension=bin-zsk.bin ek_ra8d1.build.zephyr_target=ek_ra8d1 ek_ra8d1.build.zephyr_args= ek_ra8d1.build.zephyr_hals=hal_renesas +ek_ra8d1.build.zephyr_toolchain=arm-zephyr-eabi ek_ra8d1.build.variant=ek_ra8d1_r7fa8d1bhecbd ek_ra8d1.build.extra_flags= @@ -160,18 +150,13 @@ ek_ra8d1.build.board=EK_RA8D1 #ek_ra8d1.recipe.hooks.objcopy.postobjcopy.4.pattern=cp {build.variant.path}/flasher.jlink "{build.path}/flasher.jlink" #ek_ra8d1.recipe.hooks.objcopy.postobjcopy.5.pattern=sed -i 's|SKETCH|"{build.path}/{build.project_name}.llext.dfu.bin"|g' "{build.path}/flasher.jlink" -ek_ra8d1.vid.0=0x2341 -ek_ra8d1.pid.0=0x0077 -ek_ra8d1.upload_port.0.vid=0x2341 -ek_ra8d1.upload_port.0.pid=0x0077 +ek_ra8d1.upload_port.0.vid=0x045b +ek_ra8d1.upload_port.0.pid=0x0261 ek_ra8d1.upload.tool=pyocd ek_ra8d1.upload.tool.default=pyocd ek_ra8d1.upload.protocol= ek_ra8d1.upload.transport= -ek_ra8d1.upload.vid=0x2341 -ek_ra8d1.upload.pid=0x0366 -ek_ra8d1.upload.interface=0 ek_ra8d1.upload.use_1200bps_touch=false ek_ra8d1.upload.wait_for_upload_port=false ek_ra8d1.upload.native_usb=true @@ -188,7 +173,7 @@ ek_ra8d1.bootloader.target=R7FA8D1AH frdm_mcxn947.name=NXP FRDM MCXN947 frdm_mcxn947.build.core=arduino frdm_mcxn947.build.crossprefix=arm-zephyr-eabi- -frdm_mcxn947.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +frdm_mcxn947.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ frdm_mcxn947.menu.debug.false=Standard frdm_mcxn947.menu.debug.true=Debug @@ -202,13 +187,12 @@ frdm_mcxn947.menu.link_mode.static.upload.extension=bin-zsk.bin frdm_mcxn947.build.zephyr_target=frdm_mcxn947//cpu0 frdm_mcxn947.build.zephyr_args= frdm_mcxn947.build.zephyr_hals=hal_nxp +frdm_mcxn947.build.zephyr_toolchain=arm-zephyr-eabi frdm_mcxn947.build.variant=frdm_mcxn947_mcxn947_cpu0 frdm_mcxn947.build.extra_flags= frdm_mcxn947.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit frdm_mcxn947.build.board=FRDM_MCXN947 -frdm_mcxn947.vid.0=0x1fc9 -frdm_mcxn947.pid.0=0x0143 frdm_mcxn947.upload_port.0.vid=0x1fc9 frdm_mcxn947.upload_port.0.pid=0x0143 frdm_mcxn947.upload.target=mcxn947vdf @@ -217,9 +201,6 @@ frdm_mcxn947.upload.tool=pyocd frdm_mcxn947.upload.tool.default=pyocd frdm_mcxn947.upload.protocol= frdm_mcxn947.upload.transport= -frdm_mcxn947.upload.vid=0x1fc9 -frdm_mcxn947.upload.pid=0x0143 -frdm_mcxn947.upload.interface=0 frdm_mcxn947.upload.use_1200bps_touch=false frdm_mcxn947.upload.wait_for_upload_port=false frdm_mcxn947.upload.native_usb=true @@ -235,7 +216,7 @@ frdm_mcxn947.bootloader.target=mcxn947vdf portentah7.name=Arduino Portenta H7 portentah7.build.core=arduino portentah7.build.crossprefix=arm-zephyr-eabi- -portentah7.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +portentah7.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ portentah7.menu.debug.false=Standard portentah7.menu.debug.true=Debug @@ -249,23 +230,20 @@ portentah7.menu.link_mode.static.upload.extension=bin-zsk.bin portentah7.build.zephyr_target=arduino_portenta_h7@1.0.0//m7 portentah7.build.zephyr_args= portentah7.build.zephyr_hals=hal_stm32 hal_infineon +portentah7.build.zephyr_toolchain=arm-zephyr-eabi portentah7.build.artifact=zephyr_main portentah7.build.variant=arduino_portenta_h7_stm32h747xx_m7 portentah7.build.extra_flags= portentah7.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit portentah7.build.board=PORTENTA_H7_M7 -portentah7.vid.0=0x2341 -portentah7.pid.0=0x005b portentah7.upload_port.0.vid=0x2341 -portentah7.upload_port.0.pid=0x035b +portentah7.upload_port.0.pid=0x065b portentah7.upload.tool=dfu-util portentah7.upload.tool.default=dfu-util portentah7.upload.protocol= portentah7.upload.transport= -portentah7.upload.vid=0x2341 -portentah7.upload.pid=0x035b portentah7.upload.interface=0 portentah7.upload.use_1200bps_touch=true portentah7.upload.wait_for_upload_port=true @@ -273,7 +251,6 @@ portentah7.upload.native_usb=true portentah7.bootloader.tool=dfu-util portentah7.bootloader.tool.default=dfu-util -portentah7.bootloader.vid=0x2341 portentah7.bootloader.pid=0x035b portentah7.bootloader.interface=0 portentah7.bootloader.file=zephyr-{build.variant}.bin @@ -291,7 +268,7 @@ portentah7.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd nicla_vision.name=Arduino Nicla Vision nicla_vision.build.core=arduino nicla_vision.build.crossprefix=arm-zephyr-eabi- -nicla_vision.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +nicla_vision.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ nicla_vision.menu.debug.false=Standard nicla_vision.menu.debug.true=Debug @@ -305,23 +282,20 @@ nicla_vision.menu.link_mode.static.upload.extension=bin-zsk.bin nicla_vision.build.zephyr_target=arduino_nicla_vision//m7 nicla_vision.build.zephyr_args= nicla_vision.build.zephyr_hals=hal_stm32 hal_infineon +nicla_vision.build.zephyr_toolchain=arm-zephyr-eabi nicla_vision.build.artifact=zephyr_main nicla_vision.build.variant=arduino_nicla_vision_stm32h747xx_m7 nicla_vision.build.extra_flags= nicla_vision.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit nicla_vision.build.board=NICLA_VISION -nicla_vision.vid.0=0x2341 -nicla_vision.pid.0=0x005b nicla_vision.upload_port.0.vid=0x2341 -nicla_vision.upload_port.0.pid=0x025f +nicla_vision.upload_port.0.pid=0x065f nicla_vision.upload.tool=dfu-util nicla_vision.upload.tool.default=dfu-util nicla_vision.upload.protocol= nicla_vision.upload.transport= -nicla_vision.upload.vid=0x2341 -nicla_vision.upload.pid=0x035f nicla_vision.upload.interface=0 nicla_vision.upload.use_1200bps_touch=true nicla_vision.upload.wait_for_upload_port=true @@ -329,7 +303,6 @@ nicla_vision.upload.native_usb=true nicla_vision.bootloader.tool=dfu-util nicla_vision.bootloader.tool.default=dfu-util -nicla_vision.bootloader.vid=0x2341 nicla_vision.bootloader.pid=0x035f nicla_vision.bootloader.interface=0 nicla_vision.bootloader.file=zephyr-{build.variant}.bin @@ -347,7 +320,7 @@ nicla_vision.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd frdm_rw612.name=NXP FRDM RW612 frdm_rw612.build.core=arduino frdm_rw612.build.crossprefix=arm-zephyr-eabi- -frdm_rw612.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +frdm_rw612.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ frdm_rw612.menu.debug.false=Standard frdm_rw612.menu.debug.true=Debug @@ -361,13 +334,12 @@ frdm_rw612.menu.link_mode.static.upload.extension=bin-zsk.bin frdm_rw612.build.zephyr_target=frdm_rw612 frdm_rw612.build.zephyr_args= frdm_rw612.build.zephyr_hals=hal_stm32 +frdm_rw612.build.zephyr_toolchain=arm-zephyr-eabi frdm_rw612.build.variant=frdm_rw612_rw612 frdm_rw612.build.extra_flags= frdm_rw612.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit frdm_rw612.build.board=FRDM_RW612 -frdm_rw612.vid.0=0x1fc9 -frdm_rw612.pid.0=0x0143 frdm_rw612.upload_port.0.vid=0x1fc9 frdm_rw612.upload_port.0.pid=0x0143 frdm_rw612.upload.target=rw612 @@ -376,9 +348,6 @@ frdm_rw612.upload.tool=pyocd frdm_rw612.upload.tool.default=pyocd frdm_rw612.upload.protocol= frdm_rw612.upload.transport= -frdm_rw612.upload.vid=0x1fc9 -frdm_rw612.upload.pid=0x0143 -frdm_rw612.upload.interface=0 frdm_rw612.upload.use_1200bps_touch=false frdm_rw612.upload.wait_for_upload_port=false frdm_rw612.upload.native_usb=true @@ -393,7 +362,7 @@ frdm_rw612.bootloader.target=rw612 nicla_sense.name=Arduino Nicla Sense ME nicla_sense.build.core=arduino nicla_sense.build.crossprefix=arm-zephyr-eabi- -nicla_sense.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +nicla_sense.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ nicla_sense.menu.link_mode.dynamic=Dynamic nicla_sense.menu.link_mode.static=Static @@ -403,6 +372,7 @@ nicla_sense.menu.link_mode.static.upload.extension=bin-zsk.bin nicla_sense.build.zephyr_target=arduino_nicla_sense_me nicla_sense.build.zephyr_args= nicla_sense.build.zephyr_hals=hal_nordic +nicla_sense.build.zephyr_toolchain=arm-zephyr-eabi nicla_sense.build.artifact=zephyr_main nicla_sense.build.variant=arduino_nicla_sense_me_nrf52832 @@ -410,8 +380,6 @@ nicla_sense.openocd_cfg=flash_sketch.cfg nicla_sense.build.extra_flags= nicla_sense.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit nicla_sense.build.board=NICLA_SENSE_ME -nicla_sense.vid.0=0x2341 -nicla_sense.pid.0=0x0360 nicla_sense.upload_port.0.vid=0x2341 nicla_sense.upload_port.0.pid=0x0060 @@ -420,9 +388,6 @@ nicla_sense.upload.tool.default=openocd nicla_sense.upload.protocol= nicla_sense.upload.config=-f target/nrf52.cfg nicla_sense.upload.programmer=-f interface/cmsis-dap.cfg -nicla_sense.upload.vid=0x2341 -nicla_sense.upload.pid=0x0060 -nicla_sense.upload.interface=0 nicla_sense.upload.use_1200bps_touch=false nicla_sense.upload.wait_for_upload_port=false nicla_sense.upload.native_usb=false @@ -430,9 +395,6 @@ nicla_sense.upload.target=nrf52 nicla_sense.bootloader.tool=openocd nicla_sense.bootloader.tool.default=openocd -nicla_sense.bootloader.vid=0x2341 -nicla_sense.bootloader.pid=0x0360 -nicla_sense.bootloader.interface=0 nicla_sense.bootloader.file=zephyr-{build.variant}.hex nicla_sense.bootloader.target=nrf52 @@ -448,7 +410,7 @@ nicla_sense.debug.cortex-debug.custom.request=attach portentac33.name=Arduino Portenta C33 portentac33.build.core=arduino portentac33.build.crossprefix=arm-zephyr-eabi- -portentac33.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +portentac33.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ portentac33.menu.debug.false=Standard portentac33.menu.debug.true=Debug @@ -462,43 +424,46 @@ portentac33.menu.link_mode.static.upload.extension=bin-zsk.bin portentac33.build.zephyr_target=arduino_portenta_c33 portentac33.build.zephyr_args= portentac33.build.zephyr_hals=hal_renesas nanopb +portentac33.build.zephyr_toolchain=arm-zephyr-eabi portentac33.build.artifact=zephyr_main portentac33.build.variant=arduino_portenta_c33_r7fa6m5bh3cfc portentac33.build.extra_flags= portentac33.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit portentac33.build.board=PORTENTA_C33 -portentac33.vid.0=0x2341 -portentac33.pid.0=0x0068 portentac33.upload_port.0.vid=0x2341 -portentac33.upload_port.0.pid=0x0068 +portentac33.upload_port.0.pid=0x0668 portentac33.upload.target=portentac33 portentac33.upload.tool=dfu-util portentac33.upload.tool.default=dfu-util portentac33.upload.protocol= portentac33.upload.transport= -portentac33.upload.vid=0x2341 -portentac33.upload.pid=0x0368 portentac33.upload.interface=1 portentac33.upload.use_1200bps_touch=true portentac33.upload.wait_for_upload_port=false portentac33.upload.native_usb=true -portentac33.upload.dfuse=-Q -w +portentac33.upload.dfuse= portentac33.bootloader.tool=dfu-util portentac33.bootloader.tool.default=dfu-util portentac33.bootloader.file=zephyr-{build.variant}.bin portentac33.bootloader.interface=0 portentac33.bootloader.address=0x10000 -portentac33.bootloader.dfuse=-Q +portentac33.bootloader.pid=0x0368 +portentac33.bootloader.dfuse= + +# the space before the extra arguments is important +portentac33.leave.dfuse={empty} -Q +portentac33.loader.args.with_sketch={empty} -w +portentac33.sketch.args.without_loader={empty} -w ########################################################################################## opta.name=Arduino Opta opta.build.core=arduino opta.build.crossprefix=arm-zephyr-eabi- -opta.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +opta.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ opta.menu.debug.false=Standard opta.menu.debug.true=Debug @@ -512,23 +477,20 @@ opta.menu.link_mode.static.upload.extension=bin-zsk.bin opta.build.zephyr_target=arduino_opta//m7 opta.build.zephyr_args= opta.build.zephyr_hals=hal_stm32 hal_infineon +opta.build.zephyr_toolchain=arm-zephyr-eabi opta.build.artifact=zephyr_main opta.build.variant=arduino_opta_stm32h747xx_m7 opta.build.extra_flags= opta.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit opta.build.board=OPTA -opta.vid.0=0x2341 -opta.pid.0=0x0064 opta.upload_port.0.vid=0x2341 -opta.upload_port.0.pid=0x0364 +opta.upload_port.0.pid=0x0664 opta.upload.tool=dfu-util opta.upload.tool.default=dfu-util opta.upload.protocol= opta.upload.transport= -opta.upload.vid=0x2341 -opta.upload.pid=0x0364 opta.upload.interface=0 opta.upload.use_1200bps_touch=true opta.upload.wait_for_upload_port=true @@ -536,7 +498,6 @@ opta.upload.native_usb=true opta.bootloader.tool=dfu-util opta.bootloader.tool.default=dfu-util -opta.bootloader.vid=0x2341 opta.bootloader.pid=0x0364 opta.bootloader.interface=0 opta.bootloader.file=zephyr-{build.variant}.bin @@ -554,7 +515,7 @@ opta.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd nano_matter.name=Arduino Nano Matter nano_matter.build.core=arduino nano_matter.build.crossprefix=arm-zephyr-eabi- -nano_matter.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +nano_matter.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ nano_matter.menu.link_mode.dynamic=Dynamic nano_matter.menu.link_mode.static=Static @@ -564,6 +525,7 @@ nano_matter.menu.link_mode.static.upload.extension=bin-zsk.bin nano_matter.build.zephyr_target=arduino_nano_matter nano_matter.build.zephyr_args= nano_matter.build.zephyr_hals=hal_silabs +nano_matter.build.zephyr_toolchain=arm-zephyr-eabi nano_matter.build.artifact=zephyr_main nano_matter.build.variant=arduino_nano_matter_mgm240sd22vna @@ -571,8 +533,6 @@ nano_matter.openocd_cfg=flash_sketch.cfg nano_matter.build.extra_flags= nano_matter.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit nano_matter.build.board=ARDUINO_NANO_MATTER -nano_matter.vid.0=0x2341 -nano_matter.pid.0=0x0072 nano_matter.upload_port.0.vid=0x2341 nano_matter.upload_port.0.pid=0x0072 @@ -588,9 +548,6 @@ nano_matter.upload.native_usb=false nano_matter.bootloader.tool=openocd nano_matter.bootloader.tool.default=openocd -nano_matter.bootloader.vid=0x2341 -nano_matter.bootloader.pid=0x0072 -nano_matter.bootloader.interface=0 nano_matter.bootloader.file=zephyr-{build.variant}.hex nano_matter.bootloader.target=arduino_nano_matter @@ -612,7 +569,7 @@ nano_matter.debug.cortex-debug.custom.request=attach unoq.name=Arduino UNO Q unoq.build.core=arduino unoq.build.crossprefix=arm-zephyr-eabi- -unoq.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +unoq.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ unoq.menu.link_mode.dynamic=Dynamic unoq.menu.link_mode.static=Static @@ -627,6 +584,8 @@ unoq.menu.wait_linux_boot.app.build.boot_mode=app unoq.build.zephyr_target=arduino_uno_q unoq.build.zephyr_args= +unoq.build.zephyr_hals=hal_stm32 +unoq.build.zephyr_toolchain=arm-zephyr-eabi unoq.build.variant=arduino_uno_q_stm32u585xx unoq.build.artifact=zephyr_unoq unoq.build.subarch=zephyr @@ -635,10 +594,6 @@ unoq.openocd_cfg=flash_sketch.cfg unoq.build.extra_flags= unoq.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit unoq.build.board=UNO_Q -unoq.build.zephyr_hals=hal_stm32 -unoq.build.zephyr_toolchain=arm-zephyr-eabi -unoq.vid.0=0x2341 -unoq.pid.0=0x0078 unoq.upload_port.0.vid=0x2341 unoq.upload_port.0.pid=0x0078 unoq.upload.target=stm32u585zitxq @@ -648,9 +603,6 @@ unoq.upload.tool.default=remoteocd unoq.upload.tool.network=remoteocd_network unoq.upload.protocol= unoq.upload.transport= -unoq.upload.vid=0x2341 -unoq.upload.pid=0x0078 -unoq.upload.interface=0 unoq.upload.use_1200bps_touch=false unoq.upload.wait_for_upload_port=false unoq.upload.native_usb=true @@ -665,7 +617,7 @@ unoq.bootloader.target=stm32u585zitxq nano_connect.name=Arduino Nano RP2040 Connect nano_connect.build.core=arduino nano_connect.build.crossprefix=arm-zephyr-eabi- -nano_connect.build.compiler_path={runtime.tools.arm-zephyr-eabi-0.16.8.path}/bin/ +nano_connect.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ nano_connect.menu.debug.false=Standard nano_connect.menu.debug.true=Debug @@ -679,46 +631,31 @@ nano_connect.menu.link_mode.static.upload.extension=bin-zsk.bin nano_connect.build.zephyr_target=arduino_nano_connect nano_connect.build.zephyr_args= nano_connect.build.zephyr_hals=hal_rpi_pico +nano_connect.build.zephyr_toolchain=arm-zephyr-eabi nano_connect.build.artifact=zephyr_main nano_connect.build.variant=arduino_nano_connect_rp2040 -nano_connect.build.mcu=cortex-m0plus -nano_connect.build.fpu= -nano_connect.build.architecture=cortex-m0plus -nano_connect.compiler.zephyr.arch.define= -nano_connect.build.float-abi=-mfloat-abi=soft nano_connect.build.extra_flags= nano_connect.build.postbuild.cmd="{tools.imgtool.path}/{tools.imgtool.cmd}" exit -nano_connect.recipe.hooks.objcopy.postobjcopy.3.pattern="{runtime.tools.bin2uf2.path}/bin2uf2" {upload.address} {upload.familyid} "{build.path}/{build.project_name}.{upload.extension}" "{build.path}/{build.project_name}.uf2" +nano_connect.recipe.hooks.objcopy.postobjcopy.3.pattern="{runtime.tools.bin2uf2.path}/bin2uf2" {upload.address} {upload.familyid} "{build.path}/{build.project_name}.{upload.extension}" "{build.path}/{build.project_name}.{upload.extension}.uf2" +nano_connect.upload.artifacts.sketch={build.path}/{build.project_name}.{upload.extension}.uf2 nano_connect.build.board=NANO_RP2040_CONNECT -nano_connect.compiler.zephyr= -nano_connect.vid.0=0x2341 -nano_connect.pid.0=0x005E nano_connect.upload_port.0.vid=0x2341 -nano_connect.upload_port.0.pid=0x005E +nano_connect.upload_port.0.pid=0x065E nano_connect.upload.tool=picotool nano_connect.upload.tool.default=picotool nano_connect.upload.protocol= nano_connect.upload.transport= -nano_connect.upload.vid=0x2341 -nano_connect.upload.pid=0x005E -nano_connect.upload.interface=0 nano_connect.upload.use_1200bps_touch=true nano_connect.upload.wait_for_upload_port=false nano_connect.upload.native_usb=true -nano_connect.upload.maximum_size=16777216 -nano_connect.upload.maximum_data_size=270336 -nano_connect.upload.address=0x100E0000 nano_connect.upload.familyid=0xe48bff56 nano_connect.bootloader.tool=picotool nano_connect.bootloader.tool.default=picotool -nano_connect.bootloader.vid=0x2341 -nano_connect.bootloader.pid=0x005E -nano_connect.bootloader.interface=0 -nano_connect.bootloader.file=zephyr-{build.variant} +nano_connect.bootloader.file=zephyr-{build.variant}.uf2 nano_connect.debug.tool=gdb nano_connect.debug.server.openocd.scripts.0=interface/{programmer.protocol}.cfg @@ -728,3 +665,59 @@ nano_connect.debug.cortex-debug.custom.request=attach nano_connect.debug.svd_file={runtime.platform.path}/svd/rp2040.svd ############################################################################################################## + +kit_pse84_ai.name=Infineon KIT-PSE84-AI (PSOC Edge E84) +kit_pse84_ai.build.core=arduino +kit_pse84_ai.build.crossprefix=arm-zephyr-eabi- +kit_pse84_ai.build.compiler_path={runtime.tools.arm-zephyr-eabi-1.0.1.path}/bin/ + +kit_pse84_ai.menu.debug.false=Standard +kit_pse84_ai.menu.debug.true=Debug +kit_pse84_ai.menu.debug.true.build.zsk_args.debug=-debug + +kit_pse84_ai.menu.link_mode.dynamic=Dynamic +kit_pse84_ai.menu.link_mode.static=Static +kit_pse84_ai.menu.link_mode.static.build.link_mode=static +kit_pse84_ai.menu.link_mode.static.upload.extension=bin-zsk.bin + +kit_pse84_ai.build.zephyr_target=kit_pse84_ai/pse846gps2dbzc4a/m33 +kit_pse84_ai.build.zephyr_args= +kit_pse84_ai.build.zephyr_hals=hal_infineon +kit_pse84_ai.build.variant=kit_pse84_ai_pse846gps2dbzc4a_m33 +kit_pse84_ai.build.mcu=cortex-m33 +kit_pse84_ai.build.fpu=-mfpu=fpv5-sp-d16 +kit_pse84_ai.build.architecture=cortex-m33 +kit_pse84_ai.build.float-abi=-mfloat-abi=hard +kit_pse84_ai.compiler.zephyr.specs= +kit_pse84_ai.build.extra_flags= +kit_pse84_ai.build.specs= +kit_pse84_ai.build.link_command="{compiler.path}{compiler.c.elf.cmd}" "-L{build.path}" "-L{build.variant.path}" {compiler.c.elf.flags} {compiler.c.elf.extra_flags} {build.extra_flags} {build.extra_ldflags} {compiler.zephyr.common_ldflags} {compiler.ldflags} {object_files} -Wl,--start-group "{build.path}/{archive_file}" {compiler.zephyr.extra_ldflags} {compiler.libraries.ldflags} -Wl,--end-group {build.link_args.{build.link_mode}} +kit_pse84_ai.build.postbuild.cmd="{tools.openocd.path}/{tools.openocd.cmd}" exit +kit_pse84_ai.build.board=KIT_PSE84_AI +kit_pse84_ai.upload.address=0x60200000 +kit_pse84_ai.upload.target=pse84 +kit_pse84_ai.upload.tool=openocd +kit_pse84_ai.upload.tool.default=openocd +kit_pse84_ai.tools.openocd.path={runtime.tools.openocd.path} +kit_pse84_ai.tools.openocd.cmd=bin/openocd +kit_pse84_ai.tools.openocd.cmd.windows=bin/openocd.exe +kit_pse84_ai.programmer.default=cmsis-dap +kit_pse84_ai.tools.openocd.upload.pattern="{path}/{cmd}" {upload.verbose} -s "{path}/scripts/" -s "{path}/share/openocd/scripts/" -s "{runtime.platform.path}/variants/{build.variant}/" -f "{runtime.platform.path}/variants/{build.variant}/openocd.cfg" -c "telnet_port disabled; init; reset init; halt; adapter speed 10000; flash write_image erase {{build.path}/{build.project_name}.{upload.extension}} {upload.address} bin; reset run; shutdown" +kit_pse84_ai.tools.openocd.program.pattern="{path}/{cmd}" {program.verbose} -s "{path}/scripts/" -s "{path}/share/openocd/scripts/" -s "{runtime.platform.path}/variants/{build.variant}/" -f "{runtime.platform.path}/variants/{build.variant}/openocd.cfg" -c "telnet_port disabled; init; reset init; halt; adapter speed 10000; flash write_image erase {{build.path}/{build.project_name}.{upload.extension}} {upload.address} bin; reset run; shutdown" +kit_pse84_ai.tools.openocd.bootloader.pattern="{path}/{cmd}" {bootloader.verbose} -s "{path}/scripts/" -s "{path}/share/openocd/scripts/" -s "{runtime.platform.path}/variants/{build.variant}/" -f "{runtime.platform.path}/variants/{build.variant}/openocd.cfg" -c "telnet_port disabled; init; reset init; halt; adapter speed 10000; program {{runtime.platform.path}/firmwares/zephyr-{build.variant}.hex}; reset run; shutdown" +kit_pse84_ai.tools.openocd.upload.pattern.windows=cmd /C cd /D "{build.path}" && "{path}/{cmd}" {upload.verbose} -s "{path}/scripts/" -s "{path}/share/openocd/scripts/" -s "{runtime.platform.path}/variants/{build.variant}/" -f "{runtime.platform.path}/variants/{build.variant}/openocd.cfg" -c "set sketch_file [list {build.project_name}.{upload.extension}]; telnet_port disabled; init; reset init; halt; adapter speed 10000; flash write_image erase $sketch_file {upload.address} bin; reset run; shutdown" +kit_pse84_ai.tools.openocd.program.pattern.windows=cmd /C cd /D "{build.path}" && "{path}/{cmd}" {program.verbose} -s "{path}/scripts/" -s "{path}/share/openocd/scripts/" -s "{runtime.platform.path}/variants/{build.variant}/" -f "{runtime.platform.path}/variants/{build.variant}/openocd.cfg" -c "set sketch_file [list {build.project_name}.{upload.extension}]; telnet_port disabled; init; reset init; halt; adapter speed 10000; flash write_image erase $sketch_file {upload.address} bin; reset run; shutdown" +kit_pse84_ai.upload.protocol= +kit_pse84_ai.upload.transport= +kit_pse84_ai.upload.interface=0 +kit_pse84_ai.upload.use_1200bps_touch=false +kit_pse84_ai.upload.wait_for_upload_port=false +kit_pse84_ai.upload.native_usb=false +kit_pse84_ai.upload.maximum_size=1047552 +kit_pse84_ai.upload.maximum_data_size=135168 +kit_pse84_ai.bootloader.tool=openocd +kit_pse84_ai.bootloader.tool.default=openocd +kit_pse84_ai.tools.openocd.bootloader.pattern.windows=cmd /C cd /D "{runtime.platform.path}/firmwares" && "{path}/{cmd}" {bootloader.verbose} -s "{path}/scripts/" -s "{path}/share/openocd/scripts/" -s "{runtime.platform.path}/variants/{build.variant}/" -f "{runtime.platform.path}/variants/{build.variant}/openocd.cfg" -c "set bootloader_file [list zephyr-{build.variant}.hex]; telnet_port disabled; init; reset init; halt; adapter speed 10000; program $bootloader_file; reset run; shutdown" +kit_pse84_ai.bootloader.target=pse84 + +############################################################################################################## diff --git a/cores/CMakeLists.txt b/cores/CMakeLists.txt index 3ce59d21d..626fe6b12 100644 --- a/cores/CMakeLists.txt +++ b/cores/CMakeLists.txt @@ -1,15 +1,3 @@ # SPDX-License-Identifier: Apache-2.0 add_subdirectory(arduino) - -zephyr_include_directories(../../ArduinoCore-API/) - -if(NOT DEFINED ARDUINO_BUILD_PATH) -zephyr_sources(../../ArduinoCore-API/api/CanMsg.cpp) -zephyr_sources(../../ArduinoCore-API/api/CanMsgRingbuffer.cpp) -zephyr_sources(../../ArduinoCore-API/api/Common.cpp) -zephyr_sources(../../ArduinoCore-API/api/IPAddress.cpp) -zephyr_sources(../../ArduinoCore-API/api/Print.cpp) -zephyr_sources(../../ArduinoCore-API/api/Stream.cpp) -zephyr_sources(../../ArduinoCore-API/api/String.cpp) -endif() diff --git a/cores/arduino/SerialUSB.h b/cores/arduino/SerialUSB.h index 3be3f419f..b1227df5c 100644 --- a/cores/arduino/SerialUSB.h +++ b/cores/arduino/SerialUSB.h @@ -8,10 +8,11 @@ #include -#if defined(CONFIG_USB_DEVICE_STACK_NEXT) +#if ZARD_BOARD_HAS_SERIALUSB + #include + extern "C" struct usbd_context *usbd_init_device(usbd_msg_cb_t msg_cb); -#endif namespace arduino { @@ -44,15 +45,17 @@ class SerialUSB_ : public ZephyrSerial { private: bool started = false; -#if defined(CONFIG_USB_DEVICE_STACK_NEXT) struct usbd_context *_usbd; int enable_usb_device_next(); static void usbd_next_cb(struct usbd_context *const ctx, const struct usbd_msg *msg); static int usb_disable(); -#endif }; } // namespace arduino +extern arduino::SerialUSB_ SerialUSB; + #if ZARD_FIRST_SERIAL_IS_SERIALUSB extern arduino::SerialUSB_ Serial; #endif + +#endif /* ZARD_BOARD_HAS_SERIALUSB */ diff --git a/cores/arduino/USB.cpp b/cores/arduino/USB.cpp index e152bb33c..5fb6cb165 100644 --- a/cores/arduino/USB.cpp +++ b/cores/arduino/USB.cpp @@ -10,9 +10,8 @@ #include #include -#if ZARD_FIRST_SERIAL_IS_SERIALUSB -const struct device *const usb_dev = - DEVICE_DT_GET(DT_PHANDLE_BY_IDX(DT_PATH(zephyr_user), cdc_acm_serial, 0)); +#if ZARD_BOARD_HAS_SERIALUSB +const struct device *const usb_dev = DEVICE_DT_GET(ZARD_SERIALUSB_PHANDLE); void __attribute__((weak)) _on_1200_bps() { NVIC_SystemReset(); @@ -26,11 +25,10 @@ void arduino::SerialUSB_::baudChangeHandler(const struct device *dev, uint32_t r } } -#if defined(CONFIG_USB_DEVICE_STACK_NEXT) int arduino::SerialUSB_::usb_disable() { // To avoid Cannot perform port reset: 1200-bps touch: setting DTR to OFF: protocol error k_sleep(K_MSEC(100)); - return usbd_disable(Serial._usbd); + return usbd_disable(SerialUSB._usbd); } void arduino::SerialUSB_::usbd_next_cb(struct usbd_context *const ctx, const struct usbd_msg *msg) { @@ -46,8 +44,8 @@ void arduino::SerialUSB_::usbd_next_cb(struct usbd_context *const ctx, const str if (msg->type == USBD_MSG_CDC_ACM_LINE_CODING) { uint32_t baudrate; - uart_line_ctrl_get(Serial.uart, UART_LINE_CTRL_BAUD_RATE, &baudrate); - Serial.baudChangeHandler(nullptr, baudrate); + uart_line_ctrl_get(SerialUSB.uart, UART_LINE_CTRL_BAUD_RATE, &baudrate); + SerialUSB.baudChangeHandler(nullptr, baudrate); } } @@ -67,7 +65,6 @@ int arduino::SerialUSB_::enable_usb_device_next(void) { } return 0; } -#endif /* defined(CONFIG_USB_DEVICE_STACK_NEXT) */ void arduino::SerialUSB_::begin(unsigned long baudrate, uint16_t config) { if (!started) { @@ -87,23 +84,33 @@ void arduino::SerialUSB_::begin(unsigned long baudrate, uint16_t config) { } arduino::SerialUSB_::operator bool() { - uart_line_ctrl_get(uart, UART_LINE_CTRL_DTR, &dtr); - return dtr; + int old_dtr = dtr; + int ret = uart_line_ctrl_get(uart, UART_LINE_CTRL_DTR, &dtr); + ret = dtr && (ret == 0); + if (ret && old_dtr == 0) { + k_sleep(K_MSEC(1)); + } + return ret; } size_t arduino::SerialUSB_::write(const uint8_t *buffer, size_t size) { - if (!Serial) { + if (!SerialUSB) { return 0; } return arduino::ZephyrSerial::write(buffer, size); } void arduino::SerialUSB_::flush() { - if (!Serial) { + if (!SerialUSB) { return; } arduino::ZephyrSerial::flush(); } -arduino::SerialUSB_ Serial(usb_dev); +arduino::SerialUSB_ SerialUSB(usb_dev); + +#if ZARD_FIRST_SERIAL_IS_SERIALUSB +extern arduino::SerialUSB_ Serial [[gnu::alias("SerialUSB")]]; +#endif + #endif diff --git a/cores/arduino/abi.cpp b/cores/arduino/abi.cpp index 457b56732..60e98d102 100644 --- a/cores/arduino/abi.cpp +++ b/cores/arduino/abi.cpp @@ -23,4 +23,130 @@ int __cxa_atexit(void (*func)(void *), void *arg, void *dso_handle) { return 0; } +// C++ exception ABI / unwinder stubs. +// +// Sketches are compiled with -fno-exceptions, but the precompiled libstdc++ +// archive is not. Using std::string / std::error_code pulls in objects such as +// functexcept.o and system_error.o whose throw and cleanup paths still reference +// the full exception-handling and stack-unwinding ABI: +// - libstdc++ eh_*.o (__cxa_throw, __cxa_*catch, __cxa_*cleanup, ...) +// - libgcc unwinder (_Unwind_*, __aeabi_unwind_cpp_pr0/1/2, +// __gnu_Unwind_Find_exidx, __exidx_start/__exidx_end) +// +// A sketch is loaded as an llext (relocatable object) at runtime. The llext +// loader resolves undefined symbols against the firmware's export table; the +// firmware exports none of the unwinder symbols above, so loading fails with +// "Undefined symbol ... __gnu_Unwind_Find_exidx / __exidx_start / __exidx_end". +// Pulling the libgcc unwinder in (e.g. via -lgcc) does not help: its personality +// routines reference __gnu_Unwind_Find_exidx and the linker-defined __exidx_* +// bounds, which simply do not exist in a relocatable llext. +// +// Providing strong stubs for the whole exception ABI here keeps every libstdc++ +// eh_*.o and the libgcc unwinder OUT of the sketch, so the llext is fully +// self-contained and links/loads cleanly. None of these can be reached at +// runtime because no exception is ever actually thrown; abort() guards misuse. +// +// The link recipe forces this object to be pulled before libstdc++ is scanned +// (see -Wl,-u,__cxa_allocate_exception in platform.txt) so these definitions win +// over the archive members instead of colliding with them. +void *__cxa_allocate_exception(size_t thrown_size) { + (void)thrown_size; // unused + abort(); +} + +void __cxa_free_exception(void *thrown_exception) { + (void)thrown_exception; // unused +} + +void *__cxa_allocate_dependent_exception(void) { + abort(); +} + +void __cxa_free_dependent_exception(void *dependent_exception) { + (void)dependent_exception; // unused +} + +void __cxa_throw(void *thrown_exception, void *tinfo, void (*dest)(void *)) { + (void)thrown_exception; + (void)tinfo; + (void)dest; + abort(); +} + +void __cxa_rethrow(void) { + abort(); +} + +void *__cxa_begin_catch(void *exc) { + (void)exc; + abort(); +} + +void __cxa_end_catch(void) { +} + +void __cxa_begin_cleanup(void *exc) { + (void)exc; + abort(); +} + +void __cxa_end_cleanup(void) { + abort(); +} + +void *__cxa_type_match(void *exc, const void *catch_type, bool is_ref, void **obj) { + (void)exc; + (void)catch_type; + (void)is_ref; + (void)obj; + abort(); +} + +void __cxa_call_unexpected(void *exc) { + (void)exc; + abort(); +} + +int __gxx_personality_v0(int version, int actions, unsigned exc_class, void *exc, void *ctx) { + (void)version; + (void)actions; + (void)exc_class; + (void)exc; + (void)ctx; + abort(); +} + +void _Unwind_Resume(void *exc) { + (void)exc; + abort(); +} + +// ARM EABI compact-model personality routines referenced by the exception +// tables of the libstdc++ objects above. Stubbing them prevents the libgcc +// unwinder (and its __gnu_Unwind_Find_exidx / __exidx_* references) from being +// pulled in. +int __aeabi_unwind_cpp_pr0(void) { + abort(); +} + +int __aeabi_unwind_cpp_pr1(void) { + abort(); +} + +int __aeabi_unwind_cpp_pr2(void) { + abort(); +} + +// picolibc strerror() hook. std::error_code::message() (system_error.o) calls +// __xpg_strerror_r() which references the weak picolibc hook _user_strerror. +// It is not provided by the firmware, so define it here (no custom error +// strings -> fall back to picolibc's built-in table) to keep the llext +// self-contained. +char *_user_strerror(int errnum, int internal, int *errptr) { + (void)errnum; + (void)internal; + (void)errptr; + return 0; +} + } /* extern "C" */ diff --git a/cores/arduino/api b/cores/arduino/api deleted file mode 120000 index d32ec6953..000000000 --- a/cores/arduino/api +++ /dev/null @@ -1 +0,0 @@ -../../../modules/lib/ArduinoCore-API/api/ \ No newline at end of file diff --git a/cores/arduino/llext_wrappers.c b/cores/arduino/llext_wrappers.c index 8a307ead6..0ea624939 100644 --- a/cores/arduino/llext_wrappers.c +++ b/cores/arduino/llext_wrappers.c @@ -12,6 +12,7 @@ #include #include +#include /* ret func(void) */ #define W0(ret, name) \ @@ -118,6 +119,10 @@ W3(void *, memchr, const void *, int, size_t) W1(char *, strdup, const char *) W4(void *, memmem, const void *, size_t, const void *, size_t); +/* XSI strerror_r (picolibc symbol). Keeps libstdc++'s std::error_code + * message() path from bundling _strerror_r and its message table per sketch. */ +W3(int, __xpg_strerror_r, int, char *, size_t) + /* stdlib.h - conversion */ W2(double, strtod, const char *, char **) W3(long, strtol, const char *, char **, int) @@ -195,8 +200,17 @@ VN(__aeabi_dcmple) VN(__aeabi_dcmpgt) VN(__aeabi_dcmpge) VN(__aeabi_dcmpun) +/* float arithmetic */ +VN(__aeabi_fadd) +VN(__aeabi_fsub) +VN(__aeabi_fmul) +VN(__aeabi_fdiv) /* float comparisons */ +VN(__aeabi_fcmpeq) +VN(__aeabi_fcmplt) VN(__aeabi_fcmple) +VN(__aeabi_fcmpgt) +VN(__aeabi_fcmpge) VN(__aeabi_fcmpun) /* double <-> integer conversions */ VN(__aeabi_d2iz) @@ -209,6 +223,10 @@ VN(__aeabi_ul2d) /* float <-> double / integer conversions */ VN(__aeabi_d2f) VN(__aeabi_f2d) +VN(__aeabi_i2f) +VN(__aeabi_ui2f) +VN(__aeabi_f2iz) +VN(__aeabi_f2uiz) VN(__aeabi_l2f) VN(__aeabi_ul2f) /* integer division */ @@ -235,6 +253,74 @@ W1(int, puts, const char *) W1(int, putchar, int) W4(int, vsnprintf, char *, size_t, const char *, va_list) +/* time.h */ +W2(int, gettimeofday, struct timeval *, void *) + +#ifdef CONFIG_STACK_CANARIES +/* zephyr/posix/unistd.h */ +W2(int, getentropy, void *, size_t) +#endif + +/* + * Variadic stdio functions cannot be expressed with the tail-call wrapper + * macros above. Provide explicit trampolines that capture the argument list + * and forward to the corresponding v* form, which is bound at load time. + * Defining these strong symbols in the core makes them win over the archive + * members during the sketch link, keeping picolibc's sscanf/vfscanf/vfprintf + * and the __atod_engine/__atof_engine float helpers out of the sketch llext. + */ +extern int __real_vprintf(const char *, va_list); + +int printf(const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + int ret = __real_vprintf(fmt, ap); + va_end(ap); + return ret; +} + +extern int __real_vsprintf(char *, const char *, va_list); + +int sprintf(char *str, const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + int ret = __real_vsprintf(str, fmt, ap); + va_end(ap); + return ret; +} + +int snprintf(char *str, size_t size, const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + int ret = __real_vsnprintf(str, size, fmt, ap); + va_end(ap); + return ret; +} + +extern int __real_vsscanf(const char *, const char *, va_list); + +int sscanf(const char *str, const char *fmt, ...) { + va_list ap; + va_start(ap, fmt); + int ret = __real_vsscanf(str, fmt, ap); + va_end(ap); + return ret; +} + +/* Direct va_list variants: same forwarding, exposed under their own names so a + * sketch calling them directly does not pull picolibc's vfprintf/vfscanf. */ +int vprintf(const char *fmt, va_list ap) { + return __real_vprintf(fmt, ap); +} + +int vsprintf(char *str, const char *fmt, va_list ap) { + return __real_vsprintf(str, fmt, ap); +} + +int vsscanf(const char *str, const char *fmt, va_list ap) { + return __real_vsscanf(str, fmt, ap); +} + /* stdlib.h - atexit */ typedef void (*__atexit_fn)(void); W1(int, atexit, __atexit_fn) diff --git a/cores/arduino/main.cpp b/cores/arduino/main.cpp index 88bc19327..19fc55810 100644 --- a/cores/arduino/main.cpp +++ b/cores/arduino/main.cpp @@ -24,8 +24,8 @@ void __attribute__((weak)) __loopHook(void) { } int main(void) { -#if ZARD_FIRST_SERIAL_IS_SERIALUSB - Serial.begin(115200); +#if ZARD_BOARD_HAS_SERIALUSB + SerialUSB.begin(115200); #endif initVariant(); diff --git a/cores/arduino/usb_device_descriptor.c b/cores/arduino/usb_device_descriptor.c index 646bd84d7..0643c69ca 100644 --- a/cores/arduino/usb_device_descriptor.c +++ b/cores/arduino/usb_device_descriptor.c @@ -11,6 +11,7 @@ #include #include +#include #ifdef CONFIG_USB_DEVICE_STACK_NEXT @@ -32,8 +33,8 @@ USBD_DESC_PRODUCT_DEFINE(sample_product, CONFIG_USB_DEVICE_PRODUCT); USBD_DESC_SERIAL_NUMBER_DEFINE(sample_sn); /* doc string instantiation end */ -USBD_DESC_CONFIG_DEFINE(fs_cfg_desc, "FS Configuration"); -USBD_DESC_CONFIG_DEFINE(hs_cfg_desc, "HS Configuration"); +USBD_DESC_CONFIG_DEFINE(fs_cfg_desc, APP_VERSION_EXTENDED_STRING); +USBD_DESC_CONFIG_DEFINE(hs_cfg_desc, APP_VERSION_EXTENDED_STRING); /* doc configuration instantiation start */ static const uint8_t attributes = 0; diff --git a/cores/arduino/zephyrSerial.h b/cores/arduino/zephyrSerial.h index b4e771e16..e2a52c907 100644 --- a/cores/arduino/zephyrSerial.h +++ b/cores/arduino/zephyrSerial.h @@ -121,18 +121,41 @@ class ZephyrSerial : public HardwareSerial { #define ZARD_SERIAL_INDEXOF(node) \ DT_FOREACH_PROP_ELEM_VARGS(DT_PATH(zephyr_user), serials, ZARD_SERIAL_MATCH, node) +/* Get the name of the Serial object associated with a given node. If the node + * is not in the 'serials' array, then check if it is the SerialUSB node. + */ +#define ZARD_SERIAL_NAME_BY_NODE(node) \ + COND_CODE_0(IS_EMPTY(ZARD_SERIAL_INDEXOF(node)), \ + (ZARD_SERIAL_NAME(ZARD_SERIAL_INDEXOF(node))), \ + (COND_CODE_1(DT_SAME_NODE(node, ZARD_SERIALUSB_PHANDLE), \ + (SerialUSB), (unkown Serial object)))) + /* Serial object associated with the Zephyr console. */ -#define ARDUINO_CONSOLE_SERIAL ZARD_SERIAL_NAME(ZARD_SERIAL_INDEXOF(DT_CHOSEN(zephyr_console))) +#define ARDUINO_CONSOLE_SERIAL ZARD_SERIAL_NAME_BY_NODE(DT_CHOSEN(zephyr_console)) /* Serial object associated with the first HW serial (usually on D0/D1). */ #define ARDUINO_HARDWARE_SERIAL ZARD_SERIAL_NAME(0) +#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), arduino_router_serial) +/* If the board has an arduino,router-serial node, and the currently used + * library has the support, then the 'Serial' object is actually the same as + * the Monitor object in the Arduino_RouterBridge library. + */ +#define ZARD_FIRST_SERIAL_IS_ARDUINO_ROUTER 1 +#define ARDUINO_ROUTER_PHANDLE DT_PROP(DT_PATH(zephyr_user), arduino_router_serial) +#define ARDUINO_ROUTER_SERIAL ZARD_SERIAL_NAME_BY_NODE(ARDUINO_ROUTER_PHANDLE) +#endif + #if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm_serial) /* Devicetree requires a SerialUSB object for 'Serial'. */ -#define ZARD_SKIP_FIRST_SERIAL 1 -#if (CONFIG_USB_CDC_ACM || CONFIG_USBD_CDC_ACM_CLASS) +#if CONFIG_USBD_CDC_ACM_CLASS /* SerialUSB can be compiled in the project. */ +#define ZARD_BOARD_HAS_SERIALUSB 1 +#define ZARD_SERIALUSB_PHANDLE DT_PROP(DT_PATH(zephyr_user), cdc_acm_serial) +/* Router takes precedence as 'Serial' when both are defined. */ +#if !ZARD_FIRST_SERIAL_IS_ARDUINO_ROUTER #define ZARD_FIRST_SERIAL_IS_SERIALUSB 1 +#endif #else /* SerialUSB is required but no driver was enabled for the USB CDC ACM device. * Define a stub Serial object to avoid build errors. @@ -141,15 +164,10 @@ class ZephyrSerial : public HardwareSerial { #endif #endif -#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), arduino_router_serial) -/* If the board has an arduino,router-serial node, and the currently used - * library has the support, then the 'Serial' object is actually the same as - * the Monitor object in the Arduino_RouterBridge library. - */ -#define ZARD_SKIP_FIRST_SERIAL 1 -#define ZARD_FIRST_SERIAL_IS_ARDUINO_ROUTER 1 -#define ARDUINO_ROUTER_PHANDLE DT_PROP(DT_PATH(zephyr_user), arduino_router_serial) -#define ARDUINO_ROUTER_SERIAL ZARD_SERIAL_NAME(ZARD_SERIAL_INDEXOF(ARDUINO_ROUTER_PHANDLE)) +/* If one of the above groups match, they will define the first Serial object */ +#if ZARD_FIRST_SERIAL_IS_SERIALUSB || ZARD_FIRST_SERIAL_IS_ARDUINO_ROUTER || \ + ZARD_FIRST_SERIAL_IS_STUB +#define ZARD_SKIP_FIRST_SERIAL 1 #endif /* Name of a Serial object for a given index. */ diff --git a/doc/KIT_PSE84_AI_Pinout.svg b/doc/KIT_PSE84_AI_Pinout.svg new file mode 100644 index 000000000..f3b7726ba --- /dev/null +++ b/doc/KIT_PSE84_AI_Pinout.svg @@ -0,0 +1,160541 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RADAR + + + R159 + + + + + C71 + + + + + + + C93 + + + + + + + + + + + + + 6 + + 1 + + 9 + + 10 + + 1 + + 19 + + 20 + + 2 + + 1 + + 15 + + 1 + + 1 + + E + + 5 + + A + + 1 + + 2 + + 3 + + 4 + + 4 + + 1 + + A + + M + + 9 + + 13 + + 39 + + 52 + + A + + 1 + + 15 + + A + + R + + 15 + + 1 + + R + + A + + C + + 1 + + 3 + + 2 + + 1 + + AI KIT + + PSOC EDGE E84 + + 1 + + + + -DSI + + + + TM + + PSOC EDGE E84 + + + + MIPI + + + + INPUT + + BATTERY + + + + ( + + + + ( + + RST + + + + ( + + + + USER + + ( + + + + R213 + + + + + + R85 + + + + C81 + + R31 + + + + FB3 + + + + + + C84 + + + + C1 + + C58 + + R73 + + + + C57 + + + + C67 + + + + R210 + + + + C4 + + R8 + + R9 + + R88 + + R87 + + FB10 + + R65 + + R58 + + R54 + + R63 + + R62 + + R52 + + R50 + + R48 + + R46 + + C66 + + DIG + + + + DIG + + + + TM + + ALG + + ALG + + PSE84-USB + + KP3-USB + + J5 + + J4 + + Q9 + + Q7 + + J14 + + J10 + + U3 + + Y4 + + + + R77 + + + + + + R76 + + + + J12 + + SW1 + + SW2 + + Y2 + + C199 + + C198 + + C90 + + C91 + + U22 + + U24 + + Q3 + + U31 + + U27 + + U6 + + U21 + + U5 + + + + LED3 + + + + D14 + + LED5 + + LED2 + + D11 + + LED4 + + LED1 + + L4 + + + + U15 + + + + Y1 + + ANT1 + + U25 + + U1 + + U20 + + U18 + + D15 + + D4 + + R219 + + R211 + + R198 + + R105 + + + + R104 + + + + + + R103 + + + + + + R108 + + + + R32 + + R112 + + R114 + + R56 + + R60 + + R101 + + R1 + + + + R2 + + + + R34 + + + + R5 + + + + R6 + + R33 + + R36 + + R35 + + R37 + + R72 + + + + R86 + + + + R224 + + + + R182 + + + + R197 + + R196 + + R30 + + R124 + + R102 + + R18 + + L7 + + L6 + + + + FB2 + + + + FB1 + + L2 + + L3 + + FB7 + + FB6 + + FB5 + + C96 + + C179 + + C178 + + C177 + + C158 + + C99 + + C97 + + C180 + + C64 + + + + C126 + + + + + + C118 + + + + + + C104 + + + + C59 + + C151 + + C69 + + + + C12 + + + + C3 + + C5 + + + + C6 + + + + + + C72 + + + + C74 + + C76 + + + + C78 + + + + C87 + + C88 + + C82 + + + + C86 + + + + C56 + + C60 + + C63 + + C54 + + + + C55 + + + + C68 + + + + C200 + + + + C107 + + C95 + + C101 + + + + C103 + + + + C185 + + C186 + + + + C73 + + + + C75 + + C77 + + C85 + + + + C89 + + + + C92 + + C83 + + J3 + + J1 + + J2 + + CYP + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RADAR + + + R159 + + + + + C71 + + + + + + + C93 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + PSE846GPS2D + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + GND19P9_018P9_117P9_216P9_31V80Arduino pin numbers.Inter-IC interface.I2CPWM available.SAR ADC channel n available.nP17_1Pin identifier.P17_014SCL12P17_22P16_14P16_36P16_58P16_710P11_13V30P17_5P16_03P16_25P16_47P16_69P17_411P17_313GNDP17_115SDAP17_7 diff --git a/documentation/arduino_libs.md b/documentation/arduino_libs.md index 9118575c4..779161598 100644 --- a/documentation/arduino_libs.md +++ b/documentation/arduino_libs.md @@ -18,11 +18,11 @@ Let's assume the structure of your application for simplicity to be, Paste your library's source files like ``ADXL345.h`` and ``ADXL345.cpp`` in your project's src folder. ## Update CMakeLists -As we can see, there is a Top-level CMakelists which needs to be updated with your external library's source files. +As we can see, there is a Top-level CMakeLists.txt which needs to be updated with your external library's source files. For example, we add `target_sources(app PRIVATE src/ADXL345.cpp)` to CMakeLists.txt. ## Update main.cpp -Finally, paste your required code using the library in ``main.c`` and include that library's header using +Finally, paste your required code using the library in ``main.cpp`` and include that library's header using ```c #include "ADXL345.h" ``` diff --git a/documentation/dynamic_pinmux.md b/documentation/dynamic_pinmux.md index 350d80ec8..993057f91 100644 --- a/documentation/dynamic_pinmux.md +++ b/documentation/dynamic_pinmux.md @@ -29,7 +29,7 @@ PINCTRL_STATE_SLEEP = 1 PINCTRL_STATE_PRIV_START = 2 ``` -Custom state name arduino is defined in devicetree and mapped to PINCTRL_STATE_ARDUINO. +The custom state name `arduino` is defined in devicetree and mapped to `PINCTRL_STATE_ARDUINO`. Typical mapping: @@ -37,67 +37,67 @@ Typical mapping: - sleep: optional low-power/disconnected state (not used) - arduino: custom channel list used for per-pin restore (mainly ADC/PWM/DAC) -## Runtime Infrastructure in zephyrPinctrl.cpp +## Runtime Infrastructure in `zephyrPinctrl.cpp` The core builds a runtime map between devices and pinctrl configs. -Selection rule for nodes included in the map is node is zephyr,deferred-init. -Because the Zephyr logging UART is intentionally not marked with zephyr,deferred-init for easier debugging, it is added to the pinctrl map via a dedicated mapping entry. +The selection rule for nodes included in the map is that the node has `zephyr,deferred-init`. +Because the Zephyr logging UART is intentionally not marked with `zephyr,deferred-init` for easier debugging, it is added to the pinctrl map via a dedicated mapping entry. The map is then used by APIs: -- init_dev_apply_pinctrl(dev) -- init_dev_apply_channel_pinctrl(dev, state_pin_idx) +- `init_dev_apply_pinctrl(dev)` +- `init_dev_apply_channel_pinctrl(dev, state_pin_idx)` If a device has no known pinctrl config in the map: -- init_dev_apply_channel_pinctrl(...) returns -ENOTSUP, -- init_dev_apply_pinctrl(...) still initializes the device/dependencies but skips pinctrl apply for entries +- `init_dev_apply_channel_pinctrl(...)` returns `-ENOTSUP`, +- `init_dev_apply_pinctrl(...)` still initializes the device/dependencies but skips pinctrl apply for entries not present in the map. ## Dynamic Pinmux APIs and Runtime Flow -### init_dev_apply_pinctrl(dev) +### `init_dev_apply_pinctrl(dev)` Purpose: initialize the target device and its dependencies, then apply the whole pinctrl -PINCTRL_STATE_DEFAULT state where pinctrl configuration is known. +`PINCTRL_STATE_DEFAULT` state where pinctrl configuration is known. Used for full peripheral remux, to restore the default state. -SPI (SPI.begin), I2C (Wire.begin) and UART (ZephyrSerial::begin) calls init_dev_apply_pinctrl(dev), without taking care of device readiness/init. +SPI (`SPI.begin`), I2C (`Wire.begin`) and UART (`ZephyrSerial::begin`) call `init_dev_apply_pinctrl(dev)`, without taking care of device readiness/init. Behavior details: - recursively initializes required dependencies first, - initializes each device on first use if needed, -- applies PINCTRL_STATE_DEFAULT from known device pinctrl configs, -- treats -ENOENT from pinctrl_apply_state as non-fatal (for empty/default-less states). +- applies `PINCTRL_STATE_DEFAULT` from known device pinctrl configs, +- treats `-ENOENT` from `pinctrl_apply_state` as non-fatal (for empty/default-less states). -### init_dev_apply_channel_pinctrl(dev, state_pin_idx) +### `init_dev_apply_channel_pinctrl(dev, state_pin_idx)` -Purpose: apply only one pin from the device arduino state. +Purpose: apply only one pin from the device `arduino` state. -Used for channel-based peripherals (ADC/PWM/DAC) in the analogRead and analogWrite functions, allowing a single channel can be remuxed without touching sibling channels. +Used for channel-based peripherals (ADC/PWM/DAC) in the `analogRead` and `analogWrite` functions, allowing a single channel to be remuxed without touching sibling channels. Behavior details: - initializes the device on first use if needed, -- resolves PINCTRL_STATE_ARDUINO, -- applies only one pin entry (state_pin_idx), with bounds checking. +- resolves `PINCTRL_STATE_ARDUINO`, +- applies only one pin entry (`state_pin_idx`), with bounds checking. Implementation pattern: - resolve analog/pwm index from pin, -- compute a per-device ordinal index with state_pin_index_from_spec_index(arduino_adc/arduino_pwm, idx), -- call init_dev_apply_channel_pinctrl(dev, per_dev_idx), +- compute a per-device ordinal index with `state_pin_index_from_spec_index(arduino_adc/arduino_pwm, idx)`, +- call `init_dev_apply_channel_pinctrl(dev, per_dev_idx)`, -How state_pin_index_from_spec_index works: +How `state_pin_index_from_spec_index` works: -- spec_idx is the global position in the zephyr,user array (io-channels for ADC or pwms for PWM). For example, A1/D1 maps to spec_idx = 1 (second entry); -- state_pin_index_from_spec_index(...) scans previous entries [0..spec_idx-1] and counts only those that reference the same device (i.e. the same PWM/ADC controller instance, such as pwm4); -- the resulting count is the per-device ordinal (0, 1, 2, ...) used as state_pin_idx in the device arduino pinctrl state. +- `spec_idx` is the global position in the `zephyr,user` array (`io-channels` for ADC or `pwms` for PWM). For example, A1/D1 maps to `spec_idx = 1` (second entry); +- `state_pin_index_from_spec_index(...)` scans previous entries `[0..spec_idx-1]` and counts only those that reference the same device (i.e. the same PWM/ADC controller instance, such as `pwm4`); +- the resulting count is the per-device ordinal (0, 1, 2, ...) used as `state_pin_idx` in the device `arduino` pinctrl state. -Example (GIGA PWM list in zephyr,user): +Example (GIGA PWM list in `zephyr,user`): ```dts pwms = <&pwm1 3 PWM_HZ(12000000) PWM_POLARITY_NORMAL>, @@ -116,14 +116,14 @@ pwms = <&pwm1 3 PWM_HZ(12000000) PWM_POLARITY_NORMAL>, <&pwm1 1 PWM_HZ(5000) PWM_POLARITY_NORMAL>; ``` -If analogWrite() resolves to spec_idx = 8 (9th entry, `&pwm4 4`): +If `analogWrite()` resolves to `spec_idx = 8` (9th entry, `&pwm4 4`): -- device = pwm4 -- previous pwm4 entries are at spec_idx 5 and 7 +- device = `pwm4` +- previous `pwm4` entries are at `spec_idx` 5 and 7 - count of previous same-device entries = 2 -- state_pin_idx = 2 (zero-based) +- `state_pin_idx = 2` (zero-based) -Then init_dev_apply_channel_pinctrl(pwm4, 2) selects the 3rd entry of pwm4 `pinctrl-2`. +Then `init_dev_apply_channel_pinctrl(pwm4, 2)` selects the 3rd entry of `pwm4` `pinctrl-2`. ```dts pwm4: pwm { @@ -140,7 +140,7 @@ In this example, the selected pin is `tim4_ch4_pb9`. Effect: -- only the requested ADC pad or PWM pad is remuxed to analog function. +- only the requested ADC pad or PWM pad is remuxed to its target peripheral function. ## Devicetree Requirements @@ -158,17 +158,17 @@ Use deferred init and provide usual default/sleep states. }; ``` -Same pattern applies to i2cX and uartX. +Same pattern applies to `i2cX` and `uartX`. Note: the runtime map explicitly includes the node selected as `zephyr,console` even when it is -not deferred-init. +not `deferred-init`. -Recommendation: keep the UART used for early logs available from boot; if it is deferred-init, +Recommendation: keep the UART used for early logs available from boot; if it is `deferred-init`, early error logs generated during system startup or sketch load may not be visible. ### For channel-based ADC/PWM/DAC nodes -Use deferred init and keep channel pads in pinctrl-2 and name it arduino. +Use deferred init and keep channel pads in `pinctrl-2` and name it `arduino`. ```dts &periphN { @@ -185,16 +185,16 @@ Use deferred init and keep channel pads in pinctrl-2 and name it arduino. For each ADC/PWM device, ordering must match between: -- zephyr,user spec arrays (io-channels or pwms), and -- that device arduino pin list (pinctrl-2). +- `zephyr,user` spec arrays (`io-channels` or `pwms`), and +- that device `arduino` pin list (`pinctrl-2`). -state_pin_index_from_spec_index() assumes this ordinal alignment to map a logical channel entry to the correct pin in the arduino state. +`state_pin_index_from_spec_index()` assumes this ordinal alignment to map a logical channel entry to the correct pin in the `arduino` state. ## Known limitation - Nordic nRF On Nordic nRF targets, switching a pin from PWM back to another peripheral may leave PWM still affecting that pin unless PWM is explicitly stopped first. -The reason is architectural: in the nRF pinctrl/driver model, pin routing is programmed per peripheral by writing that peripheral’s PSEL registers. Reconfiguring the new peripheral (i.e. SPI) updates SPI’s PSEL, but it does not automatically clear PWM’s PSEL ownership for the same physical pin. +The reason is architectural: in the nRF pinctrl/driver model, pin routing is programmed per peripheral by writing that peripheral’s `PSEL` registers. Reconfiguring the new peripheral (i.e. SPI) updates SPI’s `PSEL`, but it does not automatically clear PWM’s `PSEL` ownership for the same physical pin. In our current core flow, we do not keep global runtime ownership tracking across peripherals for each pin, so we cannot reliably force-release the previous owner in all cases. This limitation is relevant only when the same pin was previously configured/driven by PWM and is now being reassigned to another peripheral. diff --git a/documentation/variants.md b/documentation/variants.md index 300c6a17a..5f5ff6e60 100644 --- a/documentation/variants.md +++ b/documentation/variants.md @@ -1,10 +1,10 @@ -# Adding custom boards/ variants +# Adding custom boards/variants - Boards already supported by Zephyr can be added to the variants folder as outlined in this documentation. -- Custom boards can first by added by following the [official Zephyr porting guide](https://docs.zephyrproject.org/latest/hardware/porting/board_porting.html). +- Custom boards can first be added by following the [official Zephyr porting guide](https://docs.zephyrproject.org/latest/hardware/porting/board_porting.html). Once completed, continue here by adding a variant for your custom board. -## Suppored Boards/variants +## Supported Boards/variants - [X] Arduino Nano ble sense 33 - [X] Arduino Nano ble 33 @@ -26,7 +26,7 @@ target board. To add board support: 1. This project is structured in a way so as to isolate the variants from the core API. Thus, whenever a new board needs to be added it needs to be done in the `variants/` folder. Add a folder inside of the variants folder that matches the name of your board. -2. Add an overlay file file that match the name of the board. +2. Add an overlay file that matches the name of the board. 3. Add a `variant.h` file. An example of this structure is shown below. @@ -45,13 +45,19 @@ variants/ The Arduino API requires pin mapping definitions to use Arduino-style pin numbers (pin numbers printed on the board, not GPIO numbers). The pin-mapping node is under the `zephyr,user` node of DTS. -`digital-pin-gpios` defines digital input/output pins that is D0, D1, .., -`adc-pin-gpios` defines analog input pins that is A0, A1, ... . +`digital-pin-gpios` defines digital input/output pins, i.e. D0, D1, ..., +`adc-pin-gpios` defines analog input pins, i.e. A0, A1, etc. `pwm-pin-gpios` defines PWM pins. Each pin specifies in the form of a GPIO cell. Usually, it is in the form of `<[port] [pin-number] [flag]>`. You can also use the Arduino header node definition here. +> [!NOTE] +> For phandle-array properties like these (`digital-pin-gpios`, `adc-pin-gpios`, +> `pwm-pin-gpios`, `serials`, `i2cs`, etc.), both `<&dev1 &dev2>` (multiple entries in a +> single bracket group) and `<&dev1>, <&dev2>` (separate bracket groups joined by commas) +> are valid DTS syntax. However, `<&dev1, &dev2>` is **invalid**. + ### Overlays using previously-defined Arduino headers When an Arduino header exists in a board's in-tree DTS file it can easily be @@ -66,18 +72,17 @@ uses [the Arduino header definitions](https://github.com/zephyrproject-rtos/zeph ``` / { zephyr,user { - digital-pin-gpios = <&arduino_header 6 0>, /* Digital */ - <&arduino_header 7 0>; - ... - <&arduino_header 19 0>; - <&arduino_header 0 0>; /* Analog */ - <&arduino_header 1 0>; - ... - <&arduino_header 5 0>; - <&arduino_header 20 0>; /* SDA */ - <&arduino_header 21 0>; /* SCL */ - <&gpio0 13 GPIO_ACTIVE_LOW>; /* LED0 */ - }; + digital-pin-gpios = <&arduino_header 6 0>, /* Digital */ + <&arduino_header 7 0>, + ... + <&arduino_header 19 0>, + <&arduino_header 0 0>, /* Analog */ + <&arduino_header 1 0>, + ... + <&arduino_header 5 0>, + <&arduino_header 20 0>, /* SDA */ + <&arduino_header 21 0>, /* SCL */ + <&gpio0 13 GPIO_ACTIVE_LOW>; /* LED0 */ }; }; ``` @@ -85,15 +90,15 @@ uses [the Arduino header definitions](https://github.com/zephyrproject-rtos/zeph ### Configure Serial devices The `serials` node defines the Serial devices to use. -It instantiate the `Serial` with the UART device that contained in the node. -Also instantiate as `Serial1`, `Serial2`, .. `SerialN` with the devices that is -after the second in the case of the array contains plural devices. +It instantiates `Serial` with the UART device contained in the node. +Also instantiates `Serial1`, `Serial2`, ... `SerialN` with the devices +after the first when the array contains more than one device. -If the `serials` node is not defined, Use the node labeled `arduino-serial`. +If the `serials` node is not defined, use the node labeled `arduino-serial`. Boards with Arduino-shield style connectors usually label `arduino-serial` for UART port exposed in header or frequently used UART port. -If even 'arduino_serial' does not define, it uses the stub implementation +If even `arduino_serial` is not defined, it uses the stub implementation that redirects to printk(). The following example instantiates `Serial` and `Serial1` with each `uart0` and `uart1`. @@ -101,7 +106,7 @@ The following example instantiates `Serial` and `Serial1` with each `uart0` and ``` / { zephyr,user { - serials = <&uart0, &uart1>; + serials = <&uart0>, <&uart1>; }; }; ``` @@ -109,20 +114,20 @@ The following example instantiates `Serial` and `Serial1` with each `uart0` and ### Configure I2C devices The `i2cs` node defines the I2C devices to use. -It instantiate the `Wire` with the i2c device that contained in the node. -Also instantiate as `Wire1`, `Wire2`, .. `WireN` with the devices -that is after the second in the case of the array contains plural devices. +It instantiates `Wire` with the i2c device contained in the node. +Also instantiates `Wire1`, `Wire2`, ... `WireN` with the devices +after the first when the array contains more than one device. -If the `i2cs` node is not defined, Use the node labeled `arduino-i2c`. +If the `i2cs` node is not defined, use the node labeled `arduino-i2c`. Boards with Arduino-shield style connectors usually label `arduino-i2c` to i2c exposed in the connector. -The following example instantiates `Wire` and `Wire2` with each `i2c0` and `i2c1`. +The following example instantiates `Wire` and `Wire1` with each `i2c0` and `i2c1`. ``` / { zephyr,user { - i2cs = <&i2c0, &i2c1>; + i2cs = <&i2c0 &i2c1>; }; }; ``` @@ -135,16 +140,15 @@ array to find the index of the pin. The node is phandle-array, which uses the format same as `digital-pin-gpios`. -It set the digital pin number to the `LED_BUILTIN` if found the pin -that defined in `builtin-led-gpios` from `digital-pin-gpios`. +It sets the digital pin number to `LED_BUILTIN` if the pin +defined in `builtin-led-gpios` is found in `digital-pin-gpios`. -If the `builtin-led-gpios` is not defined, Use the node aliased as `led0` +If the `builtin-led-gpios` is not defined, use the node aliased as `led0` to define `LED_BUILTIN`. -The `LED_BUILTIN` does not define here if it has not found both nodes or -defined `LED_BUILTIN` already. +`LED_BUILTIN` is not defined if neither node is found or `LED_BUILTIN` is already defined. -For example, in the case of the 13th digital pins connected to the onboard LED, +For example, in the case of the 13th digital pin connected to the onboard LED, define `builtin-led-gpios` as follows. ``` @@ -160,7 +164,7 @@ define `builtin-led-gpios` as follows. You can see in the example above that there is no mapping for `LED0` in the board's Arduino header definition so it has been added using the Zephyr `gpios` syntax (port, pin, flags). When creating an overlay file that doesn't have an -Arduino header defined, you should follow this syntax for adding all pins +Arduino header defined, you should follow this syntax for adding all pins. ### You control the pin mapping @@ -168,7 +172,7 @@ Zephyr [chooses to map Arduino headers beginning with the Analog pins](https://docs.zephyrproject.org/latest/build/dts/api/bindings/gpio/arduino-header-r3.html), but the overlay file example above begins with the digital pins. This is to match user -expectation that issuing `pinMode(0,OUTPUT);` should control digital pin 0 (and +expectations that issuing `pinMode(0,OUTPUT);` should control digital pin 0 (and not pin 6). In the same way, the Analog 0 pin was mapped to D14 as this is likely what a shield made for the Arduino Uno R3 header would expect. diff --git a/extra/apply_zephyr_patches.sh b/extra/apply_zephyr_patches.sh new file mode 100644 index 000000000..12d1c5b43 --- /dev/null +++ b/extra/apply_zephyr_patches.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + +set -euo pipefail + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +PATCH_DIR="$SCRIPT_DIR/patches/zephyr" + +if [ ! -d "$PATCH_DIR" ]; then + # No patch set is configured. + exit 0 +fi + +if ! command -v west >/dev/null 2>&1; then + echo "[ERROR] west is not available; cannot resolve Zephyr workspace" + exit 1 +fi + +ZEPHYR_BASE="$(west list -f '{abspath}' zephyr 2>/dev/null || true)" +if [ -z "$ZEPHYR_BASE" ]; then + echo "[ERROR] Unable to locate Zephyr module with 'west list zephyr'" + exit 1 +fi + +if [ ! -d "$ZEPHYR_BASE/.git" ]; then + echo "[ERROR] Zephyr repository not found at '$ZEPHYR_BASE'" + exit 1 +fi + +applied_any=false +for patch in "$PATCH_DIR"/*.patch; do + [ -e "$patch" ] || continue + patch_name="$(basename "$patch")" + + if git -C "$ZEPHYR_BASE" apply --check "$patch" >/dev/null 2>&1; then + echo "[INFO] Applying Zephyr patch: $patch_name" + git -C "$ZEPHYR_BASE" apply "$patch" + applied_any=true + elif git -C "$ZEPHYR_BASE" apply --reverse --check "$patch" >/dev/null 2>&1; then + echo "[INFO] Zephyr patch already applied: $patch_name" + else + echo "[ERROR] Cannot apply Zephyr patch cleanly: $patch_name" + echo "[ERROR] Patch file: $patch" + exit 1 + fi +done + +if [ "$applied_any" = true ]; then + echo "[INFO] Zephyr patch set applied" +fi diff --git a/extra/artifacts/_common.json b/extra/artifacts/_common.json index 9d9723469..d4f3e8542 100644 --- a/extra/artifacts/_common.json +++ b/extra/artifacts/_common.json @@ -16,7 +16,7 @@ { "packager": "zephyr", "name": "arm-zephyr-eabi", - "version": "0.16.8" + "version": "1.0.1" }, { "packager": "arduino", @@ -31,12 +31,12 @@ { "packager": "arduino", "name": "zephyr-sketch-tool", - "version": "0.4.0" + "version": "0.4.1" }, { "packager": "arduino", "name": "sync-zephyr-artifacts", - "version": "0.2.1" + "version": "0.2.2" }, { "packager": "arduino", @@ -67,6 +67,16 @@ "packager": "arduino", "name": "bin2uf2", "version": "0.1.0" + }, + { + "packager": "arduino", + "name": "scripting-tools", + "version": "0.0.7" + }, + { + "packager": "arduino", + "name": "rp2040tools", + "version": "1.1.0-rc1" } ] } diff --git a/extra/artifacts/zephyr_contrib.json b/extra/artifacts/zephyr_contrib.json index b2fa095dd..58fb1bc85 100644 --- a/extra/artifacts/zephyr_contrib.json +++ b/extra/artifacts/zephyr_contrib.json @@ -1,5 +1,5 @@ { - "name": "Zephyr Community Boards (BETA)", + "name": "Zephyr Community Boards", "architecture": "zephyr_contrib", "category": "Contributed" } diff --git a/extra/artifacts/zephyr_main.json b/extra/artifacts/zephyr_main.json index b36cef34b..6c15f125c 100644 --- a/extra/artifacts/zephyr_main.json +++ b/extra/artifacts/zephyr_main.json @@ -1,5 +1,5 @@ { - "name": "Arduino Zephyr Boards (BETA)", + "name": "Arduino Zephyr Boards", "architecture": "zephyr_main", "category": "Arduino" } diff --git a/extra/artifacts/zephyr_unoq.json b/extra/artifacts/zephyr_unoq.json index 53a3537c5..cb1af7c25 100644 --- a/extra/artifacts/zephyr_unoq.json +++ b/extra/artifacts/zephyr_unoq.json @@ -3,7 +3,7 @@ "architecture": "zephyr", "category": "Arduino", "libraryDependencies": [ - { "name":"Arduino_RouterBridge", "version":"0.4.2" }, + { "name":"Arduino_RouterBridge", "version":"0.4.3" }, { "name":"Arduino_RPClite", "version":"0.3.0" }, { "name":"MsgPack", "version":"0.4.2" }, { "name":"DebugLog", "version":"0.8.4" }, diff --git a/extra/bootstrap.sh b/extra/bootstrap.sh index ef3d48929..e675721bb 100755 --- a/extra/bootstrap.sh +++ b/extra/bootstrap.sh @@ -4,9 +4,10 @@ # SPDX-License-Identifier: Apache-2.0 set -e +set -o pipefail log_msg() { - if [ -n $GITHUB_WORKSPACE ] ; then + if [ -n "$GITHUB_WORKSPACE" ] ; then echo "::$1::$2" else echo " - $2" @@ -18,7 +19,34 @@ if [ ! -f platform.txt ]; then exit 2 fi -NEEDED_HALS=$(grep 'build.zephyr_hals=' boards.txt | cut -d '=' -f 2 | xargs -n 1 echo | sort -u | xargs echo) +REQUIRED_TOOLS="cmake curl git jq ninja pip3 python3 wget zip" +MISSING_TOOLS="" +for tool in $REQUIRED_TOOLS; do + if ! command -v "$tool" >/dev/null 2>&1; then + MISSING_TOOLS="$MISSING_TOOLS $tool" + fi +done +if [ -n "$MISSING_TOOLS" ]; then + echo "Missing required tools:$MISSING_TOOLS" >&2 + echo "Install them before running this script." >&2 + exit 2 +fi + +if [ -n "$WEST_CACHE" ]; then + # Set in CI context, uses a shared cache for west blobs and modules + mkdir -p $WEST_CACHE/blobs $WEST_CACHE/modules + WEST_BLOBS_CACHE="--cache-dirs $WEST_CACHE/blobs --auto-cache $WEST_CACHE/blobs" + WEST_MODULES_CACHE="--auto-cache $WEST_CACHE/modules" +fi + +get_unique_field_values() { + local field="$1" + local file="$2" + grep "$field=" $file | cut -d '=' -f 2 | xargs -n 1 echo | sort -u | xargs echo +} + +NEEDED_HALS=$(get_unique_field_values 'build.zephyr_hals' boards.txt) +NEEDED_TOOLCHAINS=$(get_unique_field_values 'build.zephyr_toolchain' boards.txt) HAL_FILTER="-hal_.*" for hal in $NEEDED_HALS; do @@ -28,21 +56,40 @@ done log_msg "group" "Bootstrapping Python environment for Zephyr" python3 -m venv venv source venv/bin/activate -pip install west protobuf grpcio-tools +pip3 install west protobuf grpcio-tools log_msg "endgroup" -log_msg "group" "Initializing Zephyr workspace and modules: $HAL_FILTER" -west init -l . +if ! [ -d ../.west ] ; then + log_msg "group" "Initializing Zephyr workspace and modules: $HAL_FILTER" + west init -l . +else + log_msg "warning" "Zephyr workspace already initialized, skipping west init" + log_msg "group" "Refreshing workspace and modules: $HAL_FILTER" +fi west config manifest.project-filter -- "$HAL_FILTER" -west update "$@" +west update $WEST_MODULES_CACHE "$@" +bash ./extra/apply_zephyr_patches.sh west zephyr-export -pip install -r ../zephyr/scripts/requirements-base.txt +pip3 install -r ../zephyr/scripts/requirements-base.txt log_msg "endgroup" -log_msg "group" "Installing Zephyr SDK 0.16.8" -west sdk install --version 0.16.8 -t arm-zephyr-eabi -log_msg "endgroup" +TOOLCHAIN_VERSIONS=$(for tc in $NEEDED_TOOLCHAINS; do + version=$(jq -r --arg name "$tc" '.toolsDependencies[] | select(.name == $name) | .version' extra/artifacts/_common.json) + if [ -z "$version" ]; then + echo "No version found for toolchain '$tc' in extra/artifacts/_common.json" >&2 + exit 1 + fi + echo "$version $tc" +done | sort -V) + +for version in $(echo "$TOOLCHAIN_VERSIONS" | cut -d ' ' -f 1 | sort -u -V); do + toolchains=$(echo "$TOOLCHAIN_VERSIONS" | awk -v v="$version" '$1 == v { print $2 }') + log_msg "group" "Installing Zephyr SDK ${version}: ${toolchains}" + west sdk install --version "$version" -t $toolchains + log_msg "endgroup" +done +NEEDED_HALS="arduino-api $NEEDED_HALS" log_msg "group" "Fetching blobs for: $NEEDED_HALS" -west blobs fetch $NEEDED_HALS +west blobs $WEST_BLOBS_CACHE fetch $NEEDED_HALS log_msg "endgroup" diff --git a/extra/build.sh b/extra/build.sh index 72396c924..a51fb58d5 100755 --- a/extra/build.sh +++ b/extra/build.sh @@ -9,6 +9,10 @@ source venv/bin/activate ZEPHYR_BASE=$(west topdir)/zephyr +# Ensure Zephyr patch set is applied even for incremental builds where +# bootstrap.sh was not re-run. +bash ./extra/apply_zephyr_patches.sh + if [ x$ZEPHYR_SDK_INSTALL_DIR == x"" ]; then SDK_PATH=$(west sdk list | grep path | tail -n 1 | cut -d ':' -f 2 | tr -d ' ') if [ x$SDK_PATH == x ]; then @@ -47,18 +51,22 @@ if ! [ -z "$chosen_board" ]; then # found, use the target and args from there board=$(jq -cr '.board' <<< "$chosen_board") target=$(jq -cr '.target' <<< "$chosen_board") - args=$(jq -cr '.args' <<< "$chosen_board") + # the args field is a single string; split it on unquoted whitespace, + # keeping quotes so a quoted value with spaces stays one array element + arg_token='(?:[^\s"'\'']+|"[^"]*"|'\''[^'\'']*'\'')+' + mapfile -t args < <(jq -cr '.args' <<< "$chosen_board" | grep -oP "$arg_token") upload_offset=$(jq -cr '.upload_offset' <<< "$chosen_board") # Check for debug flag and append if [ x$2 == x"--debug" ]; then - args="$args -- -DEXTRA_CONF_FILE=../extra/debug.conf" + args+=(-- -DEXTRA_CONF_FILE=../extra/debug.conf) fi else # expect Zephyr-compatible target and args target=$1 shift - args="$*" + # keep each argument as a separate array element to preserve quoting + args=("$@") chosen_board=$(extra/get_board_details.sh | jq -cr ".[] | select(.target == \"$target\") // empty") if [ ! -z "$chosen_board" ]; then board=$(jq -cr '.board' <<< "$chosen_board") @@ -68,8 +76,12 @@ else fi fi +# Save the build version to loader/VERSION and for later use in local files +build_version=$(extra/get_core_version.sh loader/VERSION) + echo -echo "Build target: $target $args" +echo "Build version: $build_version" +echo "Build target: $target ${args[*]}" # Get the variant name (NORMALIZED_BOARD_TARGET in Zephyr) variant=$(extra/get_variant_name.sh $target) @@ -85,7 +97,7 @@ fi BUILD_DIR=build/${variant} VARIANT_DIR=variants/${variant} rm -rf ${BUILD_DIR} -west build -d ${BUILD_DIR} -b ${target} loader -t llext-edk ${args} +west build -d ${BUILD_DIR} -b ${target} loader -t llext-edk "${args[@]}" # Extract the generated EDK tarball and copy it to the variant directory mkdir -p ${VARIANT_DIR} firmwares @@ -102,9 +114,12 @@ perl -i -pe "s/${c_comment}//gs unless /${line_preproc_ok}/ || (/${line_comment_ for ext in elf bin hex uf2; do rm -f firmwares/zephyr-$variant.$ext - if [ -f ${BUILD_DIR}/zephyr/zephyr.$ext ]; then - cp ${BUILD_DIR}/zephyr/zephyr.$ext firmwares/zephyr-$variant.$ext - fi + if [ "$ext" = "hex" ] && [ -f ${BUILD_DIR}/zephyr/zephyr.signed.hex ]; then + # Prefer signed HEX when available (for PSE84) for bootloader programming. + cp ${BUILD_DIR}/zephyr/zephyr.signed.hex firmwares/zephyr-$variant.hex + elif [ -f ${BUILD_DIR}/zephyr/zephyr.$ext ]; then + cp ${BUILD_DIR}/zephyr/zephyr.$ext firmwares/zephyr-$variant.$ext + fi done cp ${BUILD_DIR}/zephyr/zephyr.dts firmwares/zephyr-$variant.dts cp ${BUILD_DIR}/zephyr/.config firmwares/zephyr-$variant.config @@ -138,40 +153,54 @@ update_local_field() { local field=$1 local value="$2" local comment="$3" - local full_field_name="${board}.${field}" + + if [ -z "$board" ]; then + local file="platform.local.txt" + local full_field_name="${field}" + else + local file="boards.local.txt" + local full_field_name="${board}.${field}" + fi local match_regexp="${full_field_name//./\\.}" # escape dots + if [ ! -f $file ] ; then + cat << EOF > $file +######################################################################################### +# +# AUTO GENERATED FILE - DO NOT EDIT +# This file is manipulated by extra/build.sh; manual changes may be overwritten. +# +######################################################################################### + +EOF + fi + if [ -n "$comment" ]; then # if there's a comment, add/update it as a commented-out line above the actual field - if grep -qE "^# ${match_regexp}:" boards.local.txt; then - sed -i -e "s/^# ${match_regexp}:.*/# ${full_field_name}: ${comment}/" boards.local.txt + if grep -qE "^# ${match_regexp}:" $file; then + sed -i -e "s/^# ${match_regexp}:.*/# ${full_field_name}: ${comment}/" $file else - echo "# ${full_field_name}: ${comment}" >> boards.local.txt + echo "# ${full_field_name}: ${comment}" >> $file fi fi # update the actual field line - if grep -qE "^${match_regexp}" boards.local.txt; then - sed -i -e "s/^${match_regexp}=.*/${full_field_name}=${value}/" boards.local.txt + if grep -qE "^${match_regexp}" $file; then + sed -i -e "s/^${match_regexp}=.*/${full_field_name}=${value}/" $file else - echo "${full_field_name}=${value}" >> boards.local.txt + echo "${full_field_name}=${value}" >> $file fi } # update properties on boards.local.txt from the generated files if [ ! -z "$board" ]; then - if [ ! -f boards.local.txt ] ; then - cat << EOF > boards.local.txt -######################################################################################### -# -# AUTO GENERATED FILE - DO NOT EDIT -# This file is manipulated by extra/build.sh; manual changes may be overwritten. -# -######################################################################################### - -EOF - fi + # save version to both platform.local.txt and boards.local.txt: + # - the platform one is reported by the IDE as _the_ core version; + # - the board-specific one is used by the auto-update-loader feature + # (when developing, each board build should be tracked separately). + board="" update_local_field "version" "$build_version" + update_local_field "version" "$build_version" # sketch load address: start of sketch partition, hex (exact) CODE_ADDR=$(get_value_from_text_file variants/${variant}/syms-static.ld '_sketch_start') diff --git a/extra/build_all.sh b/extra/build_all.sh index 38c4174e1..70ddf5c1f 100755 --- a/extra/build_all.sh +++ b/extra/build_all.sh @@ -27,6 +27,9 @@ if [ ! -z "$GITHUB_STEP_SUMMARY" ] ; then echo "### Variant build results:" >> "$GITHUB_STEP_SUMMARY" fi +# This will force all boards to share the same build version +export PINNED_CORE_VERSION=$(extra/get_core_version.sh) + final_result=0 while read -r item; do board=$(jq -cr '.board' <<< "$item") diff --git a/extra/get_board_details.sh b/extra/get_board_details.sh index cbe1a1178..a70d8b8b0 100755 --- a/extra/get_board_details.sh +++ b/extra/get_board_details.sh @@ -6,13 +6,13 @@ set -e get_boards() { - cat boards.txt | sed -e 's/\s*#.*//' | grep -E '^.*\.build\.variant=' | sed -e 's/\.build\.variant=.*//' + cat boards.txt | sed -e 's/\s*#.*//' | grep -E '^.*\.build\.variant=' | sed -e 's/\.build\.variant=.*//' -e 's/["\\]/\\&/g' } get_board_field() { board=$1 field=$2 - cat boards.txt | sed -e 's/\s*#.*//' | grep -E "^$board\\.$field=" | cut -d '=' -f2- | sed -e 's/"/\"/g' + cat boards.txt | sed -e 's/\s*#.*//' | grep -E "^$board\\.$field=" | cut -d '=' -f2- | sed -e 's/["\\]/\\&/g' } for BOARD in $(get_boards); do diff --git a/extra/get_core_version.sh b/extra/get_core_version.sh index 51171cee6..a914a61a1 100755 --- a/extra/get_core_version.sh +++ b/extra/get_core_version.sh @@ -15,7 +15,7 @@ # # A bash regex extracts the components and produces: # -# ..-0.