diff --git a/.github/license_config.yml b/.github/license_config.yml deleted file mode 100644 index b5bd58423..000000000 --- a/.github/license_config.yml +++ /dev/null @@ -1,16 +0,0 @@ -license: - main: apache-2.0 - report_missing: true - category: Permissive -copyright: - check: true -exclude: - extensions: - - yml - - yaml - - html - - rst - - conf - - cfg - langs: - - HTML diff --git a/.github/workflows/leave_pr_comment.yml b/.github/workflows/leave_pr_comment.yml index ea40b65c1..79055fbba 100644 --- a/.github/workflows/leave_pr_comment.yml +++ b/.github/workflows/leave_pr_comment.yml @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 name: Leave PR comment @@ -32,18 +32,18 @@ jobs: - name: Check PR number id: check-pr uses: carpentries/actions/check-valid-pr@2e20fd5ee53b691e27455ce7ca3b16ea885140e8 # v0.15.0 + if: ${{ env.PR_NUM }} with: pr: ${{ env.PR_NUM }} sha: ${{ github.event.workflow_run.head_sha }} - name: Validate PR number - if: ${{ steps.check-pr.outputs.VALID != 'true' }} + if: ${{ env.PR_NUM && steps.check-pr.outputs.VALID != 'true' }} run: | - echo "::error::PR number $PR_NUM validation failed" - exit 1 + echo "::warning::PR #$PR_NUM is either invalid or includes changes to workflow" - name: Update PR comment - if: ${{ steps.check-pr.outputs.VALID == 'true' }} + if: ${{ env.PR_NUM && steps.check-pr.outputs.VALID == 'true' }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GH_REPO: ${{ github.repository }} diff --git a/.github/workflows/license_check.yml b/.github/workflows/license_check.yml deleted file mode 100644 index e0cb43053..000000000 --- a/.github/workflows/license_check.yml +++ /dev/null @@ -1,32 +0,0 @@ -name: Scancode - -on: [pull_request] - -jobs: - scancode_job: - runs-on: ubuntu-20.04 - name: Scan code for licenses - steps: - - name: Checkout the code - uses: actions/checkout@v1 - - name: Scan the code - id: scancode - uses: zephyrproject-rtos/action_scancode@v4 - with: - directory-to-scan: 'scan/' - - name: Artifact Upload - uses: actions/upload-artifact@v4 - with: - name: scancode - path: ./artifacts - - - name: Verify - run: | - if [ -s ./artifacts/report.txt ]; then - report=$(cat ./artifacts/report.txt) - report="${report//'%'/'%25'}" - report="${report//$'\n'/'%0A'}" - report="${report//$'\r'/'%0D'}" - echo "::error file=./artifacts/report.txt::$report" - exit 1 - fi diff --git a/.github/workflows/package_core.yml b/.github/workflows/package_core.yml index 04a1ac899..e3371cc99 100644 --- a/.github/workflows/package_core.yml +++ b/.github/workflows/package_core.yml @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # CI workflow to build, package, test and upload the ArduinoCore-zephyr core. @@ -435,7 +435,27 @@ jobs: path: comment-request/ retention-days: 1 - # teports are no longer needed now + # The last line makes the job fail if the 'result' file does not contain "PASSED". + # No further actions are allowed in case of error. + - run: | + cat result + grep -q "PASSED" result # otherwise CI test failed + + + + # Clean up test results only if the verification actually passed, so that + # they are still available for action re-runs in case of failure. + + clean-temps: + name: Clean up test results + runs-on: ubuntu-latest + if: ${{ needs.verify-core.result == 'success' }} + needs: + - build-env + - package-core + - verify-core + steps: + - name: Clean up intermediate artifacts uses: geekyeggo/delete-artifact@v5.1.0 with: @@ -444,12 +464,6 @@ jobs: test-report-* failOnError: false - # The last line makes the job fail if the 'result' file does not contain "PASSED". - # No further actions are allowed in case of error. - - run: | - cat result - grep "PASSED" result >& /dev/null # otherwise CI test failed - # Upload the built core packages to the S3 bucket for public distribution. diff --git a/.github/workflows/scancode.yml b/.github/workflows/scancode.yml new file mode 100644 index 000000000..2fdcf5b86 --- /dev/null +++ b/.github/workflows/scancode.yml @@ -0,0 +1,48 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + +name: Scancode + +on: [pull_request] + +jobs: + verify-licenses: + runs-on: ubuntu-latest + name: Scan code for licenses + steps: + - name: Checkout the code + uses: actions/checkout@v6 + with: + fetch-depth: 0 + persist-credentials: false + + - name: Extract new files + run: | + mkdir scancode-inputs + git fetch origin $GITHUB_BASE_REF + # copy all new files to a separate directory for scanning + for NEW_FILE in $(git diff --name-only --diff-filter=A --ignore-submodules origin/$GITHUB_BASE_REF..HEAD) ; do + mkdir -p $(dirname "scancode-inputs/$NEW_FILE") + cp "$NEW_FILE" "scancode-inputs/$NEW_FILE" + echo 'NEW_FILES_FOUND=true' >> $GITHUB_ENV + done + + - name: Scan the code + id: scancode + uses: aboutcode-org/scancode-action@beta + if: env.NEW_FILES_FOUND == 'true' + with: + check-compliance: true + output-formats: json xlsx + + - name: Get the report + uses: actions/download-artifact@v4 + if: env.NEW_FILES_FOUND == 'true' + with: + name: scancode-outputs + + - name: Process the report + if: env.NEW_FILES_FOUND == 'true' + run: | + # the following will error on missing licenses or compliance issues + extra/ci_license_checks.sh scancode-inputs/ results-*.json diff --git a/README.md b/README.md index c9999d0d5..0574c9ff1 100644 --- a/README.md +++ b/README.md @@ -247,9 +247,38 @@ Remember to also install and/or update the officially published core in the IDE ### Using the Core in the Arduino App Lab -The Arduino App Lab currently relies on a specific FQBN in order to send -board commands. To be able to use your custom core with the Arduino UNO Q, -read [this guide](https://forum.arduino.cc/t/install-sources-built-zephyr-on-uno-q-for-applab/1429150/7). +> [!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 @@ -301,7 +330,7 @@ Contributions are always welcome. The preferred way to receive code contribution ## 📌 Upcoming features - [ ] USB: switch to `USB_DEVICE_STACK_NEXT` to support PluggableUSB -- [ ] Relocate RODATA in flash to accommodate sketches with large assets +- [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 ``) diff --git a/boards.txt b/boards.txt index 639e54262..d693466cf 100644 --- a/boards.txt +++ b/boards.txt @@ -71,6 +71,11 @@ giga.debug.server.openocd.scripts.2=target/stm32h7x_dual_bank.cfg giga.debug.cortex-debug.custom.request=attach giga.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd +giga.build.ota.magic=0x23410266 +giga.build.ota.sketch_offset=0xA0000 +giga.build.ota.pack_command_legacy="{runtime.tools.ota-pack.path}/ota-pack" -loader "{runtime.platform.path}/firmwares/zephyr-{build.variant}.bin" -sketch "{build.path}/{build.project_name}.{upload.extension}" -offset {build.ota.sketch_offset} -magic {build.ota.magic} -output "{build.path}/{build.project_name}.legacy.ota" +giga.build.ota.pack_command="{runtime.tools.ota-pack.path}/ota-pack" --sketch-only -sketch "{build.path}/{build.project_name}.{upload.extension}" -magic {build.ota.magic} -output "{build.path}/{build.project_name}.ota" + ########################################################################################## nano33ble.name=Arduino Nano 33 BLE @@ -311,6 +316,11 @@ portentah7.bootloader.interface=0 portentah7.bootloader.file=zephyr-{build.variant}.bin portentah7.bootloader.address=0x08040000 +portentah7.build.ota.magic=0x2341025B +portentah7.build.ota.sketch_offset=0xA0000 +portentah7.build.ota.pack_command_legacy="{runtime.tools.ota-pack.path}/ota-pack" -loader "{runtime.platform.path}/firmwares/zephyr-{build.variant}.bin" -sketch "{build.path}/{build.project_name}.{upload.extension}" -offset {build.ota.sketch_offset} -magic {build.ota.magic} -output "{build.path}/{build.project_name}.legacy.ota" +portentah7.build.ota.pack_command="{runtime.tools.ota-pack.path}/ota-pack" --sketch-only -sketch "{build.path}/{build.project_name}.{upload.extension}" -magic {build.ota.magic} -output "{build.path}/{build.project_name}.ota" + portentah7.debug.tool=gdb portentah7.debug.server.openocd.scripts.0=interface/{programmer.protocol}.cfg portentah7.debug.server.openocd.scripts.1={programmer.transport_script} @@ -493,6 +503,11 @@ portentac33.bootloader.interface=0 portentac33.bootloader.address=0x10000 portentac33.bootloader.dfuse=-Q +portentac33.build.ota.magic=0x23410068 +portentac33.build.ota.sketch_offset=0xF0000 +portentac33.build.ota.pack_command_legacy="{runtime.tools.ota-pack.path}/ota-pack" -sfu "{runtime.platform.path}/loader/blobs/c33_sfu.bin" -loader "{runtime.platform.path}/firmwares/zephyr-{build.variant}.bin" -sketch "{build.path}/{build.project_name}.{upload.extension}" -offset {build.ota.sketch_offset} -magic {build.ota.magic} -output "{build.path}/{build.project_name}.legacy.ota" +portentac33.build.ota.pack_command="{runtime.tools.ota-pack.path}/ota-pack" --sketch-only -sketch "{build.path}/{build.project_name}.{upload.extension}" -magic {build.ota.magic} -output "{build.path}/{build.project_name}.ota" + ########################################################################################## opta.name=Arduino Opta @@ -561,6 +576,11 @@ opta.debug.server.openocd.scripts.2=target/stm32h7x_dual_bank.cfg opta.debug.cortex-debug.custom.request=attach opta.debug.svd_file={runtime.platform.path}/svd/STM32H747_CM7.svd +opta.build.ota.magic=0x23410064 +opta.build.ota.sketch_offset=0xA0000 +opta.build.ota.pack_command_legacy="{runtime.tools.ota-pack.path}/ota-pack" -loader "{runtime.platform.path}/firmwares/zephyr-{build.variant}.bin" -sketch "{build.path}/{build.project_name}.{upload.extension}" -offset {build.ota.sketch_offset} -magic {build.ota.magic} -output "{build.path}/{build.project_name}.legacy.ota" +opta.build.ota.pack_command="{runtime.tools.ota-pack.path}/ota-pack" --sketch-only -sketch "{build.path}/{build.project_name}.{upload.extension}" -magic {build.ota.magic} -output "{build.path}/{build.project_name}.ota" + ########################################################################################## nano_matter.name=Arduino Nano Matter diff --git a/cores/arduino/Arduino.h b/cores/arduino/Arduino.h index 358b52c1e..53acb36b9 100644 --- a/cores/arduino/Arduino.h +++ b/cores/arduino/Arduino.h @@ -42,7 +42,7 @@ DIGITAL_PIN_GPIOS_FIND_PIN(DT_REG_ADDR(DT_PHANDLE_BY_IDX(node, gpios, 0)), \ DT_PHA_BY_IDX(node, gpios, 0, pin)) -/* Return the index of it if matched, oterwise return 0 */ +/* Return the index of it if matched, otherwise return 0 */ #define LED_BUILTIN_INDEX_BY_REG_AND_PINNUM(n, p, i, dev, num) \ (DIGITAL_PIN_EXISTS(n, p, i, dev, num) ? i : 0) diff --git a/cores/arduino/SerialUSB.h b/cores/arduino/SerialUSB.h index ba2ac9c6c..e28d7e263 100644 --- a/cores/arduino/SerialUSB.h +++ b/cores/arduino/SerialUSB.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/cores/arduino/USB.cpp b/cores/arduino/USB.cpp index fe3291887..b3a92e758 100644 --- a/cores/arduino/USB.cpp +++ b/cores/arduino/USB.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/cores/arduino/abi.cpp b/cores/arduino/abi.cpp index 4905f1869..457b56732 100644 --- a/cores/arduino/abi.cpp +++ b/cores/arduino/abi.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/cores/arduino/itoa.cpp b/cores/arduino/itoa.cpp index 193cd6ab9..cb370db4d 100644 --- a/cores/arduino/itoa.cpp +++ b/cores/arduino/itoa.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/cores/arduino/llext_wrappers.c b/cores/arduino/llext_wrappers.c index 7e6188416..8cf3fe609 100644 --- a/cores/arduino/llext_wrappers.c +++ b/cores/arduino/llext_wrappers.c @@ -66,7 +66,6 @@ W3(void *, memcpy, void *, const void *, size_t) W3(void *, memmove, void *, const void *, size_t) W1(size_t, strlen, const char *) -W2(size_t, strnlen, const char *, size_t) W2(char *, strchr, const char *, int) W2(char *, strrchr, const char *, int) W2(char *, strstr, const char *, const char *) @@ -75,6 +74,9 @@ W3(int, strncmp, const char *, const char *, size_t) W2(int, strcasecmp, const char *, const char *) W3(char *, strncpy, char *, const char *, size_t) W2(char *, strcat, char *, const char *) +W2(char *, strcpy, char *, const char *) +W3(int, memcmp, const void *, const void *, int) +W2(void *, memset, void *, int) /* stdlib.h - conversion */ W2(double, strtod, const char *, char **) @@ -135,6 +137,7 @@ W1(float, tanf, float) /* math.h - double(double, double) */ W2(double, atan2, double, double) W2(double, pow, double, double) +W2(double, ldexp, double, double) /* math.h - float(float, float) */ W2(float, atan2f, float, float) diff --git a/cores/arduino/new b/cores/arduino/new index b97bc949f..71b327da4 100644 --- a/cores/arduino/new +++ b/cores/arduino/new @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/cores/arduino/new.cpp b/cores/arduino/new.cpp index 7b2a63a90..a9b1610de 100644 --- a/cores/arduino/new.cpp +++ b/cores/arduino/new.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/cores/arduino/new.h b/cores/arduino/new.h index d52985368..9ae65c744 100644 --- a/cores/arduino/new.h +++ b/cores/arduino/new.h @@ -1,3 +1,10 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + // This file originally used a non-standard name for this Arduino core // only, so still expose the old new.h name for compatibility. + #include "new" diff --git a/cores/arduino/overloads.h b/cores/arduino/overloads.h index a96653d7f..d659836ab 100644 --- a/cores/arduino/overloads.h +++ b/cores/arduino/overloads.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #ifdef CONFIG_DAC void analogWrite(enum dacPins pinNumber, int value); diff --git a/cores/arduino/threads.cpp b/cores/arduino/threads.cpp index cf0d73767..5e8fb124c 100644 --- a/cores/arduino/threads.cpp +++ b/cores/arduino/threads.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/cores/arduino/time_macros.h b/cores/arduino/time_macros.h index 6c9290f6c..4be801b5e 100644 --- a/cores/arduino/time_macros.h +++ b/cores/arduino/time_macros.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #pragma once #include diff --git a/cores/arduino/usb_device_descriptor.c b/cores/arduino/usb_device_descriptor.c index 396379370..646bd84d7 100644 --- a/cores/arduino/usb_device_descriptor.c +++ b/cores/arduino/usb_device_descriptor.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2025 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/extra/artifacts/_common.exc b/extra/artifacts/_common.exc index 9f24151ae..ebae93e46 100644 --- a/extra/artifacts/_common.exc +++ b/extra/artifacts/_common.exc @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains all the files that must *never* be added to core package diff --git a/extra/artifacts/_common.inc b/extra/artifacts/_common.inc index 50f0b1ce2..d7c2273a3 100644 --- a/extra/artifacts/_common.inc +++ b/extra/artifacts/_common.inc @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains all the *static* files and directories that will be added diff --git a/extra/artifacts/_common.json b/extra/artifacts/_common.json index c8923ccbb..659663508 100644 --- a/extra/artifacts/_common.json +++ b/extra/artifacts/_common.json @@ -51,6 +51,11 @@ "packager": "SiliconLabs", "name": "openocd", "version": "0.12.0-arduino1-static" + }, + { + "packager": "arduino", + "name": "gen-rodata-ld", + "version": "0.1.0" } ] } diff --git a/extra/artifacts/_common.test_setup.sh b/extra/artifacts/_common.test_setup.sh index 41e41b7fe..099d61c4e 100644 --- a/extra/artifacts/_common.test_setup.sh +++ b/extra/artifacts/_common.test_setup.sh @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This script is sourced from extra/ci_test_list.sh to provide diff --git a/extra/artifacts/zephyr_contrib.exc b/extra/artifacts/zephyr_contrib.exc index 162ed5910..0e5d508ee 100644 --- a/extra/artifacts/zephyr_contrib.exc +++ b/extra/artifacts/zephyr_contrib.exc @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # Files listed here will not be installed with this artifact. diff --git a/extra/artifacts/zephyr_main.test_setup.sh b/extra/artifacts/zephyr_main.test_setup.sh index cd1fdba7c..e10aa47b7 100644 --- a/extra/artifacts/zephyr_main.test_setup.sh +++ b/extra/artifacts/zephyr_main.test_setup.sh @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This script is sourced from extra/ci_test_list.sh to provide diff --git a/extra/artifacts/zephyr_unoq.exc b/extra/artifacts/zephyr_unoq.exc index 996502811..84f350e1a 100644 --- a/extra/artifacts/zephyr_unoq.exc +++ b/extra/artifacts/zephyr_unoq.exc @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # Files listed here will not be installed with this artifact. diff --git a/extra/artifacts/zephyr_unoq.only b/extra/artifacts/zephyr_unoq.only index 803cb4f4b..b3febc5bb 100644 --- a/extra/artifacts/zephyr_unoq.only +++ b/extra/artifacts/zephyr_unoq.only @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # Files listed here are included by this package only, and automatically diff --git a/extra/artifacts/zephyr_unoq.test_setup.sh b/extra/artifacts/zephyr_unoq.test_setup.sh index b8a6c7e58..7527e2051 100644 --- a/extra/artifacts/zephyr_unoq.test_setup.sh +++ b/extra/artifacts/zephyr_unoq.test_setup.sh @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This script is sourced from extra/ci_test_list.sh to provide diff --git a/extra/bootstrap.sh b/extra/bootstrap.sh index cee004036..ef3d48929 100755 --- a/extra/bootstrap.sh +++ b/extra/bootstrap.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 set -e diff --git a/extra/build.sh b/extra/build.sh index c1158faad..e490e1c3f 100755 --- a/extra/build.sh +++ b/extra/build.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + set -e source venv/bin/activate diff --git a/extra/build_all.sh b/extra/build_all.sh index db3b8529c..edd9cbb56 100755 --- a/extra/build_all.sh +++ b/extra/build_all.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + FORCE=false while getopts "hf" opt; do diff --git a/extra/ci_inspect_logs.py b/extra/ci_inspect_logs.py index 8cb136b08..1f4ed8464 100755 --- a/extra/ci_inspect_logs.py +++ b/extra/ci_inspect_logs.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # Script to analyze CI build and test logs, summarize results, diff --git a/extra/ci_license_checks.sh b/extra/ci_license_checks.sh new file mode 100755 index 000000000..18af65fea --- /dev/null +++ b/extra/ci_license_checks.sh @@ -0,0 +1,112 @@ +#!/bin/bash + +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + + +# +# License check configuration +# + +# - ignored extensions (ignore *.ext) +IGNORE_EXTS="md rst txt" # text files +IGNORE_EXTS+=" ino pde" # arduino sketch files +IGNORE_EXTS+=" json yaml yml" # configuration files (also ignored by scancode-action) + +# - source file extensions (match *.ext) +SOURCE_EXTS="c cc cpp h hh hpp" # C/C++ source and header files +SOURCE_EXTS+=" cmake conf dts dtsi overlay ld" # build / configuration files +SOURCE_EXTS+=" py sh go" # scripts + +# - source file names (match ) +SOURCE_FILES="CMakeLists.txt Kconfig Kconfig.default" # build / configuration files + +# - Arduino official copyright text +ARDUINO_COPYRIGHT='Copyright (c) Arduino s.r.l. and/or its affiliated companies' + + +# +# Run the checks +# + +SCANCODE_INPUTS=${1} +SCANCODE_RESULTS=${2} +if ! [ -d "$SCANCODE_INPUTS" ] || [ -z "$SCANCODE_RESULTS" ] || ! [ -s "$SCANCODE_RESULTS" ] ; then + echo "Usage: $0 " + exit 1 +fi + +ignore_ext_re=$(echo $IGNORE_EXTS | sed -e 's/\s\+/|/g' -e 's/.*/\\.(&)$/') + +source_ext_re=$(echo $SOURCE_EXTS | sed -e 's/\s\+/|/g' -e 's/.*/\\.(&)$/') +source_file_re=$(echo $SOURCE_FILES | sed -e 's/\s\+/|/g' -e 's/\./\\./g' -e 's/.*/\<(&)$/') +source_match_re="($source_ext_re|$source_file_re)" + +RETVAL=0 + +for NEW_FILE in $(cd "$SCANCODE_INPUTS" && find . -type f | sed -e 's/..//'); do + if echo $NEW_FILE | grep -qE "${ignore_ext_re}" ; then + # ignored file + echo "Ignoring new file: $NEW_FILE" + continue + elif echo $NEW_FILE | grep -qE "${source_match_re}" ; then + # matches the source file criteria + KIND="source" + else + # anything else + KIND="file" + fi + + echo "Checking new $KIND: $NEW_FILE" + + FILE_RES=$(jq -cr ".files[] | select(.path == \"$NEW_FILE\")" $SCANCODE_RESULTS) + FILE_RES=${FILE_RES:-\{\}} # should never happen, results in missing license and copyright info + STATUS=$(echo "$FILE_RES" | jq -r '.status // empty' 2>/dev/null) + COMPLIANCE=$(echo "$FILE_RES" | jq -r '.compliance_alert // empty' 2>/dev/null) + LICENSE=$(echo "$FILE_RES" | jq -r '.detected_license_expression // empty' 2>/dev/null) + COPYRIGHT=$(echo "$FILE_RES" | jq -r '.copyrights[0].copyright // empty' 2>/dev/null) + LINE_NUMBER=1 + + if [ "$STATUS" != "scanned" ] ; then + # anything else is a problem with scancode + MSG="File not scanned: '$STATUS'" + TYPE="warning" + elif ! ( [ -z "$COMPLIANCE" ] || [ "$COMPLIANCE" == "ok" ] ) ; then + # anything other than ok or empty is a hard error + MSG="License compliance $COMPLIANCE for license(s): $LICENSE" + TYPE="error" + RETVAL=1 + elif [ -z "$LICENSE" ] || [ -z "$COPYRIGHT" ] ; then + # Something is missing + MSG="" + [ -z "$LICENSE" ] && MSG="license" + [ -z "$COPYRIGHT" ] && MSG="${MSG}${MSG:+ and }copyright" + MSG="Missing $MSG information" + # missing info in source files is an error, in other files is a warning + if [ $KIND == "source" ] ; then + TYPE="error" + RETVAL=1 + else + TYPE="warning" + fi + elif echo "$COPYRIGHT" | grep -qi "arduino" ; then + # Arduino copyright found, check it matches exactly + LINE_NUMBER=$(echo "$FILE_RES" | jq -r '.copyrights[0].start_line') + FULL_LINE=$(sed -n "${LINE_NUMBER}p" "$SCANCODE_INPUTS/$NEW_FILE") + if ! echo "$FULL_LINE" | grep -qF "$ARDUINO_COPYRIGHT" ; then + MSG="Arduino copyright must be: '$ARDUINO_COPYRIGHT'" + TYPE="error" + RETVAL=1 + else + # looks good + continue + fi + else + # no issues + continue + fi + + echo "::$TYPE file=$NEW_FILE,line=$LINE_NUMBER::$MSG" +done + +exit $RETVAL diff --git a/extra/ci_test_list.sh b/extra/ci_test_list.sh index 0dccd0362..8cd594e18 100755 --- a/extra/ci_test_list.sh +++ b/extra/ci_test_list.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This script generates a list of all libraries and their dependencies for use diff --git a/extra/debug.conf b/extra/debug.conf index 147a34940..f9021977d 100644 --- a/extra/debug.conf +++ b/extra/debug.conf @@ -5,8 +5,8 @@ CONFIG_DEBUG=y # Enable assertions -CONFIG_ASSERT=y -#CONFIG_ASSERT_VERBOSE=y +# CONFIG_ASSERT=y +# CONFIG_ASSERT_VERBOSE=y # Enable stack overflow detection CONFIG_STACK_SENTINEL=y @@ -25,7 +25,10 @@ CONFIG_SHELL=y #CONFIG_NET_SHELL=y #CONFIG_NET_L2_WIFI_SHELL=y CONFIG_SHELL_STACK_SIZE=8192 +CONFIG_LOG_BACKEND_UART_AUTOSTART=y +CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n # Enable runtime statistics CONFIG_SYS_HEAP_RUNTIME_STATS=y CONFIG_THREAD_RUNTIME_STATS=y + diff --git a/extra/gen-rodata-ld/main.go b/extra/gen-rodata-ld/main.go index 0e7c93f62..928e9ae78 100644 --- a/extra/gen-rodata-ld/main.go +++ b/extra/gen-rodata-ld/main.go @@ -1,3 +1,6 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + package main import ( diff --git a/extra/gen_arduino_files.cmake b/extra/gen_arduino_files.cmake index e4e859fa9..7c21a11fb 100644 --- a/extra/gen_arduino_files.cmake +++ b/extra/gen_arduino_files.cmake @@ -1,3 +1,6 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + # get root dir for the project cmake_path(SET TOP_DIR NORMALIZE ${CMAKE_CURRENT_LIST_DIR}/..) diff --git a/extra/gen_package_index_json.sh b/extra/gen_package_index_json.sh index 3859054c7..d2d521c1d 100755 --- a/extra/gen_package_index_json.sh +++ b/extra/gen_package_index_json.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + set -e if [ $# -lt 2 ] || [ $# -gt 3 ] ; then diff --git a/extra/gen_provides.py b/extra/gen_provides.py index 09db69c7b..39bfa8efd 100755 --- a/extra/gen_provides.py +++ b/extra/gen_provides.py @@ -1,4 +1,8 @@ #!/usr/bin/env python + +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + import argparse import hashlib import itertools diff --git a/extra/get_board_details.sh b/extra/get_board_details.sh index b3506c3cc..9e322506a 100755 --- a/extra/get_board_details.sh +++ b/extra/get_board_details.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + set -e get_boards() { diff --git a/extra/get_core_version.sh b/extra/get_core_version.sh index cf30e671c..a7d18019a 100755 --- a/extra/get_core_version.sh +++ b/extra/get_core_version.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This script generates a SemVer-compatible version number based on Git tags. diff --git a/extra/get_variant_name.cmake b/extra/get_variant_name.cmake index 5605d4c37..67007c976 100644 --- a/extra/get_variant_name.cmake +++ b/extra/get_variant_name.cmake @@ -1,4 +1,4 @@ -# Copyright (C) 2025 Arduino SA +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # diff --git a/extra/get_variant_name.sh b/extra/get_variant_name.sh index cc8399fe9..27eeea30e 100755 --- a/extra/get_variant_name.sh +++ b/extra/get_variant_name.sh @@ -1,4 +1,8 @@ #!/bin/bash + +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + set -e source venv/bin/activate diff --git a/extra/install_pyocd.sh b/extra/install_pyocd.sh deleted file mode 100755 index b3af96fe0..000000000 --- a/extra/install_pyocd.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -python3 -m pip install pyocd -# add install dir to PATH -# echo /Users/$USER/Library/Python/3.9/bin > /etc/paths.d/pyocd -pyocd pack update -pyocd pack install R7FA8D1AH -pyocd pack install mcxn947 \ No newline at end of file diff --git a/extra/install_remoteocd.sh b/extra/install_remoteocd.sh deleted file mode 100755 index cface41f4..000000000 --- a/extra/install_remoteocd.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh - -REPO_URL="https://github.com/bcmi-labs/orchestrator.git" -BRANCH_NAME="main" - -set -xe - -TMP_DIR=$(mktemp -d) - -# pull the repo -git clone "$REPO_URL" "$TMP_DIR" -cd "$TMP_DIR" -git checkout "$BRANCH_NAME" - -# compile remoteocd -go build -o build/remoteocd ./cmd/remoteocd - -# move into arduino tools -TARGET_PATH=$(arduino-cli config get directories.data)/packages/arduino/tools/remoteocd/0.0.1 -mkdir -p "$TARGET_PATH" -cp build/remoteocd "$TARGET_PATH" - -rm -rf "$TMP_DIR" - -echo "remoteocd is in $TARGET_PATH/remoteocd" diff --git a/extra/ota-pack/.gitignore b/extra/ota-pack/.gitignore new file mode 100644 index 000000000..734751801 --- /dev/null +++ b/extra/ota-pack/.gitignore @@ -0,0 +1 @@ +ota-pack diff --git a/extra/ota-pack/go.mod b/extra/ota-pack/go.mod new file mode 100644 index 000000000..0277db436 --- /dev/null +++ b/extra/ota-pack/go.mod @@ -0,0 +1,3 @@ +module github.com/arduino/ota-pack + +go 1.25.5 diff --git a/extra/ota-pack/main.go b/extra/ota-pack/main.go new file mode 100644 index 000000000..8aee45e80 --- /dev/null +++ b/extra/ota-pack/main.go @@ -0,0 +1,264 @@ +// Copyright (c) Arduino s.r.l. and/or its affiliated companies +// SPDX-License-Identifier: Apache-2.0 + +// ota-pack creates OTA update files for Arduino boards. +// +// Usage: +// +// ota-pack [flags] +package main + +import ( + "encoding/binary" + "flag" + "fmt" + "hash/crc32" + "os" + "strconv" + "strings" +) + +// LZSS parameters matching the Arduino OTA decoder +const ( + lzssEI = 11 + lzssEJ = 4 + lzssN = 1 << lzssEI // ring buffer size = 2048 + lzssF = (1 << lzssEJ) + 1 // max match length = 17 + lzssMask = lzssN - 1 +) + +func main() { + sfuPath := flag.String("sfu", "", "SFU binary to prepend before loader (for C33)") + sfuSizeStr := flag.String("sfu-size", "0x20000", "SFU partition size in hex (default 128KB)") + loaderPath := flag.String("loader", "", "loader binary path") + sketchPath := flag.String("sketch", "", "sketch binary path") + offsetStr := flag.String("offset", "", "sketch offset in merged binary (hex)") + outputPath := flag.String("output", "", "output .ota file path") + magicStr := flag.String("magic", "0x00000000", "board magic number (hex)") + noCompress := flag.Bool("no-compress", false, "disable LZSS compression") + sketchOnly := flag.Bool("sketch-only", false, "wrap raw sketch in OTA header (no loader merge)") + + flag.Usage = func() { + fmt.Fprintf(os.Stderr, "Usage: %s [--sketch-only] -sketch -output [options]\n\n", os.Args[0]) + fmt.Fprintf(os.Stderr, "Creates an OTA update file with header and LZSS compression.\n\n") + flag.PrintDefaults() + } + + flag.Parse() + + magic, err := parseHex(*magicStr) + fatal(err, "parse magic") + + var payloadInput []byte + + if *sketchOnly { + if *loaderPath != "" || *offsetStr != "" || *sfuPath != "" { + fatalf("--sketch-only: -loader, -offset, and -sfu are not allowed") + } + if *sketchPath == "" || *outputPath == "" { + flag.Usage() + os.Exit(1) + } + + payloadInput, err = os.ReadFile(*sketchPath) + fatal(err, "read sketch") + + fmt.Printf("Sketch-only mode: %d bytes\n", len(payloadInput)) + } else { + if *loaderPath == "" || *sketchPath == "" || *offsetStr == "" || *outputPath == "" { + flag.Usage() + os.Exit(1) + } + + offset, err := parseHex(*offsetStr) + fatal(err, "parse offset") + + loader, err := os.ReadFile(*loaderPath) + fatal(err, "read loader") + + sketch, err := os.ReadFile(*sketchPath) + fatal(err, "read sketch") + + // Prepend SFU before loader if specified + if *sfuPath != "" { + sfuSize, err := parseHex(*sfuSizeStr) + fatal(err, "parse sfu-size") + + sfu, err := os.ReadFile(*sfuPath) + fatal(err, "read sfu") + + if int64(len(sfu)) > sfuSize { + fatalf("SFU binary (%d bytes) exceeds partition size (0x%X)", len(sfu), sfuSize) + } + + padded := padFF(sfu, int(sfuSize)) + loader = append(padded, loader...) + fmt.Printf("SFU: %d bytes (padded to 0x%X), loader: %d bytes\n", len(sfu), sfuSize, len(loader)) + } + + if int64(len(loader)) > offset { + fatalf("loader (%d bytes) exceeds offset (0x%X)", len(loader), offset) + } + + // Merge: loader + 0xFF padding + sketch at offset + payloadInput = append(padFF(loader, int(offset)), sketch...) + fmt.Printf("Merged: %d bytes (loader %d + sketch %d)\n", len(payloadInput), len(loader), len(sketch)) + } + + // Compress + compressed := !*noCompress + payload := payloadInput + if compressed { + payload = lzssEncode(payloadInput) + fmt.Printf("LZSS: %d -> %d bytes (%.1f%%)\n", + len(payloadInput), len(payload), + 100.0*float64(len(payload))/float64(len(payloadInput))) + } + + // Build version field + var version [8]byte + version[0] = 1 + if compressed { + version[0] |= 0x40 + } + + // Assemble body: magic(4) + version(8) + payload + // CRC-32 covers this entire body + body := make([]byte, 0, 4+8+len(payload)) + body = binary.LittleEndian.AppendUint32(body, uint32(magic)) + body = append(body, version[:]...) + body = append(body, payload...) + + crcVal := crc32.ChecksumIEEE(body) + + // Final file: len(4) + crc32(4) + body + out := make([]byte, 0, 8+len(body)) + out = binary.LittleEndian.AppendUint32(out, uint32(len(body))) + out = binary.LittleEndian.AppendUint32(out, crcVal) + out = append(out, body...) + + err = os.WriteFile(*outputPath, out, 0644) + fatal(err, "write output") + + fmt.Printf("OTA: %s (%d bytes, magic 0x%08X)\n", *outputPath, len(out), magic) +} + +// padFF pads data with 0xFF up to size. +func padFF(data []byte, size int) []byte { + buf := make([]byte, size) + copy(buf, data) + for i := len(data); i < size; i++ { + buf[i] = 0xFF + } + return buf +} + +// --- LZSS Encoder --- + +type bitWriter struct { + data []byte + accum uint32 + nbits int +} + +func (w *bitWriter) write(value, bits int) { + w.accum = (w.accum << uint(bits)) | uint32(value&((1<= 8 { + w.nbits -= 8 + w.data = append(w.data, byte(w.accum>>uint(w.nbits))) + w.accum &= (1 << uint(w.nbits)) - 1 + } +} + +func (w *bitWriter) flush() { + if w.nbits > 0 { + w.data = append(w.data, byte(w.accum< bestLen { + bestLen = matchLen + bestPos = i + } + } + + if bestLen >= 2 { + w.write(0, 1) + w.write(bestPos, lzssEI) + w.write(bestLen-2, lzssEJ) + } else { + bestLen = 1 + w.write(1, 1) + w.write(int(input[pos]), 8) + } + + for k := 0; k < bestLen; k++ { + ring[r] = input[pos+k] + r = (r + 1) & lzssMask + } + pos += bestLen + } + + w.flush() + return w.data +} + +// --- Helpers --- + +func parseHex(s string) (int64, error) { + s = strings.TrimSpace(s) + if strings.HasPrefix(s, "0x") || strings.HasPrefix(s, "0X") { + return strconv.ParseInt(s[2:], 16, 64) + } + return strconv.ParseInt(s, 0, 64) +} + +func fatal(err error, context string) { + if err != nil { + fmt.Fprintf(os.Stderr, "Error: %s: %v\n", context, err) + os.Exit(1) + } +} + +func fatalf(format string, args ...interface{}) { + fmt.Fprintf(os.Stderr, "Error: "+format+"\n", args...) + os.Exit(1) +} diff --git a/extra/package_core.sh b/extra/package_core.sh index 9bf3ec078..2a6f31500 100755 --- a/extra/package_core.sh +++ b/extra/package_core.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # Package the core into a distributable tar.bz2 archive. diff --git a/extra/package_tool.sh b/extra/package_tool.sh index 1fb341d17..7cf080a5f 100755 --- a/extra/package_tool.sh +++ b/extra/package_tool.sh @@ -1,5 +1,8 @@ #!/bin/bash +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + set -e TOOL_DIR=$(readlink -f ${1:-.}) diff --git a/extra/policies.yml b/extra/policies.yml new file mode 100644 index 000000000..25d7a38c6 --- /dev/null +++ b/extra/policies.yml @@ -0,0 +1,30 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + +# This file is used by scancode-toolkit to enforce the licenses that have been +# validated to be compliant with Arduino open source policies. + +license_policies: + - license_key: apache-2.0 + label: Permissive + compliance_alert: '' + + - license_key: lgpl-2.1-plus + label: Weak Copyleft + compliance_alert: '' + + - license_key: lgpl-3.0-plus + label: Weak Copyleft + compliance_alert: '' + + - license_key: mit + label: Permissive + compliance_alert: '' + + - license_key: mpl-2.0 + label: Weak Copyleft + compliance_alert: '' + + - license_key: pbl-1.0 + label: Permissive + compliance_alert: '' diff --git a/extra/sync-zephyr-artifacts/main.go b/extra/sync-zephyr-artifacts/main.go index 8dea08c0b..f48a6b399 100644 --- a/extra/sync-zephyr-artifacts/main.go +++ b/extra/sync-zephyr-artifacts/main.go @@ -1,5 +1,5 @@ // SPDX-License-Identifier: MPL-2.0 -// Copyright (C) 2025 Arduino SA +// Copyright (c) Arduino s.r.l. and/or its affiliated companies package main diff --git a/extra/zephyr-sketch-tool/main.go b/extra/zephyr-sketch-tool/main.go index b6101c5d7..110846ab6 100644 --- a/extra/zephyr-sketch-tool/main.go +++ b/extra/zephyr-sketch-tool/main.go @@ -1,3 +1,6 @@ +// Copyright (c) Arduino s.r.l. and/or its affiliated companies +// SPDX-License-Identifier: Apache-2.0 + package main import ( diff --git a/libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h b/libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h index a6c8b2893..c3323c923 100644 --- a/libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h +++ b/libraries/Arduino_LED_Matrix/src/Arduino_LED_Matrix.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include #include diff --git a/libraries/Arduino_OTA/examples/OTA_WiFi/OTA_WiFi.ino b/libraries/Arduino_OTA/examples/OTA_WiFi/OTA_WiFi.ino new file mode 100644 index 000000000..3c4b03d9b --- /dev/null +++ b/libraries/Arduino_OTA/examples/OTA_WiFi/OTA_WiFi.ino @@ -0,0 +1,87 @@ +/* + * OTA WiFi Update Example + * + * Downloads a firmware update (.ota file) over HTTP and applies it. + * The .ota file includes an OTA header with LZSS compression and CRC-32. + * + * Works on any board with WiFi + QSPI filesystem (OTA storage). + * + * To use: + * 1. Build your sketch normally — the .ota file is created automatically + * 2. Host the .ota file on an HTTP server: + * python3 -m http.server 8080 + * 3. Upload this sketch via USB + * 4. The board downloads the .ota, verifies CRC, decompresses to QSPI + * 5. On reboot, the loader validates the new sketch and flashes it + */ + +#include +#include +#include "arduino_secrets.h" + +ArduinoOTALoaderClass ArduinoOTA; + +void setup() { + Serial.begin(115200); + while (!Serial); + + if (WiFi.status() == WL_NO_SHIELD) { + Serial.println("Communication with WiFi module failed!"); + while (true); + } + + WiFi.begin(SECRET_SSID, SECRET_PASS); + while (WiFi.status() != WL_CONNECTED) { + Serial.println(WiFi.status()); + delay(3000); + Serial.println("Connecting to WiFi..."); + } + Serial.println("Connected to WiFi"); + + IPAddress ip = WiFi.localIP(); + Serial.print("IP Address: "); + Serial.println(ip); + + ArduinoOTA.setURL("http://192.168.1.102:8000/Blink.ino.ota"); + + if (ArduinoOTA.begin() != ArduinoOTAClass::Error::None) { + Serial.print("Begin failed: "); + Serial.println(ArduinoOTA.errorString()); + return; + } + + Serial.println("Downloading..."); + int bytes = ArduinoOTA.download(); + if (bytes < 0) { + Serial.print("Download failed: "); + Serial.println(ArduinoOTA.errorString()); + return; + } + Serial.print("Downloaded "); + Serial.print(bytes); + Serial.println(" bytes"); + + Serial.println("Verifying and decompressing..."); + int size = ArduinoOTA.decompress(); + if (size < 0) { + Serial.print("Decompress failed: "); + Serial.println(ArduinoOTA.errorString()); + return; + } + Serial.print("Decompressed size: "); + Serial.print(size); + Serial.println(" bytes"); + + if (ArduinoOTA.update() != ArduinoOTAClass::Error::None) { + Serial.print("Update failed: "); + Serial.println(ArduinoOTA.errorString()); + return; + } + + Serial.println("Rebooting..."); + delay(500); + ArduinoOTA.reset(); +} + +void loop() { +} diff --git a/libraries/Arduino_OTA/examples/OTA_WiFi/arduino_secrets.h b/libraries/Arduino_OTA/examples/OTA_WiFi/arduino_secrets.h new file mode 100644 index 000000000..74d892a2e --- /dev/null +++ b/libraries/Arduino_OTA/examples/OTA_WiFi/arduino_secrets.h @@ -0,0 +1,8 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#define SECRET_SSID "your-ssid" +#define SECRET_PASS "your-password" diff --git a/libraries/Arduino_OTA/library.properties b/libraries/Arduino_OTA/library.properties new file mode 100644 index 000000000..8f0e7bfd0 --- /dev/null +++ b/libraries/Arduino_OTA/library.properties @@ -0,0 +1,9 @@ +name=Arduino_OTA +version=0.1.0 +author=Arduino +maintainer=Arduino +sentence=OTA firmware updates over WiFi +category=Communication +architectures=zephyr,zephyr_main,zephyr_contrib +includes=Arduino_OTA.h +depends=WiFi,SocketWrapper diff --git a/libraries/Arduino_OTA/src/Arduino_OTA.cpp b/libraries/Arduino_OTA/src/Arduino_OTA.cpp new file mode 100644 index 000000000..ade234641 --- /dev/null +++ b/libraries/Arduino_OTA/src/Arduino_OTA.cpp @@ -0,0 +1,415 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "Arduino_OTA.h" +#include "lzss.h" + +#include +#include +#include +#include + +#include +#include +#include +#include + +#define OTA_BUF_SIZE 4096 +#define OTA_TEMP_PATH "/ota:/UPDATE.BIN.OTA" +#define OTA_FILE_PATH "/ota:/UPDATE.BIN" + +// CRC-32 table (IEEE, same as Arduino_Portenta_OTA) +static const uint32_t crc_table[256] = { + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +uint32_t ArduinoOTAClass::crc_update(uint32_t crc, const void *data, size_t len) +{ + const uint8_t *d = (const uint8_t *)data; + while (len--) { + crc = crc_table[(crc ^ *d++) & 0xFF] ^ (crc >> 8); + } + return crc; +} + +void ArduinoOTAClass::setURL(const char *url) +{ + _url = url; + _error = Error::None; +} + +void ArduinoOTAClass::setCACert(const char *ca_cert_pem) +{ + _ca_cert = ca_cert_pem; +} + +int ArduinoOTAClass::parseURL() +{ + if (_url == nullptr) { + _error = Error::OtaDownload; + return -1; + } + + const char *p = _url; + if (strncmp(p, "https://", 8) == 0) { + _use_tls = true; + p += 8; + } else if (strncmp(p, "http://", 7) == 0) { + _use_tls = false; + p += 7; + } else { + _error = Error::OtaDownload; + return -1; + } + + const char *host_start = p; + const char *colon = nullptr; + const char *slash = nullptr; + + while (*p && *p != '/' && *p != ':') p++; + if (*p == ':') { + colon = p; + p++; + while (*p && *p != '/') p++; + } + if (*p == '/') { + slash = p; + } + + size_t host_len = colon ? (size_t)(colon - host_start) + : slash ? (size_t)(slash - host_start) + : strlen(host_start); + + if (host_len == 0 || host_len >= sizeof(_host)) { + _error = Error::OtaDownload; + return -1; + } + memcpy(_host, host_start, host_len); + _host[host_len] = '\0'; + + _port = colon ? (uint16_t)atoi(colon + 1) : (_use_tls ? 443 : 80); + + if (slash) { + size_t path_len = strlen(slash); + if (path_len >= sizeof(_path)) { + _error = Error::OtaDownload; + return -1; + } + memcpy(_path, slash, path_len + 1); + } else { + _path[0] = '/'; + _path[1] = '\0'; + } + + return 0; +} + +int ArduinoOTAClass::httpDownload(const char *filepath) +{ + if (parseURL() != 0) return -1; + + ZephyrSocketWrapper sock; + bool connected; + +#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS) + if (_use_tls) { + connected = sock.connectSSL(_host, _port, _ca_cert); + } else +#endif + { + connected = sock.connect(_host, _port); + } + + if (!connected) { + _error = Error::OtaDownload; + return -1; + } + + char req_buf[512]; + int req_len = snprintf(req_buf, sizeof(req_buf), + "GET %s HTTP/1.1\r\nHost: %s:%u\r\nConnection: close\r\n\r\n", + _path, _host, _port); + + int ret = sock.send((const uint8_t *)req_buf, req_len); + if (ret < 0) { + _error = Error::OtaDownload; + return -1; + } + + // Receive headers + static uint8_t buf[OTA_BUF_SIZE]; + int total_hdr = 0; + int hdr_end = -1; + uint32_t content_length = 0; + + while (total_hdr < (int)sizeof(buf) - 1) { + int n = sock.recv(buf + total_hdr, sizeof(buf) - 1 - total_hdr, 0); + if (n == -EAGAIN || n == -EWOULDBLOCK) continue; + if (n <= 0) { + _error = Error::OtaDownload; + return -1; + } + total_hdr += n; + buf[total_hdr] = '\0'; + + char *eoh = strstr((char *)buf, "\r\n\r\n"); + if (eoh) { + hdr_end = (eoh - (char *)buf) + 4; + break; + } + } + + if (hdr_end < 0) { + _error = Error::OtaDownload; + return -1; + } + + if (strncmp((char *)buf, "HTTP/1.", 7) != 0) { + _error = Error::OtaDownload; + return -1; + } + int status_code = atoi((char *)buf + 9); + if (status_code != 200) { + _error = Error::OtaDownload; + return -1; + } + + const char *cl = strstr((char *)buf, "Content-Length:"); + if (!cl) cl = strstr((char *)buf, "content-length:"); + if (cl) { + content_length = (uint32_t)atol(cl + 15); + } + if (content_length == 0) { + _error = Error::OtaDownload; + return -1; + } + + // Open output file + struct fs_file_t file; + fs_file_t_init(&file); + ret = fs_open(&file, filepath, FS_O_CREATE | FS_O_WRITE); + if (ret < 0) { + _error = Error::OtaStorageOpen; + return -1; + } + + // Write body data already in buffer + uint32_t written = 0; + int body_in_buf = total_hdr - hdr_end; + if (body_in_buf > 0) { + ret = fs_write(&file, buf + hdr_end, body_in_buf); + if (ret < 0) { + fs_close(&file); + _error = Error::OtaDownload; + return -1; + } + written += body_in_buf; + } + + // Stream remaining body + while (written < content_length) { + feedWatchdog(); + int n = sock.recv(buf, sizeof(buf), 0); + if (n == -EAGAIN || n == -EWOULDBLOCK) continue; + if (n <= 0) break; + ret = fs_write(&file, buf, n); + if (ret < 0) { + fs_close(&file); + _error = Error::OtaDownload; + return -1; + } + written += n; + } + + fs_close(&file); + + if (written != content_length) { + _error = Error::OtaDownload; + return -1; + } + + return (int)written; +} + +int ArduinoOTAClass::download() +{ + int ret = httpDownload(OTA_TEMP_PATH); + if (ret < 0) return (int)_error; + return ret; +} + +bool ArduinoOTAClass::isOtaCapable() { return false; } +ArduinoOTAClass::Error ArduinoOTAClass::begin() { return Error::NoOtaStorage; } +ArduinoOTAClass::Error ArduinoOTAClass::update() { return Error::NoOtaStorage; } +void ArduinoOTAClass::reset() {} + +int32_t ArduinoOTAClass::filecopy(struct fs_file_t *in, struct fs_file_t *out) +{ + uint8_t buf[512]; + int32_t total = 0; + ssize_t n; + while ((n = fs_read(in, buf, sizeof(buf))) > 0) { + if (fs_write(out, buf, n) != n) return -1; + total += n; + if (total % (512 * 16) == 0) + feedWatchdog(); + } + return total; +} + +int ArduinoOTAClass::decompress() +{ + _error = Error::None; + + // Open temp file and validate header + struct fs_file_t file; + fs_file_t_init(&file); + int ret = fs_open(&file, OTA_TEMP_PATH, FS_O_READ); + if (ret < 0) { + _error = Error::OtaStorageOpen; + return (int)_error; + } + + fs_seek(&file, 0, FS_SEEK_END); + off_t file_size = fs_tell(&file); + fs_seek(&file, 0, FS_SEEK_SET); + + OTAHeader hdr; + if (fs_read(&file, &hdr, OTA_HEADER_SIZE) != OTA_HEADER_SIZE) { + fs_close(&file); + _error = Error::OtaHeaderLength; + return (int)_error; + } + +#if defined(OTA_BOARD_MAGIC) + if (hdr.magic_number != OTA_BOARD_MAGIC) { + fs_close(&file); + _error = Error::OtaHeaderCrc; + return (int)_error; + } +#endif + + if ((off_t)hdr.len != file_size - 8) { + fs_close(&file); + _error = Error::OtaHeaderLength; + return (int)_error; + } + + bool compressed = (hdr.version[0] & OTA_FLAG_COMPRESS) != 0; + + // Verify CRC-32 over file[8:] + fs_seek(&file, 8, FS_SEEK_SET); + uint32_t crc = 0xFFFFFFFF; + uint8_t buf[512]; + ssize_t n; + int chunk_count = 0; + while ((n = fs_read(&file, buf, sizeof(buf))) > 0) { + crc = crc_update(crc, buf, n); + if (++chunk_count % 16 == 0) + feedWatchdog(); + } + crc ^= 0xFFFFFFFF; + + if (crc != hdr.crc32) { + fs_close(&file); + _error = Error::OtaHeaderCrc; + return (int)_error; + } + fs_close(&file); + + // Decompress (or copy) payload to UPDATE.BIN + struct fs_file_t in_file, out_file; + fs_file_t_init(&in_file); + fs_file_t_init(&out_file); + + ret = fs_open(&in_file, OTA_TEMP_PATH, FS_O_READ); + if (ret < 0) { + _error = Error::OtaStorageOpen; + fs_unlink(OTA_TEMP_PATH); + return (int)_error; + } + + ret = fs_open(&out_file, OTA_FILE_PATH, FS_O_CREATE | FS_O_WRITE); + if (ret < 0) { + fs_close(&in_file); + _error = Error::OtaStorageOpen; + fs_unlink(OTA_TEMP_PATH); + return (int)_error; + } + + fs_seek(&in_file, OTA_HEADER_SIZE, FS_SEEK_SET); + int32_t output_size = compressed ? lzss_decompress(&in_file, &out_file) + : filecopy(&in_file, &out_file); + + fs_close(&in_file); + fs_close(&out_file); + + if (output_size < 0) { + _error = Error::OtaHeaderCrc; + fs_unlink(OTA_TEMP_PATH); + return (int)_error; + } + + fs_unlink(OTA_TEMP_PATH); + _program_length = (uint32_t)output_size; + return (int)output_size; +} + +void ArduinoOTAClass::setFeedWatchdogFunc(void (*func)(void)) +{ + _feed_watchdog_func = func; +} + +void ArduinoOTAClass::feedWatchdog() +{ + if (_feed_watchdog_func) _feed_watchdog_func(); +} + +const char* ArduinoOTAClass::errorString() +{ + switch (_error) { + case Error::None: return "no error"; + case Error::NoCapableBootloader: return "bootloader not OTA capable"; + case Error::NoOtaStorage: return "no OTA storage available"; + case Error::OtaStorageInit: return "OTA storage init failed"; + case Error::OtaStorageOpen: return "OTA storage open failed"; + case Error::OtaHeaderLength: return "OTA header length mismatch"; + case Error::OtaHeaderCrc: return "OTA header CRC mismatch"; + case Error::OtaDownload: return "OTA download failed"; + default: return "unknown error"; + } +} diff --git a/libraries/Arduino_OTA/src/Arduino_OTA.h b/libraries/Arduino_OTA/src/Arduino_OTA.h new file mode 100644 index 000000000..ffe3557af --- /dev/null +++ b/libraries/Arduino_OTA/src/Arduino_OTA.h @@ -0,0 +1,79 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include + +struct fs_file_t; + +// OTA header (20 bytes, matching Arduino_Portenta_OTA format) +struct OTAHeader { + uint32_t len; // file_size - 8 + uint32_t crc32; // CRC-32 of file[8:] + uint32_t magic_number; // board-specific magic + uint8_t version[8]; // bitfield: header_ver(6)|compress(1)|reserved(1)|... +} __attribute__((packed)); + +#define OTA_HEADER_SIZE 20 +#define OTA_FLAG_COMPRESS 0x40 // version[0] bit 6 + +//// Board-specific OTA magic numbers +#if defined(ARDUINO_PORTENTA_H7_M7) +#define OTA_BOARD_MAGIC 0x2341025B +#elif defined(ARDUINO_GIGA) +#define OTA_BOARD_MAGIC 0x23410266 +#elif defined(ARDUINO_OPTA) +#define OTA_BOARD_MAGIC 0x23410064 +#elif defined(ARDUINO_PORTENTA_C33) +#define OTA_BOARD_MAGIC 0x23410068 +#endif + +class ArduinoOTAClass { +public: + enum class Error : int { + None = 0, + NoOtaStorage = -1, + NoCapableBootloader = -2, + OtaStorageInit = -3, + OtaStorageOpen = -4, + OtaHeaderLength = -5, + OtaHeaderCrc = -6, + OtaDownload = -12, + }; + + + void setURL(const char *url); + void setCACert(const char *ca_cert_pem); + int download(); + void setFeedWatchdogFunc(void (*func)(void)); + void feedWatchdog(); + const char* errorString(); + + virtual ~ArduinoOTAClass() = default; + virtual bool isOtaCapable(); + virtual Error begin(); // verify OTA storage accessible + virtual int decompress(); // verify header+CRC, LZSS decompress -> UPDATE.BIN + virtual Error update(); // signal bootloader/loader for update on reboot + virtual void reset(); // reboot (does not return) + +protected: + int parseURL(); + int httpDownload(const char *filepath); + int32_t filecopy(struct fs_file_t *in, struct fs_file_t *out); + static uint32_t crc_update(uint32_t crc, const void *data, size_t len); + + const char *_url = nullptr; + const char *_ca_cert = nullptr; + bool _use_tls = false; + char _host[128]; + char _path[256]; + uint16_t _port = 80; + uint32_t _program_length = 0; + Error _error = Error::None; + void (*_feed_watchdog_func)(void) = nullptr; +}; diff --git a/libraries/Arduino_OTA/src/Arduino_OTA_Legacy.cpp b/libraries/Arduino_OTA/src/Arduino_OTA_Legacy.cpp new file mode 100644 index 000000000..076c0c972 --- /dev/null +++ b/libraries/Arduino_OTA/src/Arduino_OTA_Legacy.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "Arduino_OTA_Legacy.h" + +#include + +#include + +#if defined(CONFIG_SOC_SERIES_STM32H7X) +#include +#endif + +#define OTA_FILE_PATH "/ota:/UPDATE.BIN" + +#if defined(CONFIG_SOC_SERIES_STM32H7X) +#define OTA_MAGIC_BOOT 0x07AA +#define OTA_STORAGE_TYPE 0xA4 // QSPI_FLASH | FATFS | MBR +#define OTA_MBR_PART 2 +#endif + +bool ArduinoOTALegacyClass::isOtaCapable() +{ +#if defined(CONFIG_SOC_SERIES_STM32H7X) + // STM32H7: check bootloader version at fixed address + const uint8_t *bootloader_data = (const uint8_t *)(0x08000000 + 0x1F000); + return bootloader_data[1] >= 22; +#else + // C33: SFU is always present if properly flashed + return true; +#endif +} + +ArduinoOTALegacyClass::Error ArduinoOTALegacyClass::begin() +{ + _program_length = 0; + _error = Error::None; + + if (!isOtaCapable()) { + _error = Error::NoCapableBootloader; + return _error; + } + + struct fs_statvfs stat; + if (fs_statvfs("/ota:", &stat) < 0) { + _error = Error::OtaStorageInit; + return _error; + } + + return Error::None; +} + + +ArduinoOTALegacyClass::Error ArduinoOTALegacyClass::update() +{ +#if defined(CONFIG_SOC_SERIES_STM32H7X) + // STM32H7: write RTC backup registers to signal bootloader + struct fs_dirent entry; + if (fs_stat(OTA_FILE_PATH, &entry) < 0) { + _error = Error::OtaStorageOpen; + return _error; + } + _program_length = entry.size; + + uint32_t rtc_base = (uint32_t)&(RTC->BKP0R); + + // in EDK use this instead of HAL_RTCEx_BKUPWrite + *(__IO uint32_t *)(rtc_base + RTC_BKP_DR0 * 4U) = OTA_MAGIC_BOOT; + *(__IO uint32_t *)(rtc_base + RTC_BKP_DR1 * 4U) = OTA_STORAGE_TYPE; + *(__IO uint32_t *)(rtc_base + RTC_BKP_DR2 * 4U) = OTA_MBR_PART; + *(__IO uint32_t *)(rtc_base + RTC_BKP_DR3 * 4U) = _program_length; +#endif + // C33: SFU checks for UPDATE.BIN.OTA on every boot — no action needed + + return Error::None; +} + + +void ArduinoOTALegacyClass::reset() +{ + NVIC_SystemReset(); +} + diff --git a/libraries/Arduino_OTA/src/Arduino_OTA_Legacy.h b/libraries/Arduino_OTA/src/Arduino_OTA_Legacy.h new file mode 100644 index 000000000..886d0a83b --- /dev/null +++ b/libraries/Arduino_OTA/src/Arduino_OTA_Legacy.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ +#pragma once + +#include + +class ArduinoOTALegacyClass: public ArduinoOTAClass { +public: + bool isOtaCapable() override; + + Error begin() override; + Error update() override; + void reset() override; +}; diff --git a/libraries/Arduino_OTA/src/Arduino_OTA_Loader.cpp b/libraries/Arduino_OTA/src/Arduino_OTA_Loader.cpp new file mode 100644 index 000000000..d630673ef --- /dev/null +++ b/libraries/Arduino_OTA/src/Arduino_OTA_Loader.cpp @@ -0,0 +1,60 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ +#include "Arduino_OTA_Loader.h" + +#include +#include + +#define OTA_FILE_PATH "/ota:/UPDATE.BIN" +#define OTA_SENTINEL_PATH "/ota:/OTA_UPDATE_PENDING" + +bool ArduinoOTALoaderClass::isOtaCapable() +{ + struct fs_statvfs stat; + return fs_statvfs("/ota:", &stat) == 0; +} + +ArduinoOTALoaderClass::Error ArduinoOTALoaderClass::begin() +{ + _program_length = 0; + _error = Error::None; + + if (!isOtaCapable()) { + _error = Error::NoOtaStorage; + return _error; + } + + return Error::None; +} + +ArduinoOTALoaderClass::Error ArduinoOTALoaderClass::update() +{ + struct fs_dirent entry; + if (fs_stat(OTA_FILE_PATH, &entry) < 0) { + _error = Error::OtaStorageOpen; + return _error; + } + _program_length = entry.size; + + /* Create sentinel file for the loader to pick up on reboot */ + struct fs_file_t sentinel; + fs_file_t_init(&sentinel); + int ret = fs_open(&sentinel, OTA_SENTINEL_PATH, FS_O_CREATE | FS_O_WRITE); + if (ret < 0) { + _error = Error::OtaStorageOpen; + return _error; + } + fs_close(&sentinel); + + return Error::None; +} + + +void ArduinoOTALoaderClass::reset() +{ + sys_reboot(SYS_REBOOT_COLD); +} + diff --git a/libraries/Arduino_OTA/src/Arduino_OTA_Loader.h b/libraries/Arduino_OTA/src/Arduino_OTA_Loader.h new file mode 100644 index 000000000..a2ef3c58f --- /dev/null +++ b/libraries/Arduino_OTA/src/Arduino_OTA_Loader.h @@ -0,0 +1,18 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include + +class ArduinoOTALoaderClass: public ArduinoOTAClass { +public: + bool isOtaCapable() override; + + Error begin() override; + Error update() override; + void reset() override; +}; diff --git a/libraries/Arduino_OTA/src/lzss.cpp b/libraries/Arduino_OTA/src/lzss.cpp new file mode 100644 index 000000000..473f61153 --- /dev/null +++ b/libraries/Arduino_OTA/src/lzss.cpp @@ -0,0 +1,87 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "lzss.h" +#include + +// Read n bits from the input file. Returns the value, or -1 on EOF. +static int getbits(struct fs_file_t *f, int n, uint32_t *buf, int *buf_size) +{ + while (*buf_size < n) { + uint8_t c; + if (fs_read(f, &c, 1) != 1) { + return -1; + } + *buf = (*buf << 8) | c; + *buf_size += 8; + } + int x = *buf >> (*buf_size - n); + *buf &= (1 << (*buf_size - n)) - 1; + *buf_size -= n; + return x; +} + +int32_t lzss_decompress(struct fs_file_t *input, struct fs_file_t *output) +{ + uint8_t ring[LZSS_N]; + memset(ring, ' ', sizeof(ring)); + int r = LZSS_N - LZSS_F; + + uint8_t outbuf[512]; + int outpos = 0; + int32_t total = 0; + + uint32_t bits = 0; + int nbits = 0; + + for (;;) { + int flag = getbits(input, 1, &bits, &nbits); + if (flag < 0) break; + + if (flag) { + // Literal: 8-bit byte + int c = getbits(input, 8, &bits, &nbits); + if (c < 0) break; + + outbuf[outpos++] = (uint8_t)c; + ring[r] = (uint8_t)c; + r = (r + 1) & LZSS_N_MASK; + + if (outpos >= (int)sizeof(outbuf)) { + if (fs_write(output, outbuf, outpos) != outpos) return -1; + total += outpos; + outpos = 0; + } + } else { + // Match: EI-bit position + EJ-bit length + int i = getbits(input, LZSS_EI, &bits, &nbits); + if (i < 0) break; + int j = getbits(input, LZSS_EJ, &bits, &nbits); + if (j < 0) break; + + for (int k = 0; k <= j + 1; k++) { + uint8_t c = ring[(i + k) & LZSS_N_MASK]; + outbuf[outpos++] = c; + ring[r] = c; + r = (r + 1) & LZSS_N_MASK; + + if (outpos >= (int)sizeof(outbuf)) { + if (fs_write(output, outbuf, outpos) != outpos) return -1; + total += outpos; + outpos = 0; + } + } + } + } + + // Flush remaining + if (outpos > 0) { + if (fs_write(output, outbuf, outpos) != outpos) return -1; + total += outpos; + } + + return total; +} diff --git a/libraries/Arduino_OTA/src/lzss.h b/libraries/Arduino_OTA/src/lzss.h new file mode 100644 index 000000000..df7cb7c38 --- /dev/null +++ b/libraries/Arduino_OTA/src/lzss.h @@ -0,0 +1,22 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once + +#include +#include + +// LZSS parameters matching the Arduino OTA format +#define LZSS_EI 11 +#define LZSS_EJ 4 +#define LZSS_N (1 << LZSS_EI) // 2048 +#define LZSS_F ((1 << LZSS_EJ) + 1) // 17 +#define LZSS_N_MASK (LZSS_N - 1) + +// Decompress LZSS data from input file to output file. +// Input file should be positioned at the start of compressed data. +// Returns decompressed size on success, negative on error. +int32_t lzss_decompress(struct fs_file_t *input, struct fs_file_t *output); diff --git a/libraries/Camera/src/camera.cpp b/libraries/Camera/src/camera.cpp index 7288c8b84..078fd8093 100644 --- a/libraries/Camera/src/camera.cpp +++ b/libraries/Camera/src/camera.cpp @@ -1,5 +1,6 @@ /* - * Copyright 2025 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * SPDX-License-Identifier: LGPL-3.0-or-later * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by diff --git a/libraries/Camera/src/camera.h b/libraries/Camera/src/camera.h index d6f05e200..4592c05f7 100644 --- a/libraries/Camera/src/camera.h +++ b/libraries/Camera/src/camera.h @@ -1,5 +1,6 @@ /* - * Copyright 2025 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * SPDX-License-Identifier: LGPL-3.0-or-later * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by diff --git a/libraries/Ethernet/README.md b/libraries/Ethernet/README.md index 872a66373..339460f94 100644 --- a/libraries/Ethernet/README.md +++ b/libraries/Ethernet/README.md @@ -3,9 +3,3 @@ Provides Ethernet connectivity for Arduino boards using the Arduino Zephyr core, together with a shield or carrier featuring an Ethernet connector. 📖 For more information about this library please read the documentation [here](http://www.arduino.cc/en/Reference/Ethernet). - -## License - -Copyright (c) 2025 Arduino SA. All rights reserved. - -This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/. \ No newline at end of file diff --git a/libraries/Ethernet/src/Ethernet.cpp b/libraries/Ethernet/src/Ethernet.cpp index 9c3d7aa9d..7589e9712 100644 --- a/libraries/Ethernet/src/Ethernet.cpp +++ b/libraries/Ethernet/src/Ethernet.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #include "Ethernet.h" #if DT_HAS_COMPAT_STATUS_OKAY(ethernet_phy) diff --git a/libraries/Ethernet/src/Ethernet.h b/libraries/Ethernet/src/Ethernet.h index 1667da650..4ee82d5d0 100644 --- a/libraries/Ethernet/src/Ethernet.h +++ b/libraries/Ethernet/src/Ethernet.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #include "SocketHelpers.h" #include diff --git a/libraries/Ethernet/src/ZephyrEthernet.h b/libraries/Ethernet/src/ZephyrEthernet.h index 6ada64df6..ed0b156bc 100644 --- a/libraries/Ethernet/src/ZephyrEthernet.h +++ b/libraries/Ethernet/src/ZephyrEthernet.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #pragma once #include "Ethernet.h" diff --git a/libraries/Ethernet/src/Zephyr_Ethernet.h b/libraries/Ethernet/src/Zephyr_Ethernet.h index 61aaa3153..c4ed28820 100644 --- a/libraries/Ethernet/src/Zephyr_Ethernet.h +++ b/libraries/Ethernet/src/Zephyr_Ethernet.h @@ -1 +1,7 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + // placeholder to allow the discovery of this library diff --git a/libraries/SocketWrapper/SocketHelpers.cpp b/libraries/SocketWrapper/SocketHelpers.cpp index 3feef24c6..30a8f7b75 100644 --- a/libraries/SocketWrapper/SocketHelpers.cpp +++ b/libraries/SocketWrapper/SocketHelpers.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #include "SocketHelpers.h" #include diff --git a/libraries/SocketWrapper/SocketHelpers.h b/libraries/SocketWrapper/SocketHelpers.h index d0c451627..58e5a5451 100644 --- a/libraries/SocketWrapper/SocketHelpers.h +++ b/libraries/SocketWrapper/SocketHelpers.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #pragma once #include diff --git a/libraries/SocketWrapper/SocketWrapper.h b/libraries/SocketWrapper/SocketWrapper.h index 5f6337e8f..f1938b7b3 100644 --- a/libraries/SocketWrapper/SocketWrapper.h +++ b/libraries/SocketWrapper/SocketWrapper.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #pragma once #include "zephyr/sys/printk.h" @@ -7,6 +13,8 @@ #endif #include +#include +#include class ZephyrSocketWrapper { protected: @@ -23,7 +31,7 @@ class ZephyrSocketWrapper { ~ZephyrSocketWrapper() { if (sock_fd != -1) { - ::close(sock_fd); + zsock_close(sock_fd); } } @@ -63,7 +71,7 @@ class ZephyrSocketWrapper { } if (::connect(sock_fd, res->ai_addr, res->ai_addrlen) < 0) { - ::close(sock_fd); + zsock_close(sock_fd); sock_fd = -1; rv = false; goto exit; @@ -93,7 +101,7 @@ class ZephyrSocketWrapper { } if (::connect(sock_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - ::close(sock_fd); + zsock_close(sock_fd); sock_fd = -1; return false; } @@ -171,7 +179,7 @@ class ZephyrSocketWrapper { } if (!rv && sock_fd >= 0) { - ::close(sock_fd); + zsock_close(sock_fd); sock_fd = -1; } return rv; @@ -225,7 +233,7 @@ class ZephyrSocketWrapper { void close() { if (sock_fd != -1) { - ::close(sock_fd); + zsock_close(sock_fd); sock_fd = -1; } } @@ -244,7 +252,7 @@ class ZephyrSocketWrapper { zsock_ioctl(sock_fd, ZFD_IOCTL_FIONBIO); if (::bind(sock_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) { - ::close(sock_fd); + zsock_close(sock_fd); sock_fd = -1; return false; } @@ -258,7 +266,7 @@ class ZephyrSocketWrapper { } if (::listen(sock_fd, backlog) < 0) { - ::close(sock_fd); + zsock_close(sock_fd); sock_fd = -1; return false; } diff --git a/libraries/SocketWrapper/ZephyrClient.h b/libraries/SocketWrapper/ZephyrClient.h index d338d7662..733b1e4b4 100644 --- a/libraries/SocketWrapper/ZephyrClient.h +++ b/libraries/SocketWrapper/ZephyrClient.h @@ -1,9 +1,28 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #pragma once #include "SocketWrapper.h" #include "api/Client.h" #include "unistd.h" #include "zephyr/sys/printk.h" +#include + +/* + * errno is a TLS variable in picolibc (CONFIG_LIBC_ERRNO=1). LLEXT modules + * are compiled with -ftls-model=local-exec which cannot access the loader's + * TLS block directly — doing so generates __aeabi_read_tp calls that either + * aren't exported or use the wrong TLS offset. + * + * arduino_errno_ptr() runs inside the loader where the TLS layout is known + * and returns a plain pointer. Dereferencing it on the LLEXT side requires + * no TLS mechanism. + */ +extern "C" int *arduino_errno_ptr(void); class ZephyrClient : public arduino::Client, ZephyrSocketWrapper { private: @@ -57,16 +76,17 @@ class ZephyrClient : public arduino::Client, ZephyrSocketWrapper { int read(uint8_t *buffer, size_t size) override { auto received = recv(buffer, size); + if (received > 0) { + return received; + } if (received == 0) { return 0; - } else if (received < 0) { - if (errno == EAGAIN || errno == EWOULDBLOCK) { - return 0; - } else { - return 0; - } } - return received; + int err = *arduino_errno_ptr(); + if (err == EAGAIN || err == EWOULDBLOCK) { + return 0; + } + return -1; } size_t write(uint8_t c) override { diff --git a/libraries/SocketWrapper/ZephyrSSLClient.h b/libraries/SocketWrapper/ZephyrSSLClient.h index a29bd13d6..b03a2746f 100644 --- a/libraries/SocketWrapper/ZephyrSSLClient.h +++ b/libraries/SocketWrapper/ZephyrSSLClient.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #pragma once #include "SocketWrapper.h" diff --git a/libraries/SocketWrapper/ZephyrServer.h b/libraries/SocketWrapper/ZephyrServer.h index 6e957d48a..3b7056f8c 100644 --- a/libraries/SocketWrapper/ZephyrServer.h +++ b/libraries/SocketWrapper/ZephyrServer.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #pragma once #include "SocketWrapper.h" diff --git a/libraries/SocketWrapper/ZephyrUDP.h b/libraries/SocketWrapper/ZephyrUDP.h index e6b787e96..2b8abe0e7 100644 --- a/libraries/SocketWrapper/ZephyrUDP.h +++ b/libraries/SocketWrapper/ZephyrUDP.h @@ -1,6 +1,7 @@ /* - MbedUdp.h - UDP implementation using mbed Sockets - Copyright (c) 2021 Arduino SA. All right reserved. + ZephyrUDP.h - UDP implementation using Zephyr Sockets + Copyright (c) Arduino s.r.l. and/or its affiliated companies + SPDX-License-Identifier: LGPL-2.1-or-later This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public diff --git a/libraries/WiFi/examples/WiFiWebClient/arduino_secrets.h b/libraries/WiFi/examples/WiFiWebClient/arduino_secrets.h index 0c9fdd556..bec5bbe7f 100644 --- a/libraries/WiFi/examples/WiFiWebClient/arduino_secrets.h +++ b/libraries/WiFi/examples/WiFiWebClient/arduino_secrets.h @@ -1,2 +1,8 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #define SECRET_SSID "" #define SECRET_PASS "" diff --git a/libraries/WiFi/examples/WiFiWebClientTLS/arduino_secrets.h b/libraries/WiFi/examples/WiFiWebClientTLS/arduino_secrets.h index 0c9fdd556..bec5bbe7f 100644 --- a/libraries/WiFi/examples/WiFiWebClientTLS/arduino_secrets.h +++ b/libraries/WiFi/examples/WiFiWebClientTLS/arduino_secrets.h @@ -1,2 +1,8 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #define SECRET_SSID "" #define SECRET_PASS "" diff --git a/libraries/WiFi/library.properties b/libraries/WiFi/library.properties index eb7382ea6..728808b44 100644 --- a/libraries/WiFi/library.properties +++ b/libraries/WiFi/library.properties @@ -6,5 +6,5 @@ sentence=Enables WiFi connection paragraph=With this library you can use the WiFi to connect to Internet. category=Communication url=https://github.com/arduino/ArduinoCore-zephyr/tree/master/libraries/WiFi -architectures=zephyr_main,zephyr_contrib -includes=WiFi.h \ No newline at end of file +architectures=zephyr,zephyr_main,zephyr_contrib +includes=WiFi.h diff --git a/libraries/WiFi/src/WiFi.cpp b/libraries/WiFi/src/WiFi.cpp index 5935d49c8..e9de0830e 100644 --- a/libraries/WiFi/src/WiFi.cpp +++ b/libraries/WiFi/src/WiFi.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #include "WiFi.h" WiFiClass WiFi; diff --git a/libraries/WiFi/src/WiFi.h b/libraries/WiFi/src/WiFi.h index 739b5bb38..26fcd8079 100644 --- a/libraries/WiFi/src/WiFi.h +++ b/libraries/WiFi/src/WiFi.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #include "SocketHelpers.h" #include "utility/wl_definitions.h" diff --git a/libraries/WiFi/src/utility/wl_definitions.h b/libraries/WiFi/src/utility/wl_definitions.h index 59128dc73..572ff9dfb 100644 --- a/libraries/WiFi/src/utility/wl_definitions.h +++ b/libraries/WiFi/src/utility/wl_definitions.h @@ -1,6 +1,8 @@ /* wl_definitions.h - Library for Arduino Wifi shield. - Copyright (c) 2011-2014 Arduino. All right reserved. + Copyright (c) Arduino s.r.l. and/or its affiliated companies + SPDX-License-Identifier: LGPL-2.1-or-later + This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either diff --git a/libraries/Zephyr_SDRAM/src/SDRAM.cpp b/libraries/Zephyr_SDRAM/src/SDRAM.cpp index 76fa2f850..2391ba4f0 100644 --- a/libraries/Zephyr_SDRAM/src/SDRAM.cpp +++ b/libraries/Zephyr_SDRAM/src/SDRAM.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #include "SDRAM.h" #include "Arduino.h" diff --git a/libraries/Zephyr_SDRAM/src/SDRAM.h b/libraries/Zephyr_SDRAM/src/SDRAM.h index f7991cbf7..55ee60936 100644 --- a/libraries/Zephyr_SDRAM/src/SDRAM.h +++ b/libraries/Zephyr_SDRAM/src/SDRAM.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + #ifndef __SDRAM_H #define __SDRAM_H diff --git a/libraries/ea_malloc/LICENSE b/libraries/ea_malloc/LICENSE new file mode 100644 index 000000000..d21994a2d --- /dev/null +++ b/libraries/ea_malloc/LICENSE @@ -0,0 +1,7 @@ +Copyright 2017 Embedded Artistry LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/libraries/ea_malloc/ea_malloc.h b/libraries/ea_malloc/ea_malloc.h index 1fd54287f..2411584ae 100644 --- a/libraries/ea_malloc/ea_malloc.h +++ b/libraries/ea_malloc/ea_malloc.h @@ -1,7 +1,7 @@ /* -* Copyright © 2017 Embedded Artistry LLC. -* License: MIT. See LICENSE file for details. -*/ + * Copyright © 2017 Embedded Artistry LLC. + * SPDX-License-Identifier: MIT + */ #ifndef MALLOC_H_ #define MALLOC_H_ @@ -43,4 +43,4 @@ void ea_free(void* ptr); } #endif //__cplusplus -#endif //MALLOC_H_ \ No newline at end of file +#endif //MALLOC_H_ diff --git a/libraries/ea_malloc/ll.h b/libraries/ea_malloc/ll.h index a83be8ffb..02cf2353d 100644 --- a/libraries/ea_malloc/ll.h +++ b/libraries/ea_malloc/ll.h @@ -1,6 +1,11 @@ #ifndef LL_H__ #define LL_H__ +/* + * Copyright © 2017 Embedded Artistry LLC. + * SPDX-License-Identifier: MIT + */ + #include #include //size_t, NULL diff --git a/libraries/ea_malloc/malloc_freelist.c b/libraries/ea_malloc/malloc_freelist.c index 4fb1f7b39..a65ac86c5 100644 --- a/libraries/ea_malloc/malloc_freelist.c +++ b/libraries/ea_malloc/malloc_freelist.c @@ -1,6 +1,6 @@ /* * Copyright © 2017 Embedded Artistry LLC. - * License: MIT. See LICENSE file for details. + * SPDX-License-Identifier: MIT */ #include diff --git a/loader/Kconfig b/loader/Kconfig index f6ee63309..c7d6c4069 100644 --- a/loader/Kconfig +++ b/loader/Kconfig @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Arduino +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # # SPDX-License-Identifier: Apache-2.0 # diff --git a/loader/blobs/4343WA1_bin.c b/loader/blobs/4343WA1_bin.c index 2d6681f83..fe5633f7f 100644 --- a/loader/blobs/4343WA1_bin.c +++ b/loader/blobs/4343WA1_bin.c @@ -1,18 +1,9 @@ /* * Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved - * SPDX-License-Identifier: LicenseRef-PBL * - * This file and the related binary are licensed under the - * Permissive Binary License, Version 1.0 (the "License"); - * you may not use these files except in compliance with the License. - * - * You may obtain a copy of the License here: - * LICENSE-permissive-binary-license-1.0.txt and at - * https://www.mbed.com/licenses/PBL-1.0 - * - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: LicenseRef-scancode-pbl-1.0 */ + #include "wiced_resource.h" #if defined(CY_STORAGE_WIFI_DATA) diff --git a/loader/blobs/4343WA1_bin_qspi.c b/loader/blobs/4343WA1_bin_qspi.c index be2e76833..04ca04429 100644 --- a/loader/blobs/4343WA1_bin_qspi.c +++ b/loader/blobs/4343WA1_bin_qspi.c @@ -1,5 +1,5 @@ /* - * Copyright 2025 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * SPDX-License-Identifier: Apache-2.0 */ diff --git a/loader/blobs/4343WA1_clm_blob.c b/loader/blobs/4343WA1_clm_blob.c index 616bdedf2..71dcd3202 100644 --- a/loader/blobs/4343WA1_clm_blob.c +++ b/loader/blobs/4343WA1_clm_blob.c @@ -1,18 +1,9 @@ /* * Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved - * SPDX-License-Identifier: LicenseRef-PBL * - * This file and the related binary are licensed under the - * Permissive Binary License, Version 1.0 (the "License"); - * you may not use these files except in compliance with the License. - * - * You may obtain a copy of the License here: - * LICENSE-permissive-binary-license-1.0.txt and at - * https://www.mbed.com/licenses/PBL-1.0 - * - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: LicenseRef-scancode-pbl-1.0 */ + #include "wiced_resource.h" #if defined(CY_STORAGE_WIFI_DATA) diff --git a/loader/blobs/CMakeLists.txt b/loader/blobs/CMakeLists.txt index c8a25255a..325a55b02 100644 --- a/loader/blobs/CMakeLists.txt +++ b/loader/blobs/CMakeLists.txt @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: Apache-2.0 + zephyr_interface_library_named(blobs) if (CONFIG_BOARD_ARDUINO_PORTENTA_C33) diff --git a/loader/blobs/c33_bl.md b/loader/blobs/c33_bl.md new file mode 100644 index 000000000..3fcca4998 --- /dev/null +++ b/loader/blobs/c33_bl.md @@ -0,0 +1,32 @@ +## Zephyr-specific Portenta C33 bootloader + +The `c33_bl.bin` file is the Zephyr-specific Portenta C33 bootloader. It is a +binary file that can be flashed to the Portenta C33 to enable it to boot Zephyr +applications. + +Compared to the default C33 bootloader, the Zephyr-specific bootloader supports +an additional `alt` section for the sketch to be loaded. + +### Sources and compilation instructions + +The source code for the Zephyr-specific C33 bootloader can be found in the +[`arduino-renesas-bootloader` repository](https://github.com/arduino/arduino-renesas-bootloader/tree/zephyr_alt/) +on GitHub. The Zephyr-specific bootloader uses the `zephyr_alt` branch. + +This binary can be regenerated with the following commands: + +```bash +git clone https://github.com/arduino/arduino-renesas-bootloader +git clone https://github.com/hathach/tinyusb +cd tinyusb +patch -p1 < ../arduino-renesas-bootloader/0001-fix-arduino-bootloaders.patch +python tools/get_deps.py ra +cd .. +cd arduino-renesas-bootloader +git checkout zephyr_alt +TINYUSB_ROOT=$PWD/../tinyusb make -f Makefile.c33 +``` + +### License + +The Zephyr-specific Portenta C33 bootloader is licensed under the MIT license. diff --git a/loader/blobs/wifi_nvram_image.h b/loader/blobs/wifi_nvram_image_data.h similarity index 85% rename from loader/blobs/wifi_nvram_image.h rename to loader/blobs/wifi_nvram_image_data.h index 3f2279c2b..d65326680 100644 --- a/loader/blobs/wifi_nvram_image.h +++ b/loader/blobs/wifi_nvram_image_data.h @@ -1,17 +1,7 @@ /* * Copyright (c) 2019, Cypress Semiconductor Corporation, All Rights Reserved - * SPDX-License-Identifier: LicenseRef-PBL * - * This file and the related binary are licensed under the - * Permissive Binary License, Version 1.0 (the "License"); - * you may not use these files except in compliance with the License. - * - * You may obtain a copy of the License here: - * LICENSE-permissive-binary-license-1.0.txt and at - * https://www.mbed.com/licenses/PBL-1.0 - * - * See the License for the specific language governing permissions and - * limitations under the License. + * SPDX-License-Identifier: LicenseRef-scancode-pbl-1.0 */ /** @file diff --git a/loader/bootanimation.h b/loader/bootanimation.h index 01aeacece..5abeb34d3 100644 --- a/loader/bootanimation.h +++ b/loader/bootanimation.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + static const unsigned char bootanimation[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/loader/fixups.c b/loader/fixups.c index 80aa40369..2ab0fb22f 100644 --- a/loader/fixups.c +++ b/loader/fixups.c @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include #include @@ -118,7 +124,7 @@ SYS_INIT(camera_ext_clock_enable, POST_KERNEL, CONFIG_CLOCK_CONTROL_PWM_INIT_PRI #include #include -__stm32_sdram1_section static uint8_t __aligned(32) smh_pool[4 * 1024 * 1024]; +Z_GENERIC_SECTION(SDRAM1) static uint8_t __aligned(32) smh_pool[4 * 1024 * 1024]; int smh_init(void) { int ret = 0; diff --git a/loader/llext_exports.c b/loader/llext_exports.c index 8ffe2e863..c02f9e88e 100644 --- a/loader/llext_exports.c +++ b/loader/llext_exports.c @@ -1,12 +1,39 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include #include #include #include +#include #include #include #include +#include #include #include +#include + +/* + * Provide errno access for LLEXT modules. + * + * LLEXT modules are compiled with -ftls-model=local-exec which assumes TLS + * variables reside in the module's own TLS segment; accessing the loader's + * TLS errno directly from an LLEXT generates __aeabi_read_tp calls that + * either aren't exported or use the wrong segment offset. + * + * This function runs in the loader context where the TLS layout is known, + * and returns a plain pointer. LLEXT callers dereference it with no TLS + * mechanism involved on their side. + */ +int *arduino_errno_ptr(void) +{ + return &errno; +} +EXPORT_SYMBOL(arduino_errno_ptr); #define FORCE_EXPORT_SYM(name) \ extern void name(void); \ @@ -30,9 +57,11 @@ EXPORT_LIBC_SYM(strncpy); EXPORT_LIBC_SYM(strcasecmp); EXPORT_LIBC_SYM(strcmp); EXPORT_LIBC_SYM(strlen); -EXPORT_LIBC_SYM(strnlen); EXPORT_LIBC_SYM(strchr); EXPORT_LIBC_SYM(strcat); +EXPORT_LIBC_SYM(strcpy); +EXPORT_LIBC_SYM(memcmp); +EXPORT_LIBC_SYM(memset); // stdlib.h EXPORT_LIBC_SYM(malloc); @@ -91,6 +120,7 @@ EXPORT_LIBC_SYM(sqrt); EXPORT_LIBC_SYM(sqrtf); EXPORT_LIBC_SYM(tan); EXPORT_LIBC_SYM(tanf); +EXPORT_LIBC_SYM(ldexp); // stdio.h EXPORT_LIBC_SYM(puts); @@ -156,6 +186,15 @@ FORCE_EXPORT_SYM(net_mgmt_event_wait_on_iface); #if defined(CONFIG_MBEDTLS) FORCE_EXPORT_SYM(tls_credential_add); FORCE_EXPORT_SYM(tls_credential_get); +FORCE_EXPORT_SYM(mbedtls_pk_init); +FORCE_EXPORT_SYM(mbedtls_pk_free); +FORCE_EXPORT_SYM(mbedtls_pk_parse_public_key); +FORCE_EXPORT_SYM(mbedtls_pk_verify); +FORCE_EXPORT_SYM(mbedtls_sha256_init); +FORCE_EXPORT_SYM(mbedtls_sha256_starts); +FORCE_EXPORT_SYM(mbedtls_sha256_update); +FORCE_EXPORT_SYM(mbedtls_sha256_finish); +FORCE_EXPORT_SYM(mbedtls_sha256_free); #endif #if defined(CONFIG_WIFI) @@ -254,6 +293,11 @@ EXPORT_SYMBOL(k_work_schedule); //FORCE_EXPORT_SYM(k_timer_user_data_set); //FORCE_EXPORT_SYM(k_timer_start); +EXPORT_SYMBOL(time); +EXPORT_SYMBOL(sys_clock_settime); +EXPORT_SYMBOL(sys_reboot); +EXPORT_SYMBOL(mktime); + EXPORT_SYMBOL(printf); EXPORT_SYMBOL(sprintf); EXPORT_SYMBOL(snprintf); diff --git a/loader/main.c b/loader/main.c index badf3cb09..af583addc 100644 --- a/loader/main.c +++ b/loader/main.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2024 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * * SPDX-License-Identifier: Apache-2.0 */ @@ -24,9 +24,13 @@ LOG_MODULE_REGISTER(sketch); #include #include +#include #define HEADER_LEN 16 +#define OTA_SENTINEL_PATH "/ota:/OTA_UPDATE_PENDING" +#define OTA_UPDATE_PATH "/ota:/UPDATE.BIN" + struct sketch_header_v1 { uint8_t ver; // @ 0x07 uint32_t len; // @ 0x08 @@ -51,10 +55,16 @@ const struct device *const usb_dev = #if CONFIG_USB_DEVICE_STACK_NEXT #include struct usbd_context *usbd_init_device(usbd_msg_cb_t msg_cb); +static struct usbd_context *_usbd; + +int usb_disable() { + usbd_disable(_usbd); + usbd_shutdown(_usbd); +} int usb_enable(usb_dc_status_callback status_cb) { int err; - struct usbd_context *_usbd = usbd_init_device(NULL); + _usbd = usbd_init_device(NULL); if (_usbd == NULL) { return -ENODEV; } @@ -110,10 +120,120 @@ __attribute__((retain)) const uintptr_t sketch_max_size = DT_REG_SIZE(DT_NODELAB #endif __attribute__((retain)) const uintptr_t loader_max_size = LOADER_MAX_SIZE; +#if defined(CONFIG_FILE_SYSTEM) +static int try_ota_update(const struct flash_area *fa) +{ + struct fs_dirent entry; + int rc; + + /* Check for pending OTA update */ + if (fs_stat(OTA_SENTINEL_PATH, &entry) != 0) { + printk("OTA: no update pending\n"); + return 0; + } + + printk("OTA: update pending, validating...\n"); + + /* Open UPDATE.BIN */ + struct fs_file_t file; + fs_file_t_init(&file); + rc = fs_open(&file, OTA_UPDATE_PATH, FS_O_READ); + if (rc < 0) { + printk("OTA: failed to open %s, rc %d\n", OTA_UPDATE_PATH, rc); + fs_unlink(OTA_SENTINEL_PATH); + return -1; + } + + /* Get file size */ + fs_seek(&file, 0, FS_SEEK_END); + off_t file_size = fs_tell(&file); + fs_seek(&file, 0, FS_SEEK_SET); + + if (file_size < HEADER_LEN) { + printk("OTA: file too small (%ld bytes)\n", (long)file_size); + fs_close(&file); + fs_unlink(OTA_SENTINEL_PATH); + return -1; + } + + /* Read and validate sketch header */ + char header[HEADER_LEN]; + rc = fs_read(&file, header, HEADER_LEN); + if (rc != HEADER_LEN) { + printk("OTA: failed to read header\n"); + fs_close(&file); + fs_unlink(OTA_SENTINEL_PATH); + return -1; + } + + struct sketch_header_v1 *hdr = (struct sketch_header_v1 *)(header + 7); + if (hdr->ver != 0x1 || hdr->magic != 0x2341) { + printk("OTA: invalid sketch header (ver=0x%x magic=0x%x)\n", hdr->ver, hdr->magic); + fs_close(&file); + fs_unlink(OTA_SENTINEL_PATH); + return -1; + } + + size_t sketch_len = hdr->len; + printk("OTA: sketch length = %u bytes\n", (unsigned)sketch_len); + + /* Erase flash partition */ + printk("OTA: erasing flash partition (%u bytes)...\n", (unsigned)fa->fa_size); + rc = flash_area_erase(fa, 0, fa->fa_size); + if (rc) { + printk("OTA: flash erase failed, rc %d\n", rc); + fs_close(&file); + fs_unlink(OTA_SENTINEL_PATH); + return -1; + } + + /* Write sketch data from file to flash in chunks */ + fs_seek(&file, 0, FS_SEEK_SET); + uint8_t chunk[4096]; + off_t offset = 0; + size_t remaining = sketch_len; + ssize_t n; + while (remaining > 0 && (n = fs_read(&file, chunk, + remaining < sizeof(chunk) ? remaining : sizeof(chunk))) > 0) { + rc = flash_area_write(fa, offset, chunk, n); + if (rc) { + printk("OTA: flash write failed at offset %ld, rc %d\n", (long)offset, rc); + fs_close(&file); + fs_unlink(OTA_SENTINEL_PATH); + return -1; + } + offset += n; + remaining -= n; + } + fs_close(&file); + + printk("OTA: wrote %ld bytes to flash\n", (long)offset); + + /* Delete sentinel and update file */ + fs_unlink(OTA_SENTINEL_PATH); + fs_unlink(OTA_UPDATE_PATH); + + printk("OTA: update complete\n"); + return 0; +} +#endif /* CONFIG_FILE_SYSTEM */ + static int loader(const struct shell *sh) { const struct flash_area *fa; int rc; +#if CONFIG_SHELL && TARGET_HAS_USB_CDC + /* Enable USB early so printk output is visible during OTA */ + usb_enable(NULL); + int dtr = 0; + for (int i = 0; i < 50; i++) { /* wait up to 5s for serial */ + uart_line_ctrl_get(usb_dev, UART_LINE_CTRL_DTR, &dtr); + if (dtr) break; + k_sleep(K_MSEC(100)); + } + printk("\n=== Loader started ===\n"); +#endif + /* Test that attempting to open a disabled flash area fails */ rc = flash_area_open(FIXED_PARTITION_ID(user_sketch), &fa); if (rc) { @@ -121,6 +241,10 @@ static int loader(const struct shell *sh) { return rc; } +#if defined(CONFIG_FILE_SYSTEM) + try_ota_update(fa); +#endif + uintptr_t base_addr = DT_REG_ADDR(DT_GPARENT(DT_NODELABEL(user_sketch))) + DT_REG_ADDR(DT_NODELABEL(user_sketch)); @@ -266,6 +390,13 @@ static int loader(const struct shell *sh) { #endif #endif +#if TARGET_HAS_USB_CDC + if (debug) { + // Disable USB before jumping to sketch + usb_disable(); + } +#endif + extern struct k_heap llext_heap; typedef void (*entry_point_t)(struct k_heap *heap, size_t heap_size); entry_point_t entry_point = (entry_point_t)(base_addr + HEADER_LEN + 1); @@ -350,6 +481,13 @@ static int loader(const struct shell *sh) { k_thread_join(&llext_thread, K_FOREVER); #else +#if TARGET_HAS_USB_CDC + if (debug) { + // Disable USB before jumping to sketch + usb_disable(); + } +#endif + #ifdef CONFIG_LLEXT llext_bootstrap(ext, main_fn, NULL); #endif diff --git a/loader/matrix.inc b/loader/matrix.inc index 8cf2d888a..f530ac546 100644 --- a/loader/matrix.inc +++ b/loader/matrix.inc @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include #include #include diff --git a/loader/prj.conf b/loader/prj.conf index dc40e9533..72268bc6d 100644 --- a/loader/prj.conf +++ b/loader/prj.conf @@ -10,6 +10,7 @@ CONFIG_LOG_MODE_IMMEDIATE=y CONFIG_HEAP_MEM_POOL_SIZE=32768 CONFIG_MAIN_STACK_SIZE=32768 +CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 CONFIG_ARDUINO_API=y @@ -18,6 +19,7 @@ CONFIG_LLEXT_LOG_LEVEL_ERR=y CONFIG_LLEXT_HEAP_SIZE=32 CONFIG_LLEXT_STORAGE_WRITABLE=y CONFIG_LLEXT_EXPORT_DEVICES=y +CONFIG_LLEXT_RODATA_NO_RELOC=y CONFIG_LLEXT_EDK=y CONFIG_LLEXT_EDK_FORMAT_TAR_ZSTD=y @@ -41,3 +43,4 @@ CONFIG_CBPRINTF_FP_SUPPORT=y CONFIG_MAIN_THREAD_PRIORITY=14 CONFIG_EVENTS=y +CONFIG_REBOOT=y diff --git a/platform.txt b/platform.txt index 72bfe867d..ffdedd920 100644 --- a/platform.txt +++ b/platform.txt @@ -17,7 +17,7 @@ compiler.warning_flags.all=-Wall -Wextra compiler.path={build.compiler_path} compiler.c.cmd={build.crossprefix}gcc -compiler.c.flags=-g -c {compiler.define} {compiler.warning_flags} {compiler.zephyr.macros} "@{compiler.zephyr.cflags_file}" -MMD -mcpu={build.mcu} {build.float-abi} {build.fpu} +compiler.c.flags=-g -Os -c {compiler.define} {compiler.warning_flags} {compiler.zephyr.macros} "@{compiler.zephyr.cflags_file}" -fdata-sections -ffunction-sections -MMD -mcpu={build.mcu} {build.float-abi} {build.fpu} compiler.c.elf.cmd={build.crossprefix}g++ compiler.c.elf.flags=-Wl,--gc-sections -mcpu={build.mcu} {build.float-abi} {build.fpu} -std=gnu++17 compiler.S.cmd={build.crossprefix}g++ @@ -53,13 +53,14 @@ build.link_mode=dynamic build.boot_mode=wait upload.extension=elf-zsk.bin +build.ota.pack_command= +build.ota.pack_command_legacy= build.ldscript.path={runtime.platform.path}/variants/_ldscripts 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} --specs=nano.specs --specs=nosys.specs {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}} build.check_command-dynamic={build.link_command} {build.link_args.check-dynamic} -o "{build.path}/{build.project_name}_check.tmp" build.check_command-static=true build.check_command-static.windows=cmd /C cd . -build.combine_command={build.link_command} {build.link_args.build-{build.link_mode}} {build.link_args.build-common} # link_args.* are included by any link_command depending on the link_mode build.link_args.dynamic=-e main @@ -119,10 +120,15 @@ recipe.S.o.pattern="{compiler.path}{compiler.S.cmd}" {compiler.S.flags} -DARDUIN ## Create archives recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}" -## Combine gc-sections, archives, and objects +## Combine gc-sections, archives, and objects - Multi-pass linking recipe.c.combine.1.pattern={build.check_command-{build.link_mode}} -recipe.c.combine.2.pattern={build.combine_command} -recipe.c.combine.pattern={build.combine_command} +recipe.c.combine.2.pattern={build.link_command} {build.link_args.build-{build.link_mode}} "-Wl,-Map,{build.path}/{build.project_name}_temp.map" -o "{build.path}/{build.project_name}_temp.elf" +recipe.c.combine.3.pattern="{runtime.tools.gen-rodata-ld.path}/gen-rodata-ld" "{build.path}/{build.project_name}_temp.elf" "{build.path}/rodata_split.ld" "{build.link_mode}" +recipe.c.combine.4.pattern={build.link_command} "-T{build.path}/rodata_split.ld" {build.link_args.build-{build.link_mode}} {build.link_args.build-common} + +## Combine gc-sections, archives, and objects - Single-pass linking (older IDEs) +recipe.c.combine.pattern={build.link_command} {build.link_args.build-{build.link_mode}} -T{build.ldscript.path}/build-rodata.ld {build.link_args.build-common} + recipe.hooks.linking.postlink.1.pattern="{compiler.path}{build.crossprefix}strip" --strip-debug "{build.path}/{build.project_name}_debug.elf" -o "{build.path}/{build.project_name}.elf" ## Create eeprom @@ -137,6 +143,8 @@ recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf ## Mangle the file recipe.hooks.objcopy.postobjcopy.1.pattern="{runtime.tools.zephyr-sketch-tool.path}/zephyr-sketch-tool" {build.zsk_args.debug} {build.zsk_args.mode-{build.link_mode}} {build.zsk_args.startup-mode-{build.boot_mode}} "{build.path}/{build.project_name}.elf" recipe.hooks.objcopy.postobjcopy.2.pattern="{runtime.tools.zephyr-sketch-tool.path}/zephyr-sketch-tool" {build.zsk_args.debug} {build.zsk_args.mode-{build.link_mode}} {build.zsk_args.startup-mode-{build.boot_mode}} "{build.path}/{build.project_name}.bin" +recipe.hooks.objcopy.postobjcopy.3.pattern={build.ota.pack_command} +recipe.hooks.objcopy.postobjcopy.4.pattern={build.ota.pack_command_legacy} ## Compute size recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf" diff --git a/variants/_ldscripts/build-dynamic.ld b/variants/_ldscripts/build-dynamic.ld index 9b72a544c..45b4388dc 100644 --- a/variants/_ldscripts/build-dynamic.ld +++ b/variants/_ldscripts/build-dynamic.ld @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + FORCE_GROUP_ALLOCATION SECTIONS { @@ -41,12 +47,6 @@ SECTIONS { __static_thread_data_list_end = .; } - .rodata : { - *(.rodata) - *(.rodata1) - *(.rodata.*) - } - .data : { *(.data .data.*) } @@ -81,10 +81,6 @@ SECTIONS { KEEP(*(.shstrtab)) } - .rel : { - KEEP(*(.rel .rel.*)) - } - .got : { KEEP(*(.got .got.* .got.plt .got.plt*)) } diff --git a/variants/_ldscripts/build-rodata.ld b/variants/_ldscripts/build-rodata.ld new file mode 100644 index 000000000..143036ff3 --- /dev/null +++ b/variants/_ldscripts/build-rodata.ld @@ -0,0 +1,20 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * SPDX-License-Identifier: Apache-2.0 + */ + +/* This file is included only when the core is used with old IDE/CLI tools that + * do not support multi-step linking, and ensures all .rodata and .rel sections + * are merged into one. Newer tools should run 'gen_rodata_ld' and use its + * output for optimal memory use. + */ + +SECTIONS { + .rodata : { + *(.rodata .rodata.*) + } + + .rel : { + *(.rel .rel.*) + } +} diff --git a/variants/_ldscripts/build-static.ld b/variants/_ldscripts/build-static.ld index 3ed10654c..679685efc 100644 --- a/variants/_ldscripts/build-static.ld +++ b/variants/_ldscripts/build-static.ld @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + ENTRY(entry_point) SECTIONS { /DISCARD/ : { diff --git a/variants/_ldscripts/memory-check.ld b/variants/_ldscripts/memory-check.ld index fd09c59fd..47fc8d679 100644 --- a/variants/_ldscripts/memory-check.ld +++ b/variants/_ldscripts/memory-check.ld @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + MEMORY { FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x10000000 diff --git a/variants/_ldscripts/memory-static.ld b/variants/_ldscripts/memory-static.ld index fce3d398d..85a3c48fe 100644 --- a/variants/_ldscripts/memory-static.ld +++ b/variants/_ldscripts/memory-static.ld @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + MEMORY { /* 16 below compensates for the zsk header that is added before the .bin */ diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf index e291cfe53..c02c892b9 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf +++ b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.conf @@ -1,21 +1,33 @@ -CONFIG_USB_DEVICE_STACK=y +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_USB_DEVICE_STACK_NEXT=y CONFIG_USB_DEVICE_PRODUCT="Arduino GIGA R1" CONFIG_USB_DEVICE_MANUFACTURER="Arduino" CONFIG_USB_DEVICE_VID=0x2341 CONFIG_USB_DEVICE_PID=0x0066 CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n -CONFIG_USB_CDC_ACM=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 -CONFIG_UART_LINE_CTRL=y +CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=n +CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING="Arduino GIGA R1" +CONFIG_CDC_ACM_SERIAL_MANUFACTURER_STRING="Arduino" CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y +CONFIG_USBD_CDC_ACM_CLASS=y +CONFIG_UART_LINE_CTRL=y +#CONFIG_USBD_CDC_ACM_BUF_POOL=y +#CONFIG_USBD_CDC_ACM_WORKQUEUE=y +#CONFIG_USBD_MSG_DEFERRED_MODE=y +#CONFIG_USBD_MSG_WORK_DELAY=10 +#CONFIG_UDC_WORKQUEUE=y +CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y +CONFIG_UDC_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USBD_LOG_LEVEL_ERR=y CONFIG_LLEXT_STORAGE_WRITABLE=n CONFIG_SHARED_MULTI_HEAP=y CONFIG_HEAP_MEM_POOL_SIZE=32768 CONFIG_MAIN_STACK_SIZE=32768 CONFIG_LLEXT_HEAP_SIZE=128 -CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 CONFIG_CODE_DATA_RELOCATION=y CONFIG_MAIN_STACK_REGION="DTCM" @@ -55,7 +67,6 @@ CONFIG_MBEDTLS_CMAC=y CONFIG_VIDEO=y CONFIG_VIDEO_STM32_DCMI=y CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=3 -CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=614400 CONFIG_VIDEO_BUFFER_POOL_ALIGN=32 CONFIG_VIDEO_BUFFER_USE_SHARED_MULTI_HEAP=y CONFIG_VIDEO_BUFFER_SMH_ATTRIBUTE=2 @@ -102,6 +113,7 @@ CONFIG_FS_FATFS_MIN_SS=4096 CONFIG_FS_FATFS_MAX_SS=4096 CONFIG_FS_FATFS_MAX_LFN=255 CONFIG_FS_FATFS_FSTAB_AUTOMOUNT=y +CONFIG_FS_FATFS_CUSTOM_MOUNT_POINT_COUNT=2 CONFIG_FS_FATFS_CUSTOM_MOUNT_POINTS="wlan,ota" CONFIG_SDHC=y @@ -123,7 +135,10 @@ CONFIG_NET_MGMT_EVENT_QUEUE_SIZE=32 CONFIG_NET_MAX_CONN=10 CONFIG_NET_MGMT_EVENT_STACK_SIZE=4608 -CONFIG_POSIX_API=y +CONFIG_POSIX_NETWORKING=y +CONFIG_POSIX_SYSTEM_INTERFACES=y +CONFIG_POSIX_FD_MGMT=y +CONFIG_POSIX_DEVICE_IO=y CONFIG_NET_TCP=y CONFIG_NET_SOCKETS=y diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay index 109a4ed32..8d901576c 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay +++ b/variants/arduino_giga_r1_stm32h747xx_m7/arduino_giga_r1_stm32h747xx_m7.overlay @@ -1,7 +1,13 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + &zephyr_udc0 { board_cdc_acm_uart: board_cdc_acm_uart { compatible = "zephyr,cdc-acm-uart"; - status = "okay"; + status = "okay"; }; }; @@ -321,7 +327,7 @@ chosen { zephyr,camera = &dcmi; zephyr,log-uart = &log_uarts; - /* zephyr,console = &board_cdc_acm_uart; */ + zephyr,console = &usart1; }; log_uarts: log_uarts { @@ -330,7 +336,7 @@ }; /* used to overcome problems with _C analog pins */ - gpioz: gpio@deadbeef { + gpiozz: gpio@deadbeef { compatible = "vnd,gpio"; gpio-controller; reg = <0xdeadbeef 0x1000>; @@ -343,6 +349,7 @@ /delete-node/ &slot0_partition; &flash0 { + bank2-flash-size = <1024>; partitions { slot0_partition: partition@40000 { label = "image-0"; @@ -464,10 +471,10 @@ <&gpiob 6 0>, /* SDA1 */ <&gpioh 12 0>, - <&gpioz 0 0>, /* analog only A8 */ - <&gpioz 1 0>, /* analog only A9 */ - <&gpioz 2 0>, /* analog only A10 */ - <&gpioz 3 0>; /* analog only A11 */ + <&gpiozz 0 0>, /* analog only A8 */ + <&gpiozz 1 0>, /* analog only A9 */ + <&gpiozz 2 0>, /* analog only A10 */ + <&gpiozz 3 0>; /* analog only A11 */ builtin-led-gpios = <&gpioj 13 GPIO_ACTIVE_LOW>, <&gpioi 12 GPIO_ACTIVE_LOW>, @@ -496,10 +503,10 @@ <&gpioc 2 0>, <&gpioc 0 0>, /* A6 */ <&gpioa 0 0>, - <&gpioz 0 0>, /* analog only */ - <&gpioz 1 0>, /* analog only */ - <&gpioz 2 0>, /* analog only */ - <&gpioz 3 0>, /* analog only */ + <&gpiozz 0 0>, /* analog only */ + <&gpiozz 1 0>, /* analog only */ + <&gpiozz 2 0>, /* analog only */ + <&gpiozz 3 0>, /* analog only */ <&gpioa 4 0>, <&gpioa 5 0>; diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/known_example_issues.txt b/variants/arduino_giga_r1_stm32h747xx_m7/known_example_issues.txt index f701f61f5..fad738288 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/known_example_issues.txt +++ b/variants/arduino_giga_r1_stm32h747xx_m7/known_example_issues.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/pure_analog_pins.cpp b/variants/arduino_giga_r1_stm32h747xx_m7/pure_analog_pins.cpp index 3309ecfba..92fc3a856 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/pure_analog_pins.cpp +++ b/variants/arduino_giga_r1_stm32h747xx_m7/pure_analog_pins.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include "pure_analog_pins.h" #undef A8 diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/pure_analog_pins.h b/variants/arduino_giga_r1_stm32h747xx_m7/pure_analog_pins.h index dba5299dd..02ccecf6d 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/pure_analog_pins.h +++ b/variants/arduino_giga_r1_stm32h747xx_m7/pure_analog_pins.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #ifndef _PURE_ANALOG_PINS_ #define _PURE_ANALOG_PINS_ #ifdef __cplusplus diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/skip_these_examples.txt b/variants/arduino_giga_r1_stm32h747xx_m7/skip_these_examples.txt index 00663e427..1dad82474 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/skip_these_examples.txt +++ b/variants/arduino_giga_r1_stm32h747xx_m7/skip_these_examples.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_giga_r1_stm32h747xx_m7/variant.cpp b/variants/arduino_giga_r1_stm32h747xx_m7/variant.cpp index 786c9712f..e917bfb5e 100644 --- a/variants/arduino_giga_r1_stm32h747xx_m7/variant.cpp +++ b/variants/arduino_giga_r1_stm32h747xx_m7/variant.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include void _on_1200_bps() { diff --git a/variants/arduino_nano_33_ble/arduino_nano_33_ble.overlay b/variants/arduino_nano_33_ble/arduino_nano_33_ble.overlay index 6c8f9754d..441db7345 100644 --- a/variants/arduino_nano_33_ble/arduino_nano_33_ble.overlay +++ b/variants/arduino_nano_33_ble/arduino_nano_33_ble.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + / { zephyr,user { digital-pin-gpios = <&arduino_nano_header 0 0>, diff --git a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf index ea265a899..8bb3037bb 100644 --- a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf +++ b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.conf @@ -1,3 +1,6 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + CONFIG_BT=y CONFIG_BT_HCI_RAW=y CONFIG_BT_HCI_RAW_H4=y @@ -12,16 +15,21 @@ CONFIG_BT_RX_STACK_SIZE=4096 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 -CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_DEVICE_STACK_NEXT=y CONFIG_USB_DEVICE_PRODUCT="Arduino Nano 33 BLE" CONFIG_USB_DEVICE_MANUFACTURER="Arduino" CONFIG_USB_DEVICE_VID=0x2341 CONFIG_USB_DEVICE_PID=0x035A -CONFIG_USB_CDC_ACM=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 -CONFIG_UART_LINE_CTRL=y +CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=n +CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING="Arduino Nano 33 BLE" +CONFIG_CDC_ACM_SERIAL_MANUFACTURER_STRING="Arduino" +CONFIG_USBD_CDC_ACM_CLASS=y CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y +CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y +CONFIG_UDC_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USBD_LOG_LEVEL_ERR=y +CONFIG_UART_LINE_CTRL=y CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_BACKEND_UART_AUTOSTART=n @@ -34,7 +42,6 @@ CONFIG_LLEXT_STORAGE_WRITABLE=n CONFIG_HEAP_MEM_POOL_SIZE=16384 CONFIG_LLEXT_HEAP_SIZE=128 CONFIG_MAIN_STACK_SIZE=16384 -CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 CONFIG_FPU=y diff --git a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.overlay b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.overlay index beb714835..fc2b629fa 100644 --- a/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.overlay +++ b/variants/arduino_nano_33_ble_nrf52840_sense/arduino_nano_33_ble_nrf52840_sense.overlay @@ -1,7 +1,13 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + &zephyr_udc0 { board_cdc_acm_uart: board_cdc_acm_uart { compatible = "zephyr,cdc-acm-uart"; - status = "okay"; + status = "okay"; }; }; diff --git a/variants/arduino_nano_33_ble_nrf52840_sense/known_example_issues.txt b/variants/arduino_nano_33_ble_nrf52840_sense/known_example_issues.txt index f701f61f5..fad738288 100644 --- a/variants/arduino_nano_33_ble_nrf52840_sense/known_example_issues.txt +++ b/variants/arduino_nano_33_ble_nrf52840_sense/known_example_issues.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_nano_33_ble_nrf52840_sense/skip_these_examples.txt b/variants/arduino_nano_33_ble_nrf52840_sense/skip_these_examples.txt index 579c0f4c5..f361030df 100644 --- a/variants/arduino_nano_33_ble_nrf52840_sense/skip_these_examples.txt +++ b/variants/arduino_nano_33_ble_nrf52840_sense/skip_these_examples.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_nano_33_ble_nrf52840_sense/variant.cpp b/variants/arduino_nano_33_ble_nrf52840_sense/variant.cpp index a1e6cab0d..02b2e1a30 100644 --- a/variants/arduino_nano_33_ble_nrf52840_sense/variant.cpp +++ b/variants/arduino_nano_33_ble_nrf52840_sense/variant.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include "Arduino.h" #include #include diff --git a/variants/arduino_nano_33_iot/arduino_nano_33_iot.overlay b/variants/arduino_nano_33_iot/arduino_nano_33_iot.overlay index d99109799..b14b1fee9 100644 --- a/variants/arduino_nano_33_iot/arduino_nano_33_iot.overlay +++ b/variants/arduino_nano_33_iot/arduino_nano_33_iot.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include / { diff --git a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf index 0abcbeddb..6cf91d986 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf +++ b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.conf @@ -1,8 +1,10 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + CONFIG_MAIN_STACK_SIZE=16000 CONFIG_HEAP_MEM_POOL_SIZE=112000 CONFIG_LLEXT_HEAP_SIZE=64 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 -CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 CONFIG_FPU=y CONFIG_I2C=y diff --git a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay index 59136b0fa..191266f97 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay +++ b/variants/arduino_nano_matter_mgm240sd22vna/arduino_nano_matter_mgm240sd22vna.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + /* Arduino user sketch partition */ user_sketch: &slot1_partition {}; diff --git a/variants/arduino_nano_matter_mgm240sd22vna/known_example_issues.txt b/variants/arduino_nano_matter_mgm240sd22vna/known_example_issues.txt index 5a2b266f1..44080cabd 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/known_example_issues.txt +++ b/variants/arduino_nano_matter_mgm240sd22vna/known_example_issues.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_nano_matter_mgm240sd22vna/skip_these_examples.txt b/variants/arduino_nano_matter_mgm240sd22vna/skip_these_examples.txt index c5875aa35..f511a48d2 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/skip_these_examples.txt +++ b/variants/arduino_nano_matter_mgm240sd22vna/skip_these_examples.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_nano_matter_mgm240sd22vna/variant.h b/variants/arduino_nano_matter_mgm240sd22vna/variant.h index 473b0108f..d4dade0ef 100644 --- a/variants/arduino_nano_matter_mgm240sd22vna/variant.h +++ b/variants/arduino_nano_matter_mgm240sd22vna/variant.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #pragma once #define MOSI 11 diff --git a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf index 666eaec57..ff9bebbad 100644 --- a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf +++ b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.conf @@ -1,3 +1,6 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + CONFIG_BT=y CONFIG_BT_HCI_RAW=y @@ -25,4 +28,3 @@ CONFIG_LLEXT_STORAGE_WRITABLE=n CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_LLEXT_HEAP_SIZE=15 CONFIG_MAIN_STACK_SIZE=2048 -CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 diff --git a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.overlay b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.overlay index 6686c5075..a7cd5aad9 100644 --- a/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.overlay +++ b/variants/arduino_nicla_sense_me_nrf52832/arduino_nicla_sense_me_nrf52832.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + /delete-node/ &slot0_partition; /delete-node/ &slot1_partition; /delete-node/ &scratch_partition; diff --git a/variants/arduino_nicla_sense_me_nrf52832/known_example_issues.txt b/variants/arduino_nicla_sense_me_nrf52832/known_example_issues.txt index f701f61f5..fad738288 100644 --- a/variants/arduino_nicla_sense_me_nrf52832/known_example_issues.txt +++ b/variants/arduino_nicla_sense_me_nrf52832/known_example_issues.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_nicla_sense_me_nrf52832/skip_these_examples.txt b/variants/arduino_nicla_sense_me_nrf52832/skip_these_examples.txt index c5875aa35..f511a48d2 100644 --- a/variants/arduino_nicla_sense_me_nrf52832/skip_these_examples.txt +++ b/variants/arduino_nicla_sense_me_nrf52832/skip_these_examples.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_nicla_sense_me_nrf52832/variant.h b/variants/arduino_nicla_sense_me_nrf52832/variant.h index e69de29bb..d7250a760 100644 --- a/variants/arduino_nicla_sense_me_nrf52832/variant.h +++ b/variants/arduino_nicla_sense_me_nrf52832/variant.h @@ -0,0 +1,7 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once diff --git a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf index 0f28cc3de..a644ef546 100644 --- a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf +++ b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.conf @@ -1,20 +1,27 @@ -CONFIG_USB_DEVICE_STACK=y +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_USB_DEVICE_STACK_NEXT=y CONFIG_USB_DEVICE_PRODUCT="Arduino Opta" CONFIG_USB_DEVICE_MANUFACTURER="Arduino" CONFIG_USB_DEVICE_VID=0x2341 CONFIG_USB_DEVICE_PID=0x0064 -CONFIG_USB_CDC_ACM=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 -CONFIG_UART_LINE_CTRL=y +CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=n +CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING="Arduino Opta" +CONFIG_CDC_ACM_SERIAL_MANUFACTURER_STRING="Arduino" +CONFIG_USBD_CDC_ACM_CLASS=y CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y +CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y +CONFIG_UDC_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USBD_LOG_LEVEL_ERR=y +CONFIG_UART_LINE_CTRL=y CONFIG_LLEXT_STORAGE_WRITABLE=n CONFIG_HEAP_MEM_POOL_SIZE=32768 CONFIG_MAIN_STACK_SIZE=32768 CONFIG_LLEXT_HEAP_SIZE=128 -CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 CONFIG_CODE_DATA_RELOCATION=y CONFIG_MAIN_STACK_REGION="DTCM" @@ -82,7 +89,31 @@ CONFIG_NET_TCP_WORKQ_STACK_SIZE=8192 CONFIG_NET_MGMT_EVENT_STACK_SIZE=8192 CONFIG_NET_TCP=y CONFIG_NET_SOCKETS=y -CONFIG_POSIX_API=y +CONFIG_POSIX_NETWORKING=y +CONFIG_POSIX_SYSTEM_INTERFACES=y +CONFIG_POSIX_FD_MGMT=y +CONFIG_POSIX_DEVICE_IO=y +CONFIG_FILE_SYSTEM=y +CONFIG_FILE_SYSTEM_MKFS=y +CONFIG_DISK_ACCESS=y +CONFIG_DISK_DRIVER_FLASH=y + +CONFIG_FILE_SYSTEM_LITTLEFS=y +CONFIG_FS_LITTLEFS_PROG_SIZE=4096 +CONFIG_FS_LITTLEFS_CACHE_SIZE=4096 + +CONFIG_FAT_FILESYSTEM_ELM=y +CONFIG_FS_FATFS_EXFAT=n +CONFIG_FS_FATFS_MKFS=y +CONFIG_FS_FATFS_LFN=y +CONFIG_FS_FATFS_LFN_MODE_HEAP=y +CONFIG_FS_FATFS_CODEPAGE=437 +CONFIG_FS_FATFS_MIN_SS=4096 +CONFIG_FS_FATFS_MAX_SS=4096 +CONFIG_FS_FATFS_MAX_LFN=255 +CONFIG_FS_FATFS_FSTAB_AUTOMOUNT=y +CONFIG_FS_FATFS_CUSTOM_MOUNT_POINT_COUNT=2 +CONFIG_FS_FATFS_CUSTOM_MOUNT_POINTS="wlan,ota" CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y diff --git a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.overlay b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.overlay index 2b8cef4cf..e856c7cb5 100644 --- a/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.overlay +++ b/variants/arduino_opta_stm32h747xx_m7/arduino_opta_stm32h747xx_m7.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + &usart6 { status = "okay"; pinctrl-0 = <&usart6_tx_pg14 &usart6_rx_pg9>; @@ -49,7 +55,7 @@ }; /* used to overcome problems with _C analog pins */ - gpioz: gpio@deadbeef { + gpiozz: gpio@deadbeef { compatible = "vnd,gpio"; gpio-controller; reg = <0xdeadbeef 0x1000>; @@ -59,6 +65,7 @@ }; &flash0 { + bank2-flash-size = <1024>; partitions { user_sketch: partition@e0000 { reg = <0x0E0000 0x20000>; @@ -80,8 +87,8 @@ <&gpioh 11 0>, <&gpioe 5 0>, <&gpioe 4 0>, /* User button */ - <&gpioz 0 0>, /* Inputs */ - <&gpioz 1 0>, + <&gpiozz 0 0>, /* Inputs */ + <&gpiozz 1 0>, <&gpiof 12 0>, <&gpiob 0 0>, <&gpiof 10 0>, @@ -97,8 +104,8 @@ <&gpioh 12 0>, <&gpioe 5 0>; - adc-pin-gpios = <&gpioz 0 0>, - <&gpioz 1 0>, + adc-pin-gpios = <&gpiozz 0 0>, + <&gpiozz 1 0>, <&gpiof 12 0>, <&gpiob 0 0>, <&gpiof 10 0>, diff --git a/variants/arduino_opta_stm32h747xx_m7/known_example_issues.txt b/variants/arduino_opta_stm32h747xx_m7/known_example_issues.txt index d3955fcc8..a0fa8a4bf 100644 --- a/variants/arduino_opta_stm32h747xx_m7/known_example_issues.txt +++ b/variants/arduino_opta_stm32h747xx_m7/known_example_issues.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used @@ -9,7 +9,4 @@ # against the path of each sketch found in this repo. If a match is found, the # sketch compilation result will be ignored. -# bug at core link time -libraries/Ethernet/examples/UDPSendReceiveString -libraries/Ethernet/examples/UdpNtpClient libraries/Storage/examples/FlashFormat diff --git a/variants/arduino_opta_stm32h747xx_m7/skip_these_examples.txt b/variants/arduino_opta_stm32h747xx_m7/skip_these_examples.txt index 363ba80ce..809dcf12e 100644 --- a/variants/arduino_opta_stm32h747xx_m7/skip_these_examples.txt +++ b/variants/arduino_opta_stm32h747xx_m7/skip_these_examples.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_opta_stm32h747xx_m7/variant.cpp b/variants/arduino_opta_stm32h747xx_m7/variant.cpp index 786c9712f..e917bfb5e 100644 --- a/variants/arduino_opta_stm32h747xx_m7/variant.cpp +++ b/variants/arduino_opta_stm32h747xx_m7/variant.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include void _on_1200_bps() { diff --git a/variants/arduino_opta_stm32h747xx_m7/variant.h b/variants/arduino_opta_stm32h747xx_m7/variant.h index e69de29bb..d7250a760 100644 --- a/variants/arduino_opta_stm32h747xx_m7/variant.h +++ b/variants/arduino_opta_stm32h747xx_m7/variant.h @@ -0,0 +1,7 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once diff --git a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf index 397671251..f94e327c8 100644 --- a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf +++ b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.conf @@ -1,3 +1,6 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + CONFIG_USB_DEVICE_STACK_NEXT=y CONFIG_USB_DEVICE_PRODUCT="Arduino Portenta C33" CONFIG_USB_DEVICE_MANUFACTURER="Arduino" @@ -9,7 +12,13 @@ CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n CONFIG_SERIAL=y CONFIG_UART_LINE_CTRL=y +CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=n +CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING="Arduino Portenta C33" +CONFIG_CDC_ACM_SERIAL_MANUFACTURER_STRING="Arduino" CONFIG_USBD_CDC_ACM_CLASS=y +#CONFIG_USBD_CDC_ACM_BUF_POOL=y +#CONFIG_USBD_CDC_ACM_WORKQUEUE=y +#CONFIG_UDC_WORKQUEUE=y CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y CONFIG_UDC_DRIVER_LOG_LEVEL_ERR=y CONFIG_USBD_LOG_LEVEL_ERR=y @@ -65,7 +74,10 @@ CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=8192 CONFIG_NET_TCP=y CONFIG_NET_SOCKETS=y -CONFIG_POSIX_API=y +CONFIG_POSIX_NETWORKING=y +CONFIG_POSIX_SYSTEM_INTERFACES=y +CONFIG_POSIX_FD_MGMT=y +CONFIG_POSIX_DEVICE_IO=y CONFIG_MBEDTLS=y CONFIG_MBEDTLS_BUILTIN=y @@ -115,4 +127,5 @@ CONFIG_FS_FATFS_MIN_SS=4096 CONFIG_FS_FATFS_MAX_SS=4096 CONFIG_FS_FATFS_MAX_LFN=255 CONFIG_FS_FATFS_FSTAB_AUTOMOUNT=y +CONFIG_FS_FATFS_CUSTOM_MOUNT_POINT_COUNT=2 CONFIG_FS_FATFS_CUSTOM_MOUNT_POINTS="wlan,ota" diff --git a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay index 262463420..00ee6d3a1 100644 --- a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay +++ b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/arduino_portenta_c33_r7fa6m5bh3cfc.overlay @@ -1,7 +1,13 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + &zephyr_udc0 { board_cdc_acm_uart: board_cdc_acm_uart { compatible = "zephyr,cdc-acm-uart"; - status = "okay"; + status = "okay"; }; }; @@ -18,13 +24,15 @@ &flash0 { partitions { + /delete-node/ partition@10000; + mcuboot: partition@0 { label = "mcuboot"; reg = <0x00000000 DT_SIZE_K(64)>; }; code_partition: partition@10000 { label = "image-0"; - reg = <0x00010000 (DT_SIZE_M(1) - DT_SIZE_K(64))>; + reg = <0x00010000 DT_SIZE_K(960)>; }; user_sketch: partition@100000 { label = "user_sketch"; diff --git a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/known_example_issues.txt b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/known_example_issues.txt index b512e2d4c..ebf118043 100644 --- a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/known_example_issues.txt +++ b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/known_example_issues.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used @@ -11,7 +11,3 @@ # needs porting the SE05X library from mbed libraries/Arduino_SecureElement/ - -# bug at core link time -libraries/Ethernet/examples/UDPSendReceiveString -libraries/Ethernet/examples/UdpNtpClient diff --git a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/skip_these_examples.txt b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/skip_these_examples.txt index 65c3dae24..037a05b9d 100644 --- a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/skip_these_examples.txt +++ b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/skip_these_examples.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/variant.cpp b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/variant.cpp index 44f483710..e4e061287 100644 --- a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/variant.cpp +++ b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/variant.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include #define BSP_PRV_PRCR_KEY (0xA500U) diff --git a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/variant.h b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/variant.h index e69de29bb..d7250a760 100644 --- a/variants/arduino_portenta_c33_r7fa6m5bh3cfc/variant.h +++ b/variants/arduino_portenta_c33_r7fa6m5bh3cfc/variant.h @@ -0,0 +1,7 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#pragma once diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf index f657c10ed..2f055e6e2 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.conf @@ -1,19 +1,26 @@ -CONFIG_USB_DEVICE_STACK=y +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_USB_DEVICE_STACK_NEXT=y CONFIG_USB_DEVICE_PRODUCT="Arduino Portenta H7" CONFIG_USB_DEVICE_MANUFACTURER="Arduino" CONFIG_USB_DEVICE_VID=0x2341 CONFIG_USB_DEVICE_PID=0x005b CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n -CONFIG_USB_CDC_ACM=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 -CONFIG_UART_LINE_CTRL=y +CONFIG_CDC_ACM_SERIAL_INITIALIZE_AT_BOOT=n +CONFIG_CDC_ACM_SERIAL_PRODUCT_STRING="Arduino Portenta H7" +CONFIG_CDC_ACM_SERIAL_MANUFACTURER_STRING="Arduino" +CONFIG_USBD_CDC_ACM_CLASS=y CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y +CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y +CONFIG_UDC_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USBD_LOG_LEVEL_ERR=y +CONFIG_UART_LINE_CTRL=y CONFIG_LLEXT_STORAGE_WRITABLE=n CONFIG_SHARED_MULTI_HEAP=y CONFIG_HEAP_MEM_POOL_SIZE=32768 -CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_BACKEND_UART_AUTOSTART=n @@ -76,7 +83,31 @@ CONFIG_NET_TCP_WORKQ_STACK_SIZE=8192 CONFIG_NET_MGMT_EVENT_STACK_SIZE=8192 CONFIG_NET_TCP=y CONFIG_NET_SOCKETS=y -CONFIG_POSIX_API=y +CONFIG_POSIX_NETWORKING=y +CONFIG_POSIX_SYSTEM_INTERFACES=y +CONFIG_POSIX_FD_MGMT=y +CONFIG_POSIX_DEVICE_IO=y +CONFIG_FILE_SYSTEM=y +CONFIG_FILE_SYSTEM_MKFS=y +CONFIG_DISK_ACCESS=y +CONFIG_DISK_DRIVER_FLASH=y + +CONFIG_FILE_SYSTEM_LITTLEFS=y +CONFIG_FS_LITTLEFS_PROG_SIZE=4096 +CONFIG_FS_LITTLEFS_CACHE_SIZE=4096 + +CONFIG_FAT_FILESYSTEM_ELM=y +CONFIG_FS_FATFS_EXFAT=n +CONFIG_FS_FATFS_MKFS=y +CONFIG_FS_FATFS_LFN=y +CONFIG_FS_FATFS_LFN_MODE_HEAP=y +CONFIG_FS_FATFS_CODEPAGE=437 +CONFIG_FS_FATFS_MIN_SS=4096 +CONFIG_FS_FATFS_MAX_SS=4096 +CONFIG_FS_FATFS_MAX_LFN=255 +CONFIG_FS_FATFS_FSTAB_AUTOMOUNT=y +CONFIG_FS_FATFS_CUSTOM_MOUNT_POINT_COUNT=2 +CONFIG_FS_FATFS_CUSTOM_MOUNT_POINTS="wlan,ota" CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y @@ -93,7 +124,6 @@ CONFIG_MBEDTLS_CMAC=y CONFIG_VIDEO=y CONFIG_VIDEO_STM32_DCMI=y CONFIG_VIDEO_BUFFER_POOL_NUM_MAX=3 -CONFIG_VIDEO_BUFFER_POOL_SZ_MAX=614400 CONFIG_VIDEO_BUFFER_POOL_ALIGN=32 CONFIG_VIDEO_BUFFER_USE_SHARED_MULTI_HEAP=y CONFIG_VIDEO_BUFFER_SMH_ATTRIBUTE=2 diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay index 75782c44f..f84ecbdd9 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/arduino_portenta_h7_stm32h747xx_m7.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + &board_cdc_acm_uart { status = "okay"; }; @@ -257,7 +263,7 @@ }; /* used to overcome problems with _C analog pins */ - gpioz: gpio@deadbeef { + gpiozz: gpio@deadbeef { compatible = "vnd,gpio"; gpio-controller; reg = <0xdeadbeef 0x1000>; @@ -276,6 +282,7 @@ erase-block-size = ; /* maximum erase time for a 128K sector */ max-erase-time = <4000>; + bank2-flash-size = <1024>; reg = <0x08000000 DT_SIZE_K(1024)>; status = "okay"; @@ -328,12 +335,12 @@ qspi_flash: &mx25l12833f {}; <&gpioa 10 0>, /* D13 */ <&gpioa 9 0>, /* D14 */ - <&gpioz 0 0>, /* A0 ADC2_INP0 */ - <&gpioz 1 0>, /* A1 ADC2_INP1 */ - <&gpioz 2 0>, /* A2 ADC3_INP0 */ - <&gpioz 3 0>, /* A3 ADC3_INP1 */ - <&gpioz 4 0>, /* A4 hack for duplicate PC_2 */ - <&gpioz 5 0>, /* A5 hack for duplicate PC_3 */ + <&gpiozz 0 0>, /* A0 ADC2_INP0 */ + <&gpiozz 1 0>, /* A1 ADC2_INP1 */ + <&gpiozz 2 0>, /* A2 ADC3_INP0 */ + <&gpiozz 3 0>, /* A3 ADC3_INP1 */ + <&gpiozz 4 0>, /* A4 hack for duplicate PC_2 */ + <&gpiozz 5 0>, /* A5 hack for duplicate PC_3 */ /* <&gpioc 2 0>, A4 _ALT0? ADC1_INP12 */ /* <&gpioc 3 0>, A5 _ALT0? ADC1_INP13 */ <&gpioa 4 0>, /* A6 ADC1_INP18 */ @@ -359,16 +366,16 @@ qspi_flash: &mx25l12833f {}; <&gpioj 10 0>, <&gpioh 6 0>; - adc-pin-gpios = <&gpioz 0 0>, /* analog only */ - <&gpioz 1 0>, /* analog only */ - <&gpioz 2 0>, /* analog only */ - <&gpioz 3 0>, /* analog only */ + adc-pin-gpios = <&gpiozz 0 0>, /* analog only */ + <&gpiozz 1 0>, /* analog only */ + <&gpiozz 2 0>, /* analog only */ + <&gpiozz 3 0>, /* analog only */ <&gpioc 2 0>, <&gpioc 3 0>, <&gpioa 4 0>, <&gpioa 6 0>, - <&gpioz 4 0>, /* Hack for D19 */ - <&gpioz 5 0>; /* Hack for D20 */ + <&gpiozz 4 0>, /* Hack for D19 */ + <&gpiozz 5 0>; /* Hack for D20 */ serials = <&board_cdc_acm_uart>,<&usart6>, <&usart1>, <&uart4>; cdc-acm = <&board_cdc_acm_uart>; diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/known_example_issues.txt b/variants/arduino_portenta_h7_stm32h747xx_m7/known_example_issues.txt index d3955fcc8..a0fa8a4bf 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/known_example_issues.txt +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/known_example_issues.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used @@ -9,7 +9,4 @@ # against the path of each sketch found in this repo. If a match is found, the # sketch compilation result will be ignored. -# bug at core link time -libraries/Ethernet/examples/UDPSendReceiveString -libraries/Ethernet/examples/UdpNtpClient libraries/Storage/examples/FlashFormat diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.cpp b/variants/arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.cpp index a6ba41b27..da9068e1f 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.cpp +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h b/variants/arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h index dbed40b72..7d5262e46 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/pure_analog_pins.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Arduino SA + * Copyright (c) Arduino s.r.l. and/or its affiliated companies * * SPDX-License-Identifier: Apache-2.0 */ diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/skip_these_examples.txt b/variants/arduino_portenta_h7_stm32h747xx_m7/skip_these_examples.txt index bb4e30797..3fdc85922 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/skip_these_examples.txt +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/skip_these_examples.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_portenta_h7_stm32h747xx_m7/variant.cpp b/variants/arduino_portenta_h7_stm32h747xx_m7/variant.cpp index 20bde355a..cb8b0371c 100644 --- a/variants/arduino_portenta_h7_stm32h747xx_m7/variant.cpp +++ b/variants/arduino_portenta_h7_stm32h747xx_m7/variant.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include #include diff --git a/variants/arduino_uno_q_stm32u585xx/analogReference.cpp b/variants/arduino_uno_q_stm32u585xx/analogReference.cpp index b9d7f9715..b8289d5c7 100644 --- a/variants/arduino_uno_q_stm32u585xx/analogReference.cpp +++ b/variants/arduino_uno_q_stm32u585xx/analogReference.cpp @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include extern "C" { diff --git a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf index 9beb77ffb..65638b7c3 100644 --- a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf +++ b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.conf @@ -1,13 +1,16 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + CONFIG_LLEXT_STORAGE_WRITABLE=n CONFIG_HEAP_MEM_POOL_SIZE=32768 CONFIG_LLEXT_HEAP_SIZE=128 -CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=-1 CONFIG_FPU=y CONFIG_ADC=y CONFIG_DAC=y CONFIG_PWM=y +CONFIG_I2C_TARGET=y CONFIG_ICACHE=y CONFIG_DCACHE=y diff --git a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.overlay b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.overlay index 98d9552b9..988463a2e 100644 --- a/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.overlay +++ b/variants/arduino_uno_q_stm32u585xx/arduino_uno_q_stm32u585xx.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + &i2c4 { status = "okay"; pinctrl-0 = <&i2c4_scl_pd12 &i2c4_sda_pd13>; @@ -56,7 +62,6 @@ /delete-node/ &slot0_partition; /delete-node/ &slot1_partition; -/delete-node/ &scratch_partition; /delete-node/ &storage_partition; &flash0 { diff --git a/variants/arduino_uno_q_stm32u585xx/flash_bootloader.cfg b/variants/arduino_uno_q_stm32u585xx/flash_bootloader.cfg index 2d3aead25..da6607e14 100644 --- a/variants/arduino_uno_q_stm32u585xx/flash_bootloader.cfg +++ b/variants/arduino_uno_q_stm32u585xx/flash_bootloader.cfg @@ -1,3 +1,6 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + reset_config srst_only srst_nogate srst_push_pull connect_assert_srst init reset diff --git a/variants/arduino_uno_q_stm32u585xx/flash_sketch.cfg b/variants/arduino_uno_q_stm32u585xx/flash_sketch.cfg index b0d0fda44..aac0ee47b 100644 --- a/variants/arduino_uno_q_stm32u585xx/flash_sketch.cfg +++ b/variants/arduino_uno_q_stm32u585xx/flash_sketch.cfg @@ -1,3 +1,6 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + reset_config srst_only srst_nogate srst_push_pull connect_assert_srst init reset diff --git a/variants/arduino_uno_q_stm32u585xx/flash_sketch_ram.cfg b/variants/arduino_uno_q_stm32u585xx/flash_sketch_ram.cfg index 108ec9126..fdb18d117 100644 --- a/variants/arduino_uno_q_stm32u585xx/flash_sketch_ram.cfg +++ b/variants/arduino_uno_q_stm32u585xx/flash_sketch_ram.cfg @@ -1,3 +1,6 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + reset_config srst_only srst_push_pull init diff --git a/variants/arduino_uno_q_stm32u585xx/known_example_issues.txt b/variants/arduino_uno_q_stm32u585xx/known_example_issues.txt index f701f61f5..fad738288 100644 --- a/variants/arduino_uno_q_stm32u585xx/known_example_issues.txt +++ b/variants/arduino_uno_q_stm32u585xx/known_example_issues.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/arduino_uno_q_stm32u585xx/scripts/set-to-ram-mode.sh b/variants/arduino_uno_q_stm32u585xx/scripts/set-to-ram-mode.sh index 63df41fd3..9ff251684 100755 --- a/variants/arduino_uno_q_stm32u585xx/scripts/set-to-ram-mode.sh +++ b/variants/arduino_uno_q_stm32u585xx/scripts/set-to-ram-mode.sh @@ -1,5 +1,8 @@ #!/bin/sh +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + # This script sets the micro of the Arduino UNO Q in RAM mode, and allow to flash it # with menu option flash=ram. # This is necessary because a flash in RAM mode is possible only if the micro diff --git a/variants/arduino_uno_q_stm32u585xx/skip_these_examples.txt b/variants/arduino_uno_q_stm32u585xx/skip_these_examples.txt index f8f58cbfe..22e511274 100644 --- a/variants/arduino_uno_q_stm32u585xx/skip_these_examples.txt +++ b/variants/arduino_uno_q_stm32u585xx/skip_these_examples.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/common/arduino_flash_fs.dtsi b/variants/common/arduino_flash_fs.dtsi index d3204b069..3263506b2 100644 --- a/variants/common/arduino_flash_fs.dtsi +++ b/variants/common/arduino_flash_fs.dtsi @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + /* * Common filesystem configuration * @@ -15,6 +21,7 @@ * - /ota: (FAT) - OTA update partition * - /storage (LittleFS) - User data partition */ + &qspi_flash { /delete-node/ partitions; partitions { diff --git a/variants/ek_ra8d1_r7fa8d1bhecbd/ek_ra8d1_r7fa8d1bhecbd.conf b/variants/ek_ra8d1_r7fa8d1bhecbd/ek_ra8d1_r7fa8d1bhecbd.conf index 00a7464d8..2ec9d851f 100644 --- a/variants/ek_ra8d1_r7fa8d1bhecbd/ek_ra8d1_r7fa8d1bhecbd.conf +++ b/variants/ek_ra8d1_r7fa8d1bhecbd/ek_ra8d1_r7fa8d1bhecbd.conf @@ -1,3 +1,6 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=480000000 CONFIG_BUILD_OUTPUT_BIN=n \ No newline at end of file diff --git a/variants/ek_ra8d1_r7fa8d1bhecbd/ek_ra8d1_r7fa8d1bhecbd.overlay b/variants/ek_ra8d1_r7fa8d1bhecbd/ek_ra8d1_r7fa8d1bhecbd.overlay index 4c87afe13..2f0a54fb4 100644 --- a/variants/ek_ra8d1_r7fa8d1bhecbd/ek_ra8d1_r7fa8d1bhecbd.overlay +++ b/variants/ek_ra8d1_r7fa8d1bhecbd/ek_ra8d1_r7fa8d1bhecbd.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + #include &iic1 { diff --git a/variants/ek_ra8d1_r7fa8d1bhecbd/flasher.jlink b/variants/ek_ra8d1_r7fa8d1bhecbd/flasher.jlink index 9996d02ab..cbbcda07e 100644 --- a/variants/ek_ra8d1_r7fa8d1bhecbd/flasher.jlink +++ b/variants/ek_ra8d1_r7fa8d1bhecbd/flasher.jlink @@ -1,6 +1,9 @@ +// Copyright (c) Arduino s.r.l. and/or its affiliated companies +// SPDX-License-Identifier: Apache-2.0 + device R7FA8D1AH si SWD speed 4000 connect loadbin SKETCH 0x2032000 -exit \ No newline at end of file +exit diff --git a/variants/ek_ra8d1_r7fa8d1bhecbd/known_example_issues.txt b/variants/ek_ra8d1_r7fa8d1bhecbd/known_example_issues.txt index f701f61f5..fad738288 100644 --- a/variants/ek_ra8d1_r7fa8d1bhecbd/known_example_issues.txt +++ b/variants/ek_ra8d1_r7fa8d1bhecbd/known_example_issues.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/ek_ra8d1_r7fa8d1bhecbd/linker_script.ld b/variants/ek_ra8d1_r7fa8d1bhecbd/linker_script.ld index d71654d37..a8d54c616 100644 --- a/variants/ek_ra8d1_r7fa8d1bhecbd/linker_script.ld +++ b/variants/ek_ra8d1_r7fa8d1bhecbd/linker_script.ld @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + FORCE_COMMON_ALLOCATION SECTIONS { diff --git a/variants/ek_ra8d1_r7fa8d1bhecbd/skip_these_examples.txt b/variants/ek_ra8d1_r7fa8d1bhecbd/skip_these_examples.txt index ca4a8aac1..664f3dc21 100644 --- a/variants/ek_ra8d1_r7fa8d1bhecbd/skip_these_examples.txt +++ b/variants/ek_ra8d1_r7fa8d1bhecbd/skip_these_examples.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/frdm_mcxn947_mcxn947_cpu0/frdm_mcxn947_mcxn947_cpu0.conf b/variants/frdm_mcxn947_mcxn947_cpu0/frdm_mcxn947_mcxn947_cpu0.conf index 867b155ad..0ce2bd12f 100644 --- a/variants/frdm_mcxn947_mcxn947_cpu0/frdm_mcxn947_mcxn947_cpu0.conf +++ b/variants/frdm_mcxn947_mcxn947_cpu0/frdm_mcxn947_mcxn947_cpu0.conf @@ -1,3 +1,6 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + CONFIG_BUILD_OUTPUT_HEX=y CONFIG_BUILD_NO_GAP_FILL=y @@ -5,18 +8,19 @@ CONFIG_BUILD_NO_GAP_FILL=y CONFIG_FLASH=y #CONFIG_USB_DC_NXP_EHCI=y -CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_DEVICE_STACK_NEXT=y CONFIG_USB_DEVICE_PRODUCT="Freedom MCXN947" CONFIG_USB_DEVICE_MANUFACTURER="NXP" CONFIG_USB_DEVICE_VID=0x2341 CONFIG_USB_DEVICE_PID=0x0078 CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n -CONFIG_USB_CDC_ACM=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=512 -CONFIG_UART_LINE_CTRL=y +CONFIG_USBD_CDC_ACM_CLASS=y CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y -CONFIG_USB_MCUX_THREAD_STACK_SIZE=4096 +CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y +CONFIG_UDC_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USBD_LOG_LEVEL_ERR=y +CONFIG_UART_LINE_CTRL=y CONFIG_LLEXT_STORAGE_WRITABLE=n CONFIG_STACK_USAGE=y @@ -37,15 +41,6 @@ CONFIG_INIT_STACKS=y CONFIG_NET_MGMT=y CONFIG_NET_MGMT_EVENT=y -CONFIG_TINYCRYPT=y -CONFIG_TINYCRYPT_AES=y -CONFIG_TINYCRYPT_SHA256=y -CONFIG_TINYCRYPT_SHA256_HMAC=y -CONFIG_TINYCRYPT_AES_CCM=y -CONFIG_TINYCRYPT_AES_CTR=y -CONFIG_TINYCRYPT_AES_CBC=y -CONFIG_TINYCRYPT_AES_CMAC=y -CONFIG_TINYCRYPT_CTR_PRNG=y CONFIG_ENTROPY_GENERATOR=y CONFIG_TEST_RANDOM_GENERATOR=y @@ -55,5 +50,9 @@ CONFIG_NET_TCP_WORKQ_STACK_SIZE=8192 CONFIG_NET_MGMT_EVENT_STACK_SIZE=8192 CONFIG_NET_TCP=y CONFIG_NET_SOCKETS=y -CONFIG_POSIX_API=y +CONFIG_POSIX_NETWORKING=y +CONFIG_POSIX_SYSTEM_INTERFACES=y +CONFIG_POSIX_FD_MGMT=y +CONFIG_POSIX_DEVICE_IO=y +CONFIG_FILE_SYSTEM=y CONFIG_NET_L2_ETHERNET_MGMT=y \ No newline at end of file diff --git a/variants/frdm_mcxn947_mcxn947_cpu0/frdm_mcxn947_mcxn947_cpu0.overlay b/variants/frdm_mcxn947_mcxn947_cpu0/frdm_mcxn947_mcxn947_cpu0.overlay index 47ccd6f52..6d90c40d0 100644 --- a/variants/frdm_mcxn947_mcxn947_cpu0/frdm_mcxn947_mcxn947_cpu0.overlay +++ b/variants/frdm_mcxn947_mcxn947_cpu0/frdm_mcxn947_mcxn947_cpu0.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + &zephyr_udc0 { status = "okay"; board_cdc_acm_uart: board_cdc_acm_uart { diff --git a/variants/frdm_mcxn947_mcxn947_cpu0/known_example_issues.txt b/variants/frdm_mcxn947_mcxn947_cpu0/known_example_issues.txt index f701f61f5..fad738288 100644 --- a/variants/frdm_mcxn947_mcxn947_cpu0/known_example_issues.txt +++ b/variants/frdm_mcxn947_mcxn947_cpu0/known_example_issues.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/frdm_mcxn947_mcxn947_cpu0/linker_script.ld b/variants/frdm_mcxn947_mcxn947_cpu0/linker_script.ld index d71654d37..a8d54c616 100644 --- a/variants/frdm_mcxn947_mcxn947_cpu0/linker_script.ld +++ b/variants/frdm_mcxn947_mcxn947_cpu0/linker_script.ld @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + FORCE_COMMON_ALLOCATION SECTIONS { diff --git a/variants/frdm_mcxn947_mcxn947_cpu0/skip_these_examples.txt b/variants/frdm_mcxn947_mcxn947_cpu0/skip_these_examples.txt index ca4a8aac1..664f3dc21 100644 --- a/variants/frdm_mcxn947_mcxn947_cpu0/skip_these_examples.txt +++ b/variants/frdm_mcxn947_mcxn947_cpu0/skip_these_examples.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/frdm_rw612_rw612/frdm_rw612_rw612.conf b/variants/frdm_rw612_rw612/frdm_rw612_rw612.conf index 7a8f3cc55..8141080c4 100644 --- a/variants/frdm_rw612_rw612/frdm_rw612_rw612.conf +++ b/variants/frdm_rw612_rw612/frdm_rw612_rw612.conf @@ -1,21 +1,25 @@ +# Copyright (c) Arduino s.r.l. and/or its affiliated companies +# SPDX-License-Identifier: Apache-2.0 + CONFIG_BUILD_OUTPUT_HEX=y CONFIG_FLASH=y #CONFIG_USB_DC_NXP_EHCI=y -CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_DEVICE_STACK_NEXT=y CONFIG_USB_DEVICE_PRODUCT="Freedom RW612" CONFIG_USB_DEVICE_MANUFACTURER="NXP" CONFIG_USB_DEVICE_VID=0x2341 CONFIG_USB_DEVICE_PID=0x0079 CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=n -CONFIG_USB_CDC_ACM=y -CONFIG_USB_CDC_ACM_RINGBUF_SIZE=512 -CONFIG_UART_LINE_CTRL=y +CONFIG_USBD_CDC_ACM_CLASS=y CONFIG_CDC_ACM_DTE_RATE_CALLBACK_SUPPORT=y -CONFIG_USB_MCUX_THREAD_STACK_SIZE=4096 +CONFIG_USBD_CDC_ACM_LOG_LEVEL_ERR=y +CONFIG_UDC_DRIVER_LOG_LEVEL_ERR=y +CONFIG_USBD_LOG_LEVEL_ERR=y +CONFIG_UART_LINE_CTRL=y CONFIG_LLEXT_STORAGE_WRITABLE=y CONFIG_STACK_USAGE=n @@ -36,7 +40,11 @@ CONFIG_NET_TCP_WORKQ_STACK_SIZE=8192 CONFIG_NET_MGMT_EVENT_STACK_SIZE=8192 CONFIG_NET_TCP=y CONFIG_NET_SOCKETS=y -CONFIG_POSIX_API=y +CONFIG_POSIX_NETWORKING=y +CONFIG_POSIX_SYSTEM_INTERFACES=y +CONFIG_POSIX_FD_MGMT=y +CONFIG_POSIX_DEVICE_IO=y +CONFIG_FILE_SYSTEM=y CONFIG_EARLY_CONSOLE=y diff --git a/variants/frdm_rw612_rw612/frdm_rw612_rw612.overlay b/variants/frdm_rw612_rw612/frdm_rw612_rw612.overlay index f1cea15de..44ad6751e 100644 --- a/variants/frdm_rw612_rw612/frdm_rw612_rw612.overlay +++ b/variants/frdm_rw612_rw612/frdm_rw612_rw612.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + &zephyr_udc0 { status = "okay"; board_cdc_acm_uart: board_cdc_acm_uart { diff --git a/variants/frdm_rw612_rw612/known_example_issues.txt b/variants/frdm_rw612_rw612/known_example_issues.txt index f701f61f5..fad738288 100644 --- a/variants/frdm_rw612_rw612/known_example_issues.txt +++ b/variants/frdm_rw612_rw612/known_example_issues.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/frdm_rw612_rw612/skip_these_examples.txt b/variants/frdm_rw612_rw612/skip_these_examples.txt index ca4a8aac1..664f3dc21 100644 --- a/variants/frdm_rw612_rw612/skip_these_examples.txt +++ b/variants/frdm_rw612_rw612/skip_these_examples.txt @@ -1,4 +1,4 @@ -# Copyright ARDUINO SRL (https://www.arduino.cc) +# Copyright (c) Arduino s.r.l. and/or its affiliated companies # SPDX-License-Identifier: Apache-2.0 # This file contains a list of examples that are shipped with the core (or used diff --git a/variants/frdm_rw612_rw612/variant.h b/variants/frdm_rw612_rw612/variant.h index 3b764cf5b..f6837f622 100644 --- a/variants/frdm_rw612_rw612/variant.h +++ b/variants/frdm_rw612_rw612/variant.h @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + // TODO: correctly handle these legacy defines #define MOSI 0 #define MISO 0 diff --git a/variants/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay b/variants/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay index 220208215..f70723357 100644 --- a/variants/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay +++ b/variants/nrf52840dk_nrf52840/nrf52840dk_nrf52840.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + / { zephyr,user { digital-pin-gpios = <&arduino_header 6 0>, /* Digital */ diff --git a/variants/nrf9160dk_nrf9160/nrf9160dk_nrf9160.overlay b/variants/nrf9160dk_nrf9160/nrf9160dk_nrf9160.overlay index d69fdcb5f..85dbbbeaf 100644 --- a/variants/nrf9160dk_nrf9160/nrf9160dk_nrf9160.overlay +++ b/variants/nrf9160dk_nrf9160/nrf9160dk_nrf9160.overlay @@ -1,3 +1,9 @@ +/* + * Copyright (c) Arduino s.r.l. and/or its affiliated companies + * + * SPDX-License-Identifier: Apache-2.0 + */ + / { zephyr,user { digital-pin-gpios = diff --git a/west.yml b/west.yml index e8b1b3103..6a497c183 100644 --- a/west.yml +++ b/west.yml @@ -21,7 +21,7 @@ manifest: projects: - name: zephyr remote: arduino - revision: zephyr-arduino-v4.2.0 + revision: zephyr-arduino-v4.3.0+ import: name-allowlist: - cmsis