From dbe4d894c04a1c4cdbbdc5ee2711c0b53b328970 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Oct 2022 13:21:26 +0200 Subject: [PATCH 01/35] =?UTF-8?q?ci:=20=E2=9C=A8=20Add=20Rasberry=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/raspberry.yml | 153 ++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 .github/workflows/raspberry.yml diff --git a/.github/workflows/raspberry.yml b/.github/workflows/raspberry.yml new file mode 100644 index 00000000..24856bfc --- /dev/null +++ b/.github/workflows/raspberry.yml @@ -0,0 +1,153 @@ +name: Rasberry Pi + +on: + pull_request: + branches: + - master + push: + workflow_dispatch: + workflow_call: + inputs: + target: + required: true + type: string + arch: + required: false + default: "" + type: string + +env: + CARGO_TERM_COLOR: always + +jobs: + publish-release: + if: github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + crate: ["espflash", "cargo-espflash"] + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: ${{ inputs.target }} + override: true + - uses: Swatinem/rust-cache@v1 + - name: Replace target string + uses: mad9000/actions-find-and-replace-string@1 + id: findandreplace + with: + source: ${{ inputs.target }} + find: "unknown-" + replace: "" + - name: Build dependencies + run: | + sudo sed -i 's/azure\.//' /etc/apt/sources.list + sudo apt-get update + echo "deb [arch=${{ inputs.arch }}] http://ports.ubuntu.com/ubuntu-ports focal main universe" | sudo tee -a /etc/apt/sources.list + echo "deb [arch=${{ inputs.arch }}] http://ports.ubuntu.com/ubuntu-ports focal-updates main universe" | sudo tee -a /etc/apt/sources.list + sudo apt update + sudo dpkg --add-architecture ${{ inputs.arch }} + sudo apt-get install -y curl git libudev-dev musl-tools pkg-config "libudev1:${{ inputs.arch }}" "libgcc-s1:${{ inputs.arch }}" "libc6:${{ inputs.arch }}" "libudev-dev:${{ inputs.arch }}" gcc-arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf gcc-aarch64-linux-gnu pkg-config-aarch64-linux-gnu + echo "PKG_CONFIG_ALLOW_SYSTEM_LIBS=0" >> $GITHUB_ENV + echo "PKG_CONFIG_DIR=/opt/" >> $GITHUB_ENV + echo "PKG_CONFIG_LIBDIR=/opt/usr/lib/pkgconfig:/opt/usr/share/pkgconfig" >> $GITHUB_ENV + echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV + if [[ ${{ inputs.arch }} == arm64 ]]; then + echo "PKG_CONFIG_PATH=/usr/lib/${{ steps.findandreplace.outputs.value }}/pkgconfig" >> $GITHUB_ENV + echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=${{ steps.findandreplace.outputs.value }}-gcc" >> $GITHUB_ENV + fi + if [[ ${{ inputs.arch }} == armhf ]]; then + echo "PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig" >> $GITHUB_ENV + echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV + fi + - uses: actions-rs/cargo@v1 + with: + command: build + args: --release --all --target ${{ inputs.target }} --features=raspberry + - name: Compress + run: zip -j ${{ matrix.crate }}-${{ inputs.target }}.zip target/${{ inputs.target }}/release/${{ matrix.crate }}${{ inputs.extension }} + - uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ matrix.crate }}-${{ inputs.target }}.zip + tag: ${{ github.ref }} + + rust-ci: + if: github.event_name != 'workflow_dispatch' + name: "Rust CI: ${{ matrix.job.name }} - ${{ matrix.board.target }}" + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + board: + - target: armv7-unknown-linux-gnueabihf + arch: armhf + - target: aarch64-unknown-linux-gnu + arch: arm64 + job: + - name: Check + toolchain: stable + cargo-command: check + - name: Check MSRV + toolchain: "1.60" + cargo-command: check + - name: Unit Test + toolchain: stable + cargo-command: test + args: --lib + - name: Rustfmt + toolchain: stable + components: rustfmt + cargo-command: fmt + args: --all -- --check + - name: Clippy + toolchain: stable + components: clippy + cargo-command: clippy + args: -- -A clippy::too_many_arguments + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: ${{ matrix.job.toolchain }} + target: ${{ matrix.board.target }} + components: ${{ matrix.job.components }} + override: true + - uses: Swatinem/rust-cache@v1 + - name: Replace target string + uses: mad9000/actions-find-and-replace-string@1 + id: findandreplace + with: + source: ${{ matrix.board.target }} + find: "unknown-" + replace: "" + - name: Build dependencies + if: matrix.job.cargo-command != 'fmt' + run: | + sudo sed -i 's/azure\.//' /etc/apt/sources.list + sudo apt-get update + echo "deb [arch=${{ matrix.board.arch }} http://ports.ubuntu.com/ubuntu-ports focal main universe" | sudo tee -a /etc/apt/sources.list + echo "deb [arch=${{ matrix.board.arch }}] http://ports.ubuntu.com/ubuntu-ports focal-updates main universe" | sudo tee -a /etc/apt/sources.list + sudo apt update + sudo dpkg --add-architecture ${{ matrix.board.arch }} + sudo apt-get install -y curl git libudev-dev musl-tools pkg-config "libudev1:${{ matrix.board.arch }}" "libgcc-s1:${{ matrix.board.arch }}" "libc6:${{ matrix.board.arch }}" "libudev-dev:${{ matrix.board.arch }}" gcc-arm-linux-gnueabihf pkg-config-arm-linux-gnueabihf gcc-aarch64-linux-gnu pkg-config-aarch64-linux-gnu + echo "PKG_CONFIG_ALLOW_SYSTEM_LIBS=0" >> $GITHUB_ENV + echo "PKG_CONFIG_DIR=/opt/" >> $GITHUB_ENV + echo "PKG_CONFIG_LIBDIR=/opt/usr/lib/pkgconfig:/opt/usr/share/pkgconfig" >> $GITHUB_ENV + echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV + if [[ ${{ matrix.board.arch }} == arm64 ]]; then + echo "PKG_CONFIG_PATH=/usr/lib/${{ steps.findandreplace.outputs.value }}/pkgconfig" >> $GITHUB_ENV + echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=${{ steps.findandreplace.outputs.value }}-gcc" >> $GITHUB_ENV + fi + if [[ ${{ matrix.board.arch }} == armhf ]]; then + echo "PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig" >> $GITHUB_ENV + echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV + fi + - uses: actions-rs/cargo@v1 + with: + command: ${{ matrix.job.cargo-command }} + args: ${{ matrix.job.args }} --features=raspberry From a89b6f48b56cc205bc12483d21ff30151d4c5061 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Oct 2022 13:24:50 +0200 Subject: [PATCH 02/35] =?UTF-8?q?ci:=20=F0=9F=90=9B=20Fix=20typo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/raspberry.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/raspberry.yml b/.github/workflows/raspberry.yml index 24856bfc..8a0392a9 100644 --- a/.github/workflows/raspberry.yml +++ b/.github/workflows/raspberry.yml @@ -130,7 +130,7 @@ jobs: run: | sudo sed -i 's/azure\.//' /etc/apt/sources.list sudo apt-get update - echo "deb [arch=${{ matrix.board.arch }} http://ports.ubuntu.com/ubuntu-ports focal main universe" | sudo tee -a /etc/apt/sources.list + echo "deb [arch=${{ matrix.board.arch }}] http://ports.ubuntu.com/ubuntu-ports focal main universe" | sudo tee -a /etc/apt/sources.list echo "deb [arch=${{ matrix.board.arch }}] http://ports.ubuntu.com/ubuntu-ports focal-updates main universe" | sudo tee -a /etc/apt/sources.list sudo apt update sudo dpkg --add-architecture ${{ matrix.board.arch }} From a21b484bc07b4fadbd409d7515b5b53b68c9ea9b Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Oct 2022 13:30:44 +0200 Subject: [PATCH 03/35] =?UTF-8?q?ci:=20=F0=9F=90=9B=20Fix=20args=20order?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/raspberry.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/raspberry.yml b/.github/workflows/raspberry.yml index 8a0392a9..6a3045c6 100644 --- a/.github/workflows/raspberry.yml +++ b/.github/workflows/raspberry.yml @@ -150,4 +150,4 @@ jobs: - uses: actions-rs/cargo@v1 with: command: ${{ matrix.job.cargo-command }} - args: ${{ matrix.job.args }} --features=raspberry + args: --features=raspberry ${{ matrix.job.args }} From 8580fa0ddd309b9a2ef49f95d42985dc7c9a4b42 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Tue, 4 Oct 2022 13:34:18 +0200 Subject: [PATCH 04/35] =?UTF-8?q?ci:=20=F0=9F=90=9B=20Fix=20args=20order?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/raspberry.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/raspberry.yml b/.github/workflows/raspberry.yml index 6a3045c6..2466684c 100644 --- a/.github/workflows/raspberry.yml +++ b/.github/workflows/raspberry.yml @@ -91,13 +91,15 @@ jobs: - name: Check toolchain: stable cargo-command: check + args: --features=raspberry - name: Check MSRV toolchain: "1.60" cargo-command: check + args: --features=raspberry - name: Unit Test toolchain: stable cargo-command: test - args: --lib + args: --lib --features=raspberry - name: Rustfmt toolchain: stable components: rustfmt @@ -150,4 +152,4 @@ jobs: - uses: actions-rs/cargo@v1 with: command: ${{ matrix.job.cargo-command }} - args: --features=raspberry ${{ matrix.job.args }} + args: ${{ matrix.job.args }} From 89f76faec3caac0018a187ba5ba17f686a40a502 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 2 Feb 2023 10:11:03 +0100 Subject: [PATCH 05/35] =?UTF-8?q?ci:=20=E2=AC=86=EF=B8=8F=20Bump=20actions?= =?UTF-8?q?/checkout?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rust.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index fdf24ff8..a2edc4d7 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -20,7 +20,7 @@ jobs: sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list sudo apt-get update sudo apt-get install musl-tools libudev-dev - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -40,7 +40,7 @@ jobs: sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list sudo apt-get update sudo apt-get install musl-tools libudev-dev - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -61,7 +61,7 @@ jobs: sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list sudo apt-get update sudo apt-get install musl-tools libudev-dev - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -81,7 +81,7 @@ jobs: sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list sudo apt-get update sudo apt-get install musl-tools libudev-dev - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -97,7 +97,7 @@ jobs: name: Rustfmt runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: profile: minimal @@ -119,7 +119,7 @@ jobs: sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list sudo apt-get update sudo apt-get install musl-tools libudev-dev - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: profile: minimal From 5f79d13565faed7a9f2bf2efc31ec8375cec0335 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 2 Feb 2023 10:11:40 +0100 Subject: [PATCH 06/35] =?UTF-8?q?ci:=20=E2=AC=86=EF=B8=8F=20Bump=20Swatine?= =?UTF-8?q?m/rust-cache?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rust.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a2edc4d7..cf6b1a0f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -26,7 +26,7 @@ jobs: profile: minimal toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: check @@ -46,7 +46,7 @@ jobs: profile: minimal toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: check @@ -67,7 +67,7 @@ jobs: profile: minimal toolchain: "1.63" override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: check @@ -87,7 +87,7 @@ jobs: profile: minimal toolchain: stable override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: test @@ -104,7 +104,7 @@ jobs: toolchain: stable override: true components: rustfmt - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: fmt @@ -126,7 +126,7 @@ jobs: toolchain: stable override: true components: clippy - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - uses: actions-rs/cargo@v1 with: command: clippy From 9d38af9a88c021ccfb58ba27db3e0f5df061864c Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 2 Feb 2023 10:15:50 +0100 Subject: [PATCH 07/35] =?UTF-8?q?ci:=20=E2=9A=A1=EF=B8=8F=20Avoid=20using?= =?UTF-8?q?=20actions-rs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rust.yml | 38 +++++++------------------------------- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index cf6b1a0f..c2e53c3c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -23,13 +23,9 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - profile: minimal toolchain: stable - override: true - uses: Swatinem/rust-cache@v2 - - uses: actions-rs/cargo@v1 - with: - command: check + - run: cargo check check-lib: name: Check (lib) @@ -45,12 +41,8 @@ jobs: with: profile: minimal toolchain: stable - override: true - uses: Swatinem/rust-cache@v2 - - uses: actions-rs/cargo@v1 - with: - command: check - args: --lib --no-default-features + - run: cargo check --lib --no-default-features msrv: name: Check MSRV @@ -66,11 +58,8 @@ jobs: with: profile: minimal toolchain: "1.63" - override: true - uses: Swatinem/rust-cache@v2 - - uses: actions-rs/cargo@v1 - with: - command: check + - run: cargo check test-lib: name: Unit Test @@ -84,14 +73,9 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - profile: minimal toolchain: stable - override: true - uses: Swatinem/rust-cache@v2 - - uses: actions-rs/cargo@v1 - with: - command: test - args: --lib + - run: cargo test --lib fmt: name: Rustfmt @@ -105,10 +89,7 @@ jobs: override: true components: rustfmt - uses: Swatinem/rust-cache@v2 - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check + - run: cargo fmt --all -- --check clippy: name: Clippy @@ -122,13 +103,8 @@ jobs: - uses: actions/checkout@v3 - uses: actions-rs/toolchain@v1 with: - profile: minimal toolchain: stable - override: true components: clippy - uses: Swatinem/rust-cache@v2 - - uses: actions-rs/cargo@v1 - with: - command: clippy - # `too_many_arguments` is relatively arbitrary - args: -- -A clippy::too_many_arguments + # `too_many_arguments` is relatively arbitrary + - run: cargo clippy -- -A clippy::too_many_arguments From c1ef7e3f76016428eb2ff9206a8dfd7ec1ceff56 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 2 Feb 2023 10:16:41 +0100 Subject: [PATCH 08/35] =?UTF-8?q?ci:=20=E2=9A=A1=EF=B8=8F=20Replace=20acti?= =?UTF-8?q?ons-rs/toolchain=20by=20dtolnay/rust-toolchain?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rust.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c2e53c3c..aca622ea 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -21,7 +21,7 @@ jobs: sudo apt-get update sudo apt-get install musl-tools libudev-dev - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: toolchain: stable - uses: Swatinem/rust-cache@v2 @@ -37,7 +37,7 @@ jobs: sudo apt-get update sudo apt-get install musl-tools libudev-dev - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: profile: minimal toolchain: stable @@ -54,7 +54,7 @@ jobs: sudo apt-get update sudo apt-get install musl-tools libudev-dev - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: profile: minimal toolchain: "1.63" @@ -71,7 +71,7 @@ jobs: sudo apt-get update sudo apt-get install musl-tools libudev-dev - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: toolchain: stable - uses: Swatinem/rust-cache@v2 @@ -82,7 +82,7 @@ jobs: runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: profile: minimal toolchain: stable @@ -101,7 +101,7 @@ jobs: sudo apt-get update sudo apt-get install musl-tools libudev-dev - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 + - uses: dtolnay/rust-toolchain@v1 with: toolchain: stable components: clippy From 4669ac03bb933a57f2583c04200487da5bbcf2f0 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 2 Feb 2023 10:18:36 +0100 Subject: [PATCH 09/35] =?UTF-8?q?ci:=20=E2=9A=A1=EF=B8=8F=20Fix=20CI=20war?= =?UTF-8?q?nings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/package.yml | 7 +++---- .github/workflows/raspberry_package.yml | 7 +++---- .github/workflows/raspberry_rust.yml | 8 +++----- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index a1e4fde9..a303f8d8 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -25,13 +25,12 @@ jobs: matrix: crate: ["espflash", "cargo-espflash"] steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@v1 with: toolchain: stable target: ${{ inputs.target }} - override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: Build dependencies for other ubuntu targets if: inputs.runs_on == 'ubuntu-20.04' run: | diff --git a/.github/workflows/raspberry_package.yml b/.github/workflows/raspberry_package.yml index 9fc3e4f2..91af07d3 100644 --- a/.github/workflows/raspberry_package.yml +++ b/.github/workflows/raspberry_package.yml @@ -22,13 +22,12 @@ jobs: matrix: crate: ["espflash", "cargo-espflash"] steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@v1 with: toolchain: stable target: ${{ inputs.target }} - override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: Replace target string uses: mad9000/actions-find-and-replace-string@1 id: findandreplace diff --git a/.github/workflows/raspberry_rust.yml b/.github/workflows/raspberry_rust.yml index e0011d58..7b3a6648 100644 --- a/.github/workflows/raspberry_rust.yml +++ b/.github/workflows/raspberry_rust.yml @@ -45,15 +45,13 @@ jobs: cargo-command: clippy args: --features=raspberry -- -A clippy::too_many_arguments steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 + - uses: actions/checkout@v3 + - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: ${{ matrix.job.toolchain }} target: ${{ matrix.board.target }} components: ${{ matrix.job.components }} - override: true - - uses: Swatinem/rust-cache@v1 + - uses: Swatinem/rust-cache@v2 - name: Replace target string uses: mad9000/actions-find-and-replace-string@1 id: findandreplace From 019cd61896a6eeed255e6a4345c84de255f2f344 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 2 Feb 2023 10:21:44 +0100 Subject: [PATCH 10/35] =?UTF-8?q?ci:=20=F0=9F=8E=A8=20Fix=20inputs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rust.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index aca622ea..c5acd205 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -39,7 +39,6 @@ jobs: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: stable - uses: Swatinem/rust-cache@v2 - run: cargo check --lib --no-default-features @@ -56,7 +55,6 @@ jobs: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: "1.63" - uses: Swatinem/rust-cache@v2 - run: cargo check @@ -84,9 +82,7 @@ jobs: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@v1 with: - profile: minimal toolchain: stable - override: true components: rustfmt - uses: Swatinem/rust-cache@v2 - run: cargo fmt --all -- --check From 86881d23d9053340b4ef1fdaa30f9897a419c98a Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 2 Feb 2023 10:29:02 +0100 Subject: [PATCH 11/35] =?UTF-8?q?ci:=20=E2=9A=A1=EF=B8=8F=20Update=20mad90?= =?UTF-8?q?00/actions-find-and-replace-string=20and=20remove=20action-rs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/package.yml | 5 +---- .github/workflows/raspberry_package.yml | 7 ++----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index a303f8d8..a86a376a 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -37,10 +37,7 @@ jobs: sudo sed -i 's/azure.archive.ubuntu.com/archive.ubuntu.com/' /etc/apt/sources.list sudo apt-get update sudo apt-get install musl-tools libudev-dev - - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --all --target ${{ inputs.target }} + - run: cargo build --release --all --target ${{ inputs.target }} - name: Compress (Unix) if: ${{ inputs.runs_on != 'windows-latest' }} run: zip -j ${{ matrix.crate }}-${{ inputs.target }}.zip target/${{ inputs.target }}/release/${{ matrix.crate }}${{ inputs.extension }} diff --git a/.github/workflows/raspberry_package.yml b/.github/workflows/raspberry_package.yml index 91af07d3..2070d954 100644 --- a/.github/workflows/raspberry_package.yml +++ b/.github/workflows/raspberry_package.yml @@ -29,7 +29,7 @@ jobs: target: ${{ inputs.target }} - uses: Swatinem/rust-cache@v2 - name: Replace target string - uses: mad9000/actions-find-and-replace-string@1 + uses: mad9000/actions-find-and-replace-string@3 id: findandreplace with: source: ${{ inputs.target }} @@ -56,10 +56,7 @@ jobs: echo "PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig" >> $GITHUB_ENV echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV fi - - uses: actions-rs/cargo@v1 - with: - command: build - args: --release --all --target ${{ inputs.target }} --features=raspberry + - run: cargo build --release --all --target ${{ inputs.target }} --features=raspberry - name: Compress run: zip -j ${{ matrix.crate }}-${{ inputs.target }}.zip target/${{ inputs.target }}/release/${{ matrix.crate }}${{ inputs.extension }} - uses: svenstaro/upload-release-action@v2 From aa42bd24ee4c1aa5deb4ea28c5452a0cbd8bedd8 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Thu, 2 Feb 2023 10:29:12 +0100 Subject: [PATCH 12/35] =?UTF-8?q?ci:=20=E2=9A=A1=EF=B8=8F=20Update=20mad90?= =?UTF-8?q?00/actions-find-and-replace-string=20and=20remove=20action-rs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/raspberry_rust.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/raspberry_rust.yml b/.github/workflows/raspberry_rust.yml index 7b3a6648..13b24ac0 100644 --- a/.github/workflows/raspberry_rust.yml +++ b/.github/workflows/raspberry_rust.yml @@ -53,7 +53,7 @@ jobs: components: ${{ matrix.job.components }} - uses: Swatinem/rust-cache@v2 - name: Replace target string - uses: mad9000/actions-find-and-replace-string@1 + uses: mad9000/actions-find-and-replace-string@3 id: findandreplace with: source: ${{ matrix.board.target }} @@ -81,7 +81,4 @@ jobs: echo "PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig" >> $GITHUB_ENV echo "CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc" >> $GITHUB_ENV fi - - uses: actions-rs/cargo@v1 - with: - command: ${{ matrix.job.cargo-command }} - args: ${{ matrix.job.args }} + - run: cargo ${{ matrix.job.cargo-command }} ${{ matrix.job.args }} From d80501e7f99bd7e83513739dcfd424287f6c4ab5 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 09:58:35 +0100 Subject: [PATCH 13/35] =?UTF-8?q?style:=20=F0=9F=9A=A8=20Fix=20clippy=20wa?= =?UTF-8?q?rning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/monitor/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/espflash/src/cli/monitor/mod.rs b/espflash/src/cli/monitor/mod.rs index 5910b966..b490a91a 100644 --- a/espflash/src/cli/monitor/mod.rs +++ b/espflash/src/cli/monitor/mod.rs @@ -256,7 +256,7 @@ fn handle_key_event(key_event: KeyEvent) -> Option> { if key_event.modifiers & KeyModifiers::CONTROL == KeyModifiers::CONTROL { buf[0] = ch as u8; - if ('a'..='z').contains(&ch) || (ch == ' ') { + if ch.is_ascii_lowercase() || (ch == ' ') { buf[0] &= 0x1f; Some(&buf[0..1]) } else if ('4'..='7').contains(&ch) { From aa8d25af94179a54c94764416ab93f4dd307bc92 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 10:09:26 +0100 Subject: [PATCH 14/35] =?UTF-8?q?docs:=20=F0=9F=8E=A8=20Fix=20links?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/espflash/README.md b/espflash/README.md index 5300f5b8..42eb4e60 100644 --- a/espflash/README.md +++ b/espflash/README.md @@ -42,8 +42,8 @@ If you would like to flash from a Raspberry Pi using the built-in UART periphera cargo install espflash --features=raspberry ``` -[libuv]: (https://libuv.org/) -[cargo-binstall]: (https://github.com/cargo-bins/cargo-binstall) +[libuv]: https://libuv.org/ +[cargo-binstall]: https://github.com/cargo-bins/cargo-binstall [releases]: https://github.com/esp-rs/espflash/releases ## Usage From 52c08dc7a428219c6d9a84c29a07d2537f2fbf08 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 10:09:41 +0100 Subject: [PATCH 15/35] =?UTF-8?q?build:=20=F0=9F=8E=A8=20Format=20includes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/serial.rs | 6 ++++-- espflash/src/flasher/stubs.rs | 1 - espflash/src/image_format/direct_boot.rs | 2 +- espflash/src/image_format/esp8266.rs | 8 ++++---- espflash/src/image_format/idf_bootloader.rs | 8 ++++---- espflash/src/image_format/mod.rs | 3 ++- espflash/src/targets/esp32.rs | 2 +- espflash/src/targets/esp32c2.rs | 2 +- espflash/src/targets/esp32c3.rs | 2 +- espflash/src/targets/esp32c6.rs | 2 +- espflash/src/targets/esp32s2.rs | 2 +- espflash/src/targets/esp32s3.rs | 2 +- espflash/src/targets/esp8266.rs | 2 +- espflash/src/targets/flash_target/esp32.rs | 2 +- espflash/src/targets/flash_target/esp8266.rs | 2 +- espflash/src/targets/flash_target/ram.rs | 2 +- 16 files changed, 25 insertions(+), 23 deletions(-) diff --git a/espflash/src/cli/serial.rs b/espflash/src/cli/serial.rs index 2eb04126..9a18d8cb 100644 --- a/espflash/src/cli/serial.rs +++ b/espflash/src/cli/serial.rs @@ -8,8 +8,10 @@ use log::{error, info}; use miette::{IntoDiagnostic, Result}; use serialport::{available_ports, SerialPortInfo, SerialPortType, UsbPortInfo}; -use super::{config::Config, ConnectArgs}; -use crate::{cli::config::UsbDevice, error::Error}; +use crate::{ + cli::{config::UsbDevice, Config, ConnectArgs}, + error::Error, +}; pub fn get_serial_port_info( matches: &ConnectArgs, diff --git a/espflash/src/flasher/stubs.rs b/espflash/src/flasher/stubs.rs index a226f3e8..c69920ad 100644 --- a/espflash/src/flasher/stubs.rs +++ b/espflash/src/flasher/stubs.rs @@ -19,7 +19,6 @@ pub struct FlashStub { } // Include stub objects in binary - const STUB_32: &str = include_str!("../../resources/stubs/stub_flasher_32.toml"); const STUB_32C2: &str = include_str!("../../resources/stubs/stub_flasher_32c2.toml"); const STUB_32C3: &str = include_str!("../../resources/stubs/stub_flasher_32c3.toml"); diff --git a/espflash/src/image_format/direct_boot.rs b/espflash/src/image_format/direct_boot.rs index 3c187394..f865aed0 100644 --- a/espflash/src/image_format/direct_boot.rs +++ b/espflash/src/image_format/direct_boot.rs @@ -1,9 +1,9 @@ use std::iter::once; -use super::ImageFormat; use crate::{ elf::{CodeSegment, FirmwareImage, RomSegment}, error::Error, + image_format::ImageFormat, }; const DIRECT_BOOT_MAGIC: &[u8] = &[0x1d, 0x04, 0xdb, 0xae, 0x1d, 0x04, 0xdb, 0xae]; diff --git a/espflash/src/image_format/esp8266.rs b/espflash/src/image_format/esp8266.rs index 71b277bb..1acae94e 100644 --- a/espflash/src/image_format/esp8266.rs +++ b/espflash/src/image_format/esp8266.rs @@ -2,14 +2,14 @@ use std::{borrow::Cow, io::Write, iter::once, mem::size_of}; use bytemuck::bytes_of; -use super::{ - encode_flash_frequency, update_checksum, EspCommonHeader, ImageFormat, SegmentHeader, - ESP_CHECKSUM_MAGIC, ESP_MAGIC, -}; use crate::{ elf::{CodeSegment, FirmwareImage, RomSegment}, error::Error, flasher::{FlashFrequency, FlashMode, FlashSize}, + image_format::{ + encode_flash_frequency, update_checksum, EspCommonHeader, ImageFormat, SegmentHeader, + ESP_CHECKSUM_MAGIC, ESP_MAGIC, + }, targets::Chip, }; diff --git a/espflash/src/image_format/idf_bootloader.rs b/espflash/src/image_format/idf_bootloader.rs index 6c48d02f..ad71cf30 100644 --- a/espflash/src/image_format/idf_bootloader.rs +++ b/espflash/src/image_format/idf_bootloader.rs @@ -4,14 +4,14 @@ use bytemuck::{bytes_of, from_bytes, Pod, Zeroable}; use esp_idf_part::{PartitionTable, Type}; use sha2::{Digest, Sha256}; -use super::{ - encode_flash_frequency, update_checksum, EspCommonHeader, ImageFormat, SegmentHeader, - ESP_CHECKSUM_MAGIC, ESP_MAGIC, WP_PIN_DISABLED, -}; use crate::{ elf::{CodeSegment, FirmwareImage, RomSegment}, error::Error, flasher::{FlashFrequency, FlashMode, FlashSize}, + image_format::{ + encode_flash_frequency, update_checksum, EspCommonHeader, ImageFormat, SegmentHeader, + ESP_CHECKSUM_MAGIC, ESP_MAGIC, WP_PIN_DISABLED, + }, targets::{Chip, Esp32Params}, }; diff --git a/espflash/src/image_format/mod.rs b/espflash/src/image_format/mod.rs index 256ba7ba..de715b7c 100644 --- a/espflash/src/image_format/mod.rs +++ b/espflash/src/image_format/mod.rs @@ -11,10 +11,11 @@ use bytemuck::{Pod, Zeroable}; use serde::Deserialize; use strum::{Display, EnumVariantNames, IntoStaticStr}; +use crate::{elf::RomSegment, error::Error, flasher::FlashFrequency, targets::Chip}; + pub use self::{ direct_boot::DirectBootFormat, esp8266::Esp8266Format, idf_bootloader::IdfBootloaderFormat, }; -use crate::{elf::RomSegment, error::Error, flasher::FlashFrequency, targets::Chip}; mod direct_boot; mod esp8266; diff --git a/espflash/src/targets/esp32.rs b/espflash/src/targets/esp32.rs index 24adc4e4..962bd591 100644 --- a/espflash/src/targets/esp32.rs +++ b/espflash/src/targets/esp32.rs @@ -2,13 +2,13 @@ use std::ops::Range; use esp_idf_part::PartitionTable; -use super::{bytes_to_mac_addr, Chip, Esp32Params, ReadEFuse, SpiRegisters, Target}; use crate::{ connection::Connection, elf::FirmwareImage, error::{Error, UnsupportedImageFormatError}, flasher::{FlashFrequency, FlashMode, FlashSize}, image_format::{IdfBootloaderFormat, ImageFormat, ImageFormatKind}, + targets::{bytes_to_mac_addr, Chip, Esp32Params, ReadEFuse, SpiRegisters, Target}, }; const CHIP_DETECT_MAGIC_VALUES: &[u32] = &[0x00f0_1d83]; diff --git a/espflash/src/targets/esp32c2.rs b/espflash/src/targets/esp32c2.rs index dc544d7e..03460387 100644 --- a/espflash/src/targets/esp32c2.rs +++ b/espflash/src/targets/esp32c2.rs @@ -2,13 +2,13 @@ use std::{collections::HashMap, ops::Range}; use esp_idf_part::PartitionTable; -use super::{bytes_to_mac_addr, Chip, Esp32Params, ReadEFuse, SpiRegisters, Target}; use crate::{ connection::Connection, elf::FirmwareImage, error::Error, flasher::{FlashFrequency, FlashMode, FlashSize}, image_format::{DirectBootFormat, IdfBootloaderFormat, ImageFormat, ImageFormatKind}, + targets::{bytes_to_mac_addr, Chip, Esp32Params, ReadEFuse, SpiRegisters, Target}, }; const CHIP_DETECT_MAGIC_VALUES: &[u32] = &[ diff --git a/espflash/src/targets/esp32c3.rs b/espflash/src/targets/esp32c3.rs index e2e6c628..512f9bf1 100644 --- a/espflash/src/targets/esp32c3.rs +++ b/espflash/src/targets/esp32c3.rs @@ -2,13 +2,13 @@ use std::ops::Range; use esp_idf_part::PartitionTable; -use super::{Chip, Esp32Params, ReadEFuse, SpiRegisters, Target}; use crate::{ connection::Connection, elf::FirmwareImage, error::{Error, UnsupportedImageFormatError}, flasher::{FlashFrequency, FlashMode, FlashSize}, image_format::{DirectBootFormat, IdfBootloaderFormat, ImageFormat, ImageFormatKind}, + targets::{Chip, Esp32Params, ReadEFuse, SpiRegisters, Target}, }; const CHIP_DETECT_MAGIC_VALUES: &[u32] = &[ diff --git a/espflash/src/targets/esp32c6.rs b/espflash/src/targets/esp32c6.rs index ebb84173..2d6d28be 100644 --- a/espflash/src/targets/esp32c6.rs +++ b/espflash/src/targets/esp32c6.rs @@ -2,13 +2,13 @@ use std::ops::Range; use esp_idf_part::PartitionTable; -use super::{Chip, Esp32Params, ReadEFuse, SpiRegisters, Target}; use crate::{ connection::Connection, elf::FirmwareImage, error::Error, flasher::{FlashFrequency, FlashMode, FlashSize}, image_format::{DirectBootFormat, IdfBootloaderFormat, ImageFormat, ImageFormatKind}, + targets::{Chip, Esp32Params, ReadEFuse, SpiRegisters, Target}, }; const CHIP_DETECT_MAGIC_VALUES: &[u32] = &[0x2CE0_806F]; diff --git a/espflash/src/targets/esp32s2.rs b/espflash/src/targets/esp32s2.rs index 33ee052c..f9df0f76 100644 --- a/espflash/src/targets/esp32s2.rs +++ b/espflash/src/targets/esp32s2.rs @@ -2,13 +2,13 @@ use std::ops::Range; use esp_idf_part::PartitionTable; -use super::{Chip, Esp32Params, ReadEFuse, SpiRegisters, Target, MAX_RAM_BLOCK_SIZE}; use crate::{ connection::Connection, elf::FirmwareImage, error::{Error, UnsupportedImageFormatError}, flasher::{FlashFrequency, FlashMode, FlashSize, FLASH_WRITE_SIZE}, image_format::{IdfBootloaderFormat, ImageFormat, ImageFormatKind}, + targets::{Chip, Esp32Params, ReadEFuse, SpiRegisters, Target, MAX_RAM_BLOCK_SIZE}, }; const CHIP_DETECT_MAGIC_VALUES: &[u32] = &[0x0000_07c6]; diff --git a/espflash/src/targets/esp32s3.rs b/espflash/src/targets/esp32s3.rs index 63bafe5d..b409e8e0 100644 --- a/espflash/src/targets/esp32s3.rs +++ b/espflash/src/targets/esp32s3.rs @@ -2,13 +2,13 @@ use std::ops::Range; use esp_idf_part::PartitionTable; -use super::{Chip, Esp32Params, ReadEFuse, SpiRegisters, Target}; use crate::{ connection::Connection, elf::FirmwareImage, error::Error, flasher::{FlashFrequency, FlashMode, FlashSize}, image_format::{DirectBootFormat, IdfBootloaderFormat, ImageFormat, ImageFormatKind}, + targets::{Chip, Esp32Params, ReadEFuse, SpiRegisters, Target}, }; const CHIP_DETECT_MAGIC_VALUES: &[u32] = &[0x9]; diff --git a/espflash/src/targets/esp8266.rs b/espflash/src/targets/esp8266.rs index 5e60ea65..c27dfb41 100644 --- a/espflash/src/targets/esp8266.rs +++ b/espflash/src/targets/esp8266.rs @@ -2,13 +2,13 @@ use std::ops::Range; use esp_idf_part::PartitionTable; -use super::{bytes_to_mac_addr, Chip, ReadEFuse, SpiRegisters, Target}; use crate::{ connection::Connection, elf::FirmwareImage, error::{Error, UnsupportedImageFormatError}, flasher::{FlashFrequency, FlashMode, FlashSize}, image_format::{Esp8266Format, ImageFormat, ImageFormatKind}, + targets::{bytes_to_mac_addr, Chip, ReadEFuse, SpiRegisters, Target}, }; const CHIP_DETECT_MAGIC_VALUES: &[u32] = &[0xfff0_c101]; diff --git a/espflash/src/targets/flash_target/esp32.rs b/espflash/src/targets/flash_target/esp32.rs index db0690e2..98796eb5 100644 --- a/espflash/src/targets/flash_target/esp32.rs +++ b/espflash/src/targets/flash_target/esp32.rs @@ -5,7 +5,6 @@ use flate2::{ Compression, }; -use super::FlashTarget; use crate::{ command::{Command, CommandType}, connection::{Connection, USB_SERIAL_JTAG_PID}, @@ -13,6 +12,7 @@ use crate::{ error::Error, flasher::{ProgressCallbacks, SpiAttachParams, FLASH_SECTOR_SIZE}, targets::Chip, + targets::FlashTarget, }; /// Applications running from an ESP32's (or variant's) flash diff --git a/espflash/src/targets/flash_target/esp8266.rs b/espflash/src/targets/flash_target/esp8266.rs index 2612ba0e..be2eec3d 100644 --- a/espflash/src/targets/flash_target/esp8266.rs +++ b/espflash/src/targets/flash_target/esp8266.rs @@ -1,10 +1,10 @@ -use super::FlashTarget; use crate::{ command::{Command, CommandType}, connection::Connection, elf::RomSegment, error::Error, flasher::{get_erase_size, ProgressCallbacks, FLASH_WRITE_SIZE}, + targets::FlashTarget, }; /// Applications running from an ESP8266's flash diff --git a/espflash/src/targets/flash_target/ram.rs b/espflash/src/targets/flash_target/ram.rs index 9113dede..21cdb9cb 100644 --- a/espflash/src/targets/flash_target/ram.rs +++ b/espflash/src/targets/flash_target/ram.rs @@ -1,12 +1,12 @@ use bytemuck::{Pod, Zeroable}; -use super::FlashTarget; use crate::{ command::{Command, CommandType}, connection::Connection, elf::RomSegment, error::Error, flasher::ProgressCallbacks, + targets::FlashTarget, }; pub(crate) const MAX_RAM_BLOCK_SIZE: usize = 0x1800; From 16647c68e600932fcd60f18dc990d6ced97335e0 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 10:10:50 +0100 Subject: [PATCH 16/35] =?UTF-8?q?style:=20=F0=9F=8E=A8=20Sort=20dependenci?= =?UTF-8?q?es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/espflash/Cargo.toml b/espflash/Cargo.toml index e935a8c5..d54ec908 100644 --- a/espflash/Cargo.toml +++ b/espflash/Cargo.toml @@ -44,8 +44,8 @@ comfy-table = { version = "6.1.4", optional = true } crossterm = { version = "0.25.0", optional = true } dialoguer = { version = "0.10.2", optional = true } directories-next = { version = "2.0.0", optional = true } -esp-idf-part = "0.1.2" env_logger = { version = "0.10.0", optional = true } +esp-idf-part = "0.1.2" flate2 = "1.0.25" indicatif = { version = "0.17.2", optional = true } lazy_static = { version = "1.4.0", optional = true } From 8220c00889944747f7faecca2d12183d8f0539b2 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 10:14:52 +0100 Subject: [PATCH 17/35] =?UTF-8?q?build:=20=E2=AC=86=EF=B8=8F=20Bump=20depe?= =?UTF-8?q?ndencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 106 +++++++++++++++++++++++++++++++++++++++++--- espflash/Cargo.toml | 37 ++++++++-------- 2 files changed, 119 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bad41ea3..8554bc0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -84,6 +84,15 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" +[[package]] +name = "atomic-polyfill" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ff7eb3f316534d83a8a2c3d1674ace8a5a71198eba31e2e2b597833f699b28" +dependencies = [ + "critical-section", +] + [[package]] name = "atty" version = "0.2.14" @@ -234,6 +243,12 @@ dependencies = [ "syn", ] +[[package]] +name = "byteorder" +version = "1.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" + [[package]] name = "bytes" version = "1.3.0" @@ -323,7 +338,7 @@ dependencies = [ "cargo_metadata", "clap 4.0.32", "env_logger 0.10.0", - "esp-idf-part", + "esp-idf-part 0.1.2", "espflash", "log", "miette", @@ -469,7 +484,7 @@ version = "6.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e7b787b0dc42e8111badfdbe4c3059158ccb2db8780352fa1b01e8ccf45cc4d" dependencies = [ - "crossterm", + "crossterm 0.25.0", "strum", "strum_macros", "unicode-width", @@ -563,6 +578,12 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "critical-section" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6548a0ad5d2549e111e1f6a11a6c2e2d00ce6a3dafe22948d67c2b443f775e52" + [[package]] name = "crossterm" version = "0.25.0" @@ -579,6 +600,22 @@ dependencies = [ "winapi", ] +[[package]] +name = "crossterm" +version = "0.26.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a84cda67535339806297f1b331d6dd6320470d2a0fe65381e79ee9e156dd3d13" +dependencies = [ + "bitflags", + "crossterm_winapi", + "libc", + "mio", + "parking_lot", + "signal-hook", + "signal-hook-mio", + "winapi", +] + [[package]] name = "crossterm_winapi" version = "0.9.0" @@ -859,6 +896,24 @@ dependencies = [ "thiserror", ] +[[package]] +name = "esp-idf-part" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f47dd277680b17e865d133dcdefefa400f75c7dac41d54a8b788509a4e9b7a14" +dependencies = [ + "csv", + "deku", + "heapless", + "md5", + "parse_int", + "regex", + "serde", + "serde_plain", + "strum", + "thiserror", +] + [[package]] name = "espflash" version = "2.0.0-rc.3" @@ -869,11 +924,11 @@ dependencies = [ "bytemuck", "clap 4.0.32", "comfy-table", - "crossterm", + "crossterm 0.26.1", "dialoguer", "directories-next", "env_logger 0.10.0", - "esp-idf-part", + "esp-idf-part 0.3.0", "flate2", "indicatif", "lazy_static", @@ -1055,6 +1110,15 @@ dependencies = [ "regex", ] +[[package]] +name = "hash32" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c35f58762feb77d74ebe43bdbc3210f09be9fe6742234d573bacc26ed92b67" +dependencies = [ + "byteorder", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1064,6 +1128,20 @@ dependencies = [ "ahash", ] +[[package]] +name = "heapless" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" +dependencies = [ + "atomic-polyfill", + "hash32", + "rustc_version", + "serde", + "spin 0.9.6", + "stable_deref_trait", +] + [[package]] name = "heck" version = "0.4.0" @@ -1806,7 +1884,7 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", + "spin 0.5.2", "untrusted", "web-sys", "winapi", @@ -1833,6 +1911,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc71d2faa173b74b232dedc235e3ee1696581bb132fc116fa3626d6151a1a8fb" +[[package]] +name = "rustc_version" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +dependencies = [ + "semver", +] + [[package]] name = "rustfix" version = "0.6.1" @@ -2103,6 +2190,15 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5d6e0250b93c8427a177b849d144a96d5acc57006149479403d7861ab721e34" +dependencies = [ + "lock_api", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" diff --git a/espflash/Cargo.toml b/espflash/Cargo.toml index d54ec908..5a7339fd 100644 --- a/espflash/Cargo.toml +++ b/espflash/Cargo.toml @@ -1,25 +1,14 @@ [package] name = "espflash" version = "2.0.0-rc.3" -authors = [ - "Robin Appelman ", - "Jesse Braham ", -] +authors = ["Robin Appelman ", "Jesse Braham "] edition = "2021" rust-version = "1.63" description = "A command-line tool for flashing Espressif devices over serial" repository = "https://github.com/esp-rs/espflash" license = "MIT OR Apache-2.0" -keywords = [ - "cli", - "embedded", - "esp", -] -categories = [ - "command-line-utilities", - "development-tools", - "embedded", -] +keywords = ["cli", "embedded", "esp"] +categories = ["command-line-utilities", "development-tools", "embedded"] [package.metadata.binstall] pkg-url = "{ repo }/releases/download/v{ version }/{ name }-{ target }.{ archive-format }" @@ -41,11 +30,11 @@ binread = "2.2.0" bytemuck = { version = "1.12.3", features = ["derive"] } clap = { version = "4.0.32", features = ["derive", "env"], optional = true } comfy-table = { version = "6.1.4", optional = true } -crossterm = { version = "0.25.0", optional = true } +crossterm = { version = "0.26.1", optional = true } dialoguer = { version = "0.10.2", optional = true } directories-next = { version = "2.0.0", optional = true } env_logger = { version = "0.10.0", optional = true } -esp-idf-part = "0.1.2" +esp-idf-part = "0.3.0" flate2 = "1.0.25" indicatif = { version = "0.17.2", optional = true } lazy_static = { version = "1.4.0", optional = true } @@ -68,8 +57,18 @@ xmas-elf = "0.9.0" [features] default = ["cli"] cli = [ - "dep:addr2line", "dep:clap", "dep:comfy-table", "dep:crossterm", "dep:dialoguer", - "dep:directories-next", "dep:env_logger", "dep:indicatif", "dep:lazy_static", - "dep:parse_int", "dep:regex", "dep:serde-hex", "dep:update-informer" + "dep:addr2line", + "dep:clap", + "dep:comfy-table", + "dep:crossterm", + "dep:dialoguer", + "dep:directories-next", + "dep:env_logger", + "dep:indicatif", + "dep:lazy_static", + "dep:parse_int", + "dep:regex", + "dep:serde-hex", + "dep:update-informer", ] raspberry = ["dep:rppal"] From d55596c9b03d8279dbb0192cd669d9d4dc269a54 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 10:17:23 +0100 Subject: [PATCH 18/35] =?UTF-8?q?build:=20=E2=AC=86=EF=B8=8F=20Bump=20depe?= =?UTF-8?q?ndencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 547 +++++++++++++++++++++++++++++--------- cargo-espflash/Cargo.toml | 16 +- 2 files changed, 431 insertions(+), 132 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8554bc0f..3e51e04d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,6 +125,12 @@ dependencies = [ "rustc-demangle", ] +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.13.1" @@ -137,6 +143,12 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + [[package]] name = "binread" version = "2.2.0" @@ -272,20 +284,20 @@ dependencies = [ [[package]] name = "cargo" -version = "0.66.0" +version = "0.69.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cbff5076ff17b84f81946ca2d5536e60bfa2344cd365efb57c19fd808a17640" +checksum = "1fdc51fbabb210bf9bb6ad6127a647cd6c96fb0f0ce6877fdabc6043d3013fe6" dependencies = [ "anyhow", - "atty", + "base64 0.13.1", "bytesize", "cargo-platform", "cargo-util", - "clap 3.2.23", + "clap", "crates-io", "curl", "curl-sys", - "env_logger 0.9.3", + "env_logger", "filetime", "flate2", "fwdansi", @@ -293,11 +305,14 @@ dependencies = [ "git2-curl", "glob", "hex 0.4.3", + "hmac", "home", + "http-auth", "humantime", "ignore", "im-rc", "indexmap", + "is-terminal", "itertools", "jobserver", "lazy_static", @@ -309,19 +324,23 @@ dependencies = [ "opener", "openssl", "os_info", + "pasetors", "pathdiff", "percent-encoding", "rustc-workspace-hack", "rustfix", "semver", "serde", + "serde-value", "serde_ignored", "serde_json", + "sha1", "shell-escape", "strip-ansi-escapes", "tar", "tempfile", "termcolor", + "time", "toml_edit", "unicode-width", "unicode-xid", @@ -336,9 +355,9 @@ version = "2.0.0-rc.3" dependencies = [ "cargo", "cargo_metadata", - "clap 4.0.32", - "env_logger 0.10.0", - "esp-idf-part 0.1.2", + "clap", + "env_logger", + "esp-idf-part", "espflash", "log", "miette", @@ -358,9 +377,9 @@ dependencies = [ [[package]] name = "cargo-util" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75f6bfca7b85d6e8c6a42405e9b4ecadd2e63f75f94aabfb524378b57a557a4" +checksum = "e4e0cd00582e110eb8d99de768521d36fce9e24a286babf3cea68824ae09948f" dependencies = [ "anyhow", "core-foundation", @@ -409,28 +428,13 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clap" -version = "3.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" -dependencies = [ - "atty", - "bitflags", - "clap_lex 0.2.4", - "indexmap", - "strsim", - "termcolor", - "textwrap 0.16.0", -] - -[[package]] -name = "clap" -version = "4.0.32" +version = "4.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39" +checksum = "ce38afc168d8665cfc75c7b1dd9672e50716a137f433f070991619744a67342a" dependencies = [ "bitflags", "clap_derive", - "clap_lex 0.3.0", + "clap_lex", "is-terminal", "once_cell", "strsim", @@ -439,9 +443,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.0.21" +version = "4.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" +checksum = "fddf67631444a3a3e3e5ac51c36a5e01335302de677bd78759eaa90ab1f46644" dependencies = [ "heck", "proc-macro-error", @@ -450,15 +454,6 @@ dependencies = [ "syn", ] -[[package]] -name = "clap_lex" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" -dependencies = [ - "os_str_bytes", -] - [[package]] name = "clap_lex" version = "0.3.0" @@ -518,9 +513,15 @@ dependencies = [ "lazy_static", "libc", "unicode-width", - "windows-sys", + "windows-sys 0.42.0", ] +[[package]] +name = "const-oid" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" + [[package]] name = "core-foundation" version = "0.9.3" @@ -557,9 +558,9 @@ dependencies = [ [[package]] name = "crates-io" -version = "0.34.0" +version = "0.35.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4a87459133b2e708195eaab34be55039bc30e0d120658bd40794bb00b6328d" +checksum = "e2dfb6077da60207264ab2eb0e3734f02e0a0c50c347b32c728e42c6fbbf7e2e" dependencies = [ "anyhow", "curl", @@ -625,6 +626,18 @@ dependencies = [ "winapi", ] +[[package]] +name = "crypto-bigint" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c2538c4e68e52548bacb3e83ac549f903d44f011ac9d5abb5e132e67d0808f7" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -669,6 +682,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "ct-codecs" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3b7eb4404b8195a9abb6356f4ac07d8ba267045c8d6d220ac4dc992e6cc75df" + [[package]] name = "curl" version = "0.4.44" @@ -758,6 +777,17 @@ dependencies = [ "syn", ] +[[package]] +name = "der" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc906908ea6458456e5eaa160a9c08543ec3d1e6f71e2235cedd660cb65f9df0" +dependencies = [ + "const-oid", + "pem-rfc7468", + "zeroize", +] + [[package]] name = "dialoguer" version = "0.10.2" @@ -777,6 +807,7 @@ checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer", "crypto-common", + "subtle", ] [[package]] @@ -820,6 +851,27 @@ dependencies = [ "winapi", ] +[[package]] +name = "ecdsa" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1b0a1222f8072619e8a6b667a854020a03d363738303203c09468b3424a420a" +dependencies = [ + "der", + "elliptic-curve", + "rfc6979", + "signature", +] + +[[package]] +name = "ed25519-compact" +version = "2.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a3d382e8464107391c8706b4c14b087808ecb909f6c15c34114bc42e53a9e4c" +dependencies = [ + "getrandom", +] + [[package]] name = "either" version = "1.8.0" @@ -827,23 +879,31 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" [[package]] -name = "encode_unicode" -version = "0.3.6" +name = "elliptic-curve" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +checksum = "6ea5a92946e8614bb585254898bb7dd1ddad241ace60c52149e3765e34cc039d" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "hkdf", + "pem-rfc7468", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] [[package]] -name = "env_logger" -version = "0.9.3" +name = "encode_unicode" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] +checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" [[package]] name = "env_logger" @@ -879,23 +939,6 @@ dependencies = [ "libc", ] -[[package]] -name = "esp-idf-part" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fa758fff38bcfb58c48193bc5329165a8268c864540b7904f2e854da09342f6" -dependencies = [ - "csv", - "deku", - "md5", - "parse_int", - "regex", - "serde", - "serde_plain", - "strum", - "thiserror", -] - [[package]] name = "esp-idf-part" version = "0.3.0" @@ -922,13 +965,13 @@ dependencies = [ "base64 0.21.0", "binread", "bytemuck", - "clap 4.0.32", + "clap", "comfy-table", "crossterm 0.26.1", "dialoguer", "directories-next", - "env_logger 0.10.0", - "esp-idf-part 0.3.0", + "env_logger", + "esp-idf-part", "flate2", "indicatif", "lazy_static", @@ -964,6 +1007,22 @@ dependencies = [ "instant", ] +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93ace6ec7cc19c8ed33a32eaa9ea692d7faea05006b5356b9e2b668ec4bc3955" + [[package]] name = "filetime" version = "0.2.19" @@ -973,7 +1032,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -1041,6 +1100,7 @@ checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -1050,8 +1110,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -1066,9 +1128,9 @@ dependencies = [ [[package]] name = "git2" -version = "0.15.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2994bee4a3a6a51eb90c218523be382fd7ea09b16380b9312e9dbe955ff7c7d1" +checksum = "be36bc9e0546df253c0cc41fd0af34f5e92845ad8509462ec76672fac6997f5b" dependencies = [ "bitflags", "libc", @@ -1081,9 +1143,9 @@ dependencies = [ [[package]] name = "git2-curl" -version = "0.16.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed817a00721e2f8037ba722e60358d4956dae9cca10315fc982f967907d3b0cd" +checksum = "7577f4e6341ba7c90d883511130a45b956c274ba5f4d205d9f9da990f654cd33" dependencies = [ "curl", "git2", @@ -1110,6 +1172,17 @@ dependencies = [ "regex", ] +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + [[package]] name = "hash32" version = "0.2.1" @@ -1159,12 +1232,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.2.6" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" [[package]] name = "hex" @@ -1178,6 +1248,24 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hkdf" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + [[package]] name = "home" version = "0.5.4" @@ -1187,6 +1275,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "http-auth" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5430cacd7a1f9a02fbeb350dfc81a0e5ed42d81f3398cb0ba184017f85bdcfbc" +dependencies = [ + "memchr", +] + [[package]] name = "humantime" version = "2.1.0" @@ -1278,19 +1375,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] name = "is-terminal" -version = "0.4.2" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" +checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -1511,7 +1608,7 @@ dependencies = [ "supports-hyperlinks", "supports-unicode", "terminal_size", - "textwrap 0.15.2", + "textwrap", "thiserror", "unicode-width", ] @@ -1545,16 +1642,16 @@ dependencies = [ "libc", "log", "wasi", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] name = "miow" -version = "0.3.7" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" +checksum = "52ffbca2f655e33c08be35d87278e5b18b89550a37dbd598c20db92f6a471123" dependencies = [ - "winapi", + "windows-sys 0.42.0", ] [[package]] @@ -1670,6 +1767,26 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "ordered-float" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" +dependencies = [ + "num-traits", +] + +[[package]] +name = "orion" +version = "0.17.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cbe74a766292f94f7e69db5a7bf010eadd944f24186c463fe578a7e637582066" +dependencies = [ + "fiat-crypto", + "subtle", + "zeroize", +] + [[package]] name = "os_info" version = "3.5.1" @@ -1693,6 +1810,18 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +[[package]] +name = "p384" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + [[package]] name = "parking_lot" version = "0.12.1" @@ -1713,7 +1842,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec 1.10.0", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -1725,18 +1854,58 @@ dependencies = [ "num-traits", ] +[[package]] +name = "pasetors" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824bf633b85dc1dece2eb07161627ba5d90a951597cd5dbf8d85f4d82b7aea69" +dependencies = [ + "ct-codecs", + "ed25519-compact", + "getrandom", + "orion", + "p384", + "rand_core", + "regex", + "serde", + "serde_json", + "sha2", + "subtle", + "time", + "zeroize", +] + [[package]] name = "pathdiff" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +[[package]] +name = "pem-rfc7468" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" +dependencies = [ + "base64ct", +] + [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +[[package]] +name = "pkcs8" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d2820d87d2b008616e5c27212dd9e0e694fb4c6b522de06094106813328cb49" +dependencies = [ + "der", + "spki", +] + [[package]] name = "pkg-config" version = "0.3.26" @@ -1749,6 +1918,15 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26f6a7b87c2e435a3241addceeeff740ff8b7e76b74c13bf9acb17fa454ea00b" +[[package]] +name = "primeorder" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7613fdcc0831c10060fa69833ea8fa2caa94b6456f51e25356a885b530a2e3d0" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro-crate" version = "1.2.1" @@ -1813,6 +1991,9 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] [[package]] name = "rand_xoshiro" @@ -1875,6 +2056,16 @@ dependencies = [ "winapi", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "ring" version = "0.16.20" @@ -1943,7 +2134,7 @@ dependencies = [ "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -1985,7 +2176,7 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -2004,6 +2195,20 @@ dependencies = [ "untrusted", ] +[[package]] +name = "sec1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48518a2b5775ba8ca5b46596aae011caa431e6ce7e4a67ead66d92f08884220e" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + [[package]] name = "semver" version = "1.0.16" @@ -2033,6 +2238,16 @@ dependencies = [ "smallvec 0.6.14", ] +[[package]] +name = "serde-value" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" +dependencies = [ + "ordered-float", + "serde", +] + [[package]] name = "serde_derive" version = "1.0.152" @@ -2090,6 +2305,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "sha1" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + [[package]] name = "sha2" version = "0.10.6" @@ -2137,6 +2363,16 @@ dependencies = [ "libc", ] +[[package]] +name = "signature" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fe458c98333f9c8152221191a77e2a44e8325d0193484af2e9421a53019e57d" +dependencies = [ + "digest", + "rand_core", +] + [[package]] name = "sized-chunks" version = "0.6.5" @@ -2199,6 +2435,16 @@ dependencies = [ "lock_api", ] +[[package]] +name = "spki" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0445c905640145c7ea8c1993555957f65e7c46d0535b91ba501bc9bfc85522f" +dependencies = [ + "base64ct", + "der", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -2248,6 +2494,12 @@ dependencies = [ "syn", ] +[[package]] +name = "subtle" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" + [[package]] name = "supports-color" version = "1.3.1" @@ -2347,12 +2599,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - [[package]] name = "thiserror" version = "1.0.38" @@ -2382,6 +2628,33 @@ dependencies = [ "once_cell", ] +[[package]] +name = "time" +version = "0.3.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" +dependencies = [ + "itoa 1.0.5", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" + +[[package]] +name = "time-macros" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" +dependencies = [ + "time-core", +] + [[package]] name = "tinyvec" version = "1.6.0" @@ -2406,17 +2679,27 @@ dependencies = [ "serde", ] +[[package]] +name = "toml_datetime" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" +dependencies = [ + "serde", +] + [[package]] name = "toml_edit" -version = "0.14.4" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5376256e44f2443f8896ac012507c19a012df0fe8758b55246ae51a2279db51f" +checksum = "b1541ba70885967e662f69d31ab3aeca7b1aaecfcd58679590b893e9239c3646" dependencies = [ "combine", "indexmap", "itertools", "kstring", "serde", + "toml_datetime", ] [[package]] @@ -2701,47 +2984,71 @@ dependencies = [ "windows_x86_64_msvc", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_msvc" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_i686_gnu" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_msvc" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_x86_64_gnu" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_msvc" -version = "0.42.0" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "wyz" diff --git a/cargo-espflash/Cargo.toml b/cargo-espflash/Cargo.toml index accdbcbc..6c906238 100644 --- a/cargo-espflash/Cargo.toml +++ b/cargo-espflash/Cargo.toml @@ -1,21 +1,13 @@ [package] name = "cargo-espflash" version = "2.0.0-rc.3" -authors = [ - "Robin Appelman ", - "Jesse Braham ", -] +authors = ["Robin Appelman ", "Jesse Braham "] edition = "2021" rust-version = "1.63" description = "Cargo subcommand for flashing Espressif devices over serial" repository = "https://github.com/esp-rs/espflash" license = "MIT OR Apache-2.0" -keywords = [ - "cargo", - "cli", - "embedded", - "esp", -] +keywords = ["cargo", "cli", "embedded", "esp"] categories = [ "command-line-utilities", "development-tools", @@ -29,11 +21,11 @@ bin-dir = "{ bin }{ binary-ext }" pkg-fmt = "zip" [dependencies] -cargo = { version = "0.66.0", features = ["vendored-openssl"] } +cargo = { version = "0.69.0", features = ["vendored-openssl"] } cargo_metadata = "0.15.2" clap = { version = "4.0.32", features = ["derive"] } env_logger = "0.10.0" -esp-idf-part = "0.1.2" +esp-idf-part = "0.3.0" espflash = { version = "=2.0.0-rc.3", path = "../espflash" } log = "0.4.17" miette = { version = "5.5.0", features = ["fancy"] } From d24c5d5dd682016d5ced53047d04e5dfaf9353f4 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 10:22:40 +0100 Subject: [PATCH 19/35] =?UTF-8?q?ci:=20=E2=9A=A1=EF=B8=8F=20Fail=20if=20th?= =?UTF-8?q?ere=20is=20a=20clippy=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c5acd205..cb40c1e9 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -103,4 +103,4 @@ jobs: components: clippy - uses: Swatinem/rust-cache@v2 # `too_many_arguments` is relatively arbitrary - - run: cargo clippy -- -A clippy::too_many_arguments + - run: cargo clippy -- -A clippy::too_many_arguments -D warnings From edf8e8897b053343c93d8f976489786405e4f3b7 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 10:31:10 +0100 Subject: [PATCH 20/35] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Remove=20docstring?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cargo-espflash/src/main.rs | 2 -- espflash/src/bin/espflash.rs | 2 -- 2 files changed, 4 deletions(-) diff --git a/cargo-espflash/src/main.rs b/cargo-espflash/src/main.rs index 934cc8bc..899a757b 100644 --- a/cargo-espflash/src/main.rs +++ b/cargo-espflash/src/main.rs @@ -49,9 +49,7 @@ enum CargoSubcommand { #[derive(Debug, Subcommand)] enum Commands { - /// Display information about the connected board and exit without flashing BoardInfo(ConnectArgs), - /// Flash an application to a target device Flash(FlashArgs), Monitor(MonitorArgs), PartitionTable(PartitionTableArgs), diff --git a/espflash/src/bin/espflash.rs b/espflash/src/bin/espflash.rs index 78b250ae..5650caa6 100644 --- a/espflash/src/bin/espflash.rs +++ b/espflash/src/bin/espflash.rs @@ -30,9 +30,7 @@ struct Cli { #[derive(Debug, Subcommand)] enum Commands { - /// Display information about the connected board and exit without flashing BoardInfo(ConnectArgs), - /// Flash an application to a target device Flash(FlashArgs), Monitor(MonitorArgs), PartitionTable(PartitionTableArgs), From b0c8c472e0318b9d6a7b1c9bca2ad894c5b5ed5b Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 10:41:12 +0100 Subject: [PATCH 21/35] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Update=20docstring?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/bin/espflash.rs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/espflash/src/bin/espflash.rs b/espflash/src/bin/espflash.rs index 5650caa6..6ecb1436 100644 --- a/espflash/src/bin/espflash.rs +++ b/espflash/src/bin/espflash.rs @@ -40,30 +40,32 @@ enum Commands { #[derive(Debug, Args)] struct FlashArgs { - /// ELF image to flash - image: PathBuf, - + /// Connection configuration #[clap(flatten)] connect_args: ConnectArgs, + /// Flashing configuration #[clap(flatten)] pub flash_config_args: FlashConfigArgs, + /// Flashing arguments #[clap(flatten)] flash_args: cli::FlashArgs, + /// ELF image to flash + image: PathBuf, } #[derive(Debug, Args)] struct SaveImageArgs { + /// ELF image to flash + image: PathBuf, /// Image format to flash #[arg(long, value_enum)] format: Option, - + /// Flashing configuration #[clap(flatten)] pub flash_config_args: FlashConfigArgs, + /// Sage image arguments #[clap(flatten)] save_image_args: cli::SaveImageArgs, - - /// ELF image to flash - image: PathBuf, } /// Writes a binary file to a specific address in the chip's flash @@ -74,11 +76,12 @@ struct WriteBinArgs { pub addr: u32, /// File containing the binary data to write pub bin_file: String, - + /// Connection configuration #[clap(flatten)] connect_args: ConnectArgs, } +/// Parses a string as a 32-bit unsigned integer. fn parse_uint32(input: &str) -> Result { parse_int::parse(input) } From d775e22cb53bd68b43546509a4dd2ba79df2bbbd Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 10:56:59 +0100 Subject: [PATCH 22/35] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Update=20monitor?= =?UTF-8?q?=20docstrings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/monitor/mod.rs | 1 + espflash/src/cli/monitor/symbols.rs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/espflash/src/cli/monitor/mod.rs b/espflash/src/cli/monitor/mod.rs index b490a91a..76505ca7 100644 --- a/espflash/src/cli/monitor/mod.rs +++ b/espflash/src/cli/monitor/mod.rs @@ -140,6 +140,7 @@ pub fn monitor( Ok(()) } +/// Handles and writes the received serial data to the given output stream. fn handle_serial(ctx: &mut SerialContext, buff: &[u8], out: &mut dyn Write) { let text: Vec = normalized(buff.iter().copied()).collect(); let text = String::from_utf8_lossy(&text).to_string(); diff --git a/espflash/src/cli/monitor/symbols.rs b/espflash/src/cli/monitor/symbols.rs index f5a54edf..5df4206a 100644 --- a/espflash/src/cli/monitor/symbols.rs +++ b/espflash/src/cli/monitor/symbols.rs @@ -18,7 +18,7 @@ impl<'sym> Symbols<'sym> { Ok(Self { file, ctx }) } - + /// Returns the name of the function at the given address, if one can be found. pub fn get_name(&self, addr: u64) -> Option { // The basic steps here are: // 1. find which frame `addr` is in @@ -44,6 +44,7 @@ impl<'sym> Symbols<'sym> { }) } + /// Returns the file name and line number of the function at the given address, if one can be. pub fn get_location(&self, addr: u64) -> Option<(String, u32)> { // Find the location which `addr` is in. If we can dedetermine a file name and // line number for this function we will return them both in a tuple. From b6855489fcb2fa368a969caec8a965d080a00772 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 11:05:59 +0100 Subject: [PATCH 23/35] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Update=20monitor?= =?UTF-8?q?=20docstrings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/monitor/mod.rs | 2 ++ espflash/src/cli/monitor/symbols.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/espflash/src/cli/monitor/mod.rs b/espflash/src/cli/monitor/mod.rs index 76505ca7..c442f5de 100644 --- a/espflash/src/cli/monitor/mod.rs +++ b/espflash/src/cli/monitor/mod.rs @@ -37,6 +37,7 @@ lazy_static! { static ref RE_FN_ADDR: Regex = Regex::new(r"0x[[:xdigit:]]{8}").unwrap(); } +/// Context for the serial monitor #[derive(Default)] struct SerialContext<'ctx> { symbols: Option>, @@ -53,6 +54,7 @@ impl<'ctx> SerialContext<'ctx> { } } +/// Type that ensures that raw mode is disabled when dropped. struct RawModeGuard; impl RawModeGuard { diff --git a/espflash/src/cli/monitor/symbols.rs b/espflash/src/cli/monitor/symbols.rs index 5df4206a..a34f975e 100644 --- a/espflash/src/cli/monitor/symbols.rs +++ b/espflash/src/cli/monitor/symbols.rs @@ -6,6 +6,8 @@ use addr2line::{ Context, }; +// Wrapper around addr2line that allows to look up function names and +// locations from a given address. pub(crate) struct Symbols<'sym> { file: File<'sym, &'sym [u8]>, ctx: Context>, From 77520a7eff9e05546778aadedcff7fadf5e476c1 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 11:08:47 +0100 Subject: [PATCH 24/35] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Update=20config=20?= =?UTF-8?q?docstrings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/config.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/espflash/src/cli/config.rs b/espflash/src/cli/config.rs index ee5ece15..481e2e91 100644 --- a/espflash/src/cli/config.rs +++ b/espflash/src/cli/config.rs @@ -43,6 +43,7 @@ pub struct UsbDevice { } impl UsbDevice { + /// Check if the given USB port matches this device pub fn matches(&self, port: &UsbPortInfo) -> bool { self.vid == port.vid && self.pid == port.pid } @@ -57,6 +58,7 @@ pub struct Config { /// Preferred USB devices #[serde(default)] pub usb_device: Vec, + /// Path of the file to save the config to #[serde(skip)] save_path: PathBuf, } @@ -76,6 +78,7 @@ impl Config { Ok(config) } + /// Save the config to the config file pub fn save_with(&self, modify_fn: F) -> Result<()> { let mut copy = self.clone(); modify_fn(&mut copy); From 4d73b865b51c11017503ae462eb9946bbe60c881 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 11:25:52 +0100 Subject: [PATCH 25/35] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Update=20cli=20mod?= =?UTF-8?q?=20docstrings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/mod.rs | 7 +++++++ espflash/src/cli/serial.rs | 15 ++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/espflash/src/cli/mod.rs b/espflash/src/cli/mod.rs index 0bd8be0f..5dc5836e 100644 --- a/espflash/src/cli/mod.rs +++ b/espflash/src/cli/mod.rs @@ -160,6 +160,7 @@ pub struct MonitorArgs { /// Optional file name of the ELF image to load the symbols from #[arg(short = 'e', long, value_name = "FILE")] elf: Option, + /// Connection configuration #[clap(flatten)] connect_args: ConnectArgs, } @@ -389,6 +390,7 @@ pub fn save_elf_as_image( Ok(()) } +/// Displays the image or app size pub(crate) fn display_image_size(app_size: u32, part_size: Option) { if let Some(part_size) = part_size { let percent = app_size as f32 / part_size as f32 * 100.0; @@ -410,6 +412,7 @@ pub struct EspflashProgress { } impl ProgressCallbacks for EspflashProgress { + /// Initialize the progress bar fn init(&mut self, addr: u32, len: usize) { let pb = ProgressBar::new(len as u64) .with_message(format!("{addr:#X}")) @@ -423,12 +426,14 @@ impl ProgressCallbacks for EspflashProgress { self.pb = Some(pb); } + /// Update the progress bar fn update(&mut self, current: usize) { if let Some(ref pb) = self.pb { pb.set_position(current as u64); } } + /// End the progress bar fn finish(&mut self) { if let Some(ref pb) = self.pb { pb.finish(); @@ -538,6 +543,7 @@ pub fn erase_partitions( Ok(()) } +/// Erase a single partition fn erase_partition(flasher: &mut Flasher, part: &Partition) -> Result<()> { log::info!("Erasing {} ({:?})...", part.name(), part.subtype()); @@ -586,6 +592,7 @@ pub fn partition_table(args: PartitionTableArgs) -> Result<()> { Ok(()) } +/// Pretty print a partition table fn pretty_print(table: PartitionTable) { let mut pretty = Table::new(); diff --git a/espflash/src/cli/serial.rs b/espflash/src/cli/serial.rs index 9a18d8cb..2024ada7 100644 --- a/espflash/src/cli/serial.rs +++ b/espflash/src/cli/serial.rs @@ -13,6 +13,8 @@ use crate::{ error::Error, }; +/// Return the information of a serial port taking into account the different +/// ways of choosing a port. pub fn get_serial_port_info( matches: &ConnectArgs, config: &Config, @@ -87,7 +89,7 @@ fn find_serial_port(ports: &[SerialPortInfo], name: &str) -> Result Result> { let ports = ports .into_iter() .filter_map(|port_info| { - // with musl, the paths we get are `/sys/class/tty/*` + // With musl, the paths we get are `/sys/class/tty/*` let path = PathBuf::from(&port_info.port_name); - // this will give something like: + // This will give something like: // `/sys/devices/pci0000:00/0000:00:07.1/0000:0c:00.3/usb5/5-3/5-3.1/5-3.1:1.0/ttyUSB0/tty/ttyUSB0` let mut parent_dev = path.canonicalize().ok()?; - // walk up 3 dirs to get to the device hosting the tty: + // Walk up 3 dirs to get to the device hosting the tty: // `/sys/devices/pci0000:00/0000:00:07.1/0000:0c:00.3/usb5/5-3/5-3.1/5-3.1:1.0` parent_dev.pop(); parent_dev.pop(); parent_dev.pop(); - // check that the device is using the usb subsystem + // Check that the device is using the usb subsystem read_link(parent_dev.join("subsystem")) .ok() .filter(|subsystem| subsystem.ends_with("usb"))?; @@ -145,6 +147,7 @@ fn detect_usb_serial_ports() -> Result> { Ok(ports) } +/// Returns a vector with available USB serial ports. #[cfg(not(all(target_os = "linux", target_env = "musl")))] fn detect_usb_serial_ports() -> Result> { let ports = available_ports().into_diagnostic()?; @@ -178,6 +181,7 @@ const KNOWN_DEVICES: &[UsbDevice] = &[ }, // QinHeng Electronics CH340 serial converter ]; +/// Ask the user to select a serial port from a list of detected serial ports. fn select_serial_port( mut ports: Vec, config: &Config, @@ -280,6 +284,7 @@ fn select_serial_port( } } +/// Ask the user to confirm the use of a serial port. fn confirm_port(port_name: &str, port_info: &UsbPortInfo) -> Result { Confirm::with_theme(&ColorfulTheme::default()) .with_prompt({ From a19879072781e3dca034d1ddb50cb4535f2303fc Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 12:53:17 +0100 Subject: [PATCH 26/35] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Update=20docstring?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/command.rs | 10 ++++++++++ espflash/src/connection.rs | 17 +++++++++++++++++ espflash/src/elf.rs | 3 +++ espflash/src/error.rs | 3 +++ espflash/src/flasher/mod.rs | 7 +++++-- espflash/src/image_format/direct_boot.rs | 1 + espflash/src/image_format/idf_bootloader.rs | 5 +++++ espflash/src/image_format/mod.rs | 2 ++ espflash/src/interface.rs | 9 ++++++++- espflash/src/targets/esp32.rs | 2 ++ espflash/src/targets/esp32c2.rs | 1 + espflash/src/targets/esp32c3.rs | 1 + espflash/src/targets/esp32c6.rs | 1 + espflash/src/targets/esp32s2.rs | 5 +++++ espflash/src/targets/esp32s3.rs | 11 +++++++---- espflash/src/targets/esp8266.rs | 1 + 16 files changed, 72 insertions(+), 7 deletions(-) diff --git a/espflash/src/command.rs b/espflash/src/command.rs index 6e21aef5..05a4e78d 100644 --- a/espflash/src/command.rs +++ b/espflash/src/command.rs @@ -14,6 +14,7 @@ const ERASE_CHIP_TIMEOUT: Duration = Duration::from_secs(120); const MEM_END_TIMEOUT: Duration = Duration::from_millis(50); const SYNC_TIMEOUT: Duration = Duration::from_millis(100); +/// Types of commands that can be sent to a target device #[derive(Copy, Clone, Debug, Display)] #[non_exhaustive] #[repr(u8)] @@ -42,6 +43,7 @@ pub enum CommandType { } impl CommandType { + /// Return a timeout based on the command type pub fn timeout(&self) -> Duration { match self { CommandType::MemEnd => MEM_END_TIMEOUT, @@ -51,6 +53,7 @@ impl CommandType { } } + /// Return a timeout based on the size pub fn timeout_for_size(&self, size: u32) -> Duration { fn calc_timeout(timeout_per_mb: Duration, size: u32) -> Duration { let mb = size as f64 / 1_000_000.0; @@ -71,6 +74,7 @@ impl CommandType { } } +/// Available commands #[derive(Copy, Clone, Debug)] #[non_exhaustive] pub enum Command<'a> { @@ -153,6 +157,7 @@ pub enum Command<'a> { } impl<'a> Command<'a> { + /// Return the command type pub fn command_type(&self) -> CommandType { match self { Command::FlashBegin { .. } => CommandType::FlashBegin, @@ -176,10 +181,12 @@ impl<'a> Command<'a> { } } + /// Return a timeout based on the size pub fn timeout_for_size(&self, size: u32) -> Duration { self.command_type().timeout_for_size(size) } + /// Write a command pub fn write(&self, mut writer: W) -> std::io::Result<()> { writer.write_all(&[0, self.command_type() as u8])?; match *self { @@ -350,6 +357,7 @@ impl<'a> Command<'a> { } } +/// Write a data array and its checksum to a writer fn write_basic(mut writer: W, data: &[u8], checksum: u32) -> std::io::Result<()> { writer.write_all(&((data.len() as u16).to_le_bytes()))?; writer.write_all(&(checksum.to_le_bytes()))?; @@ -357,6 +365,7 @@ fn write_basic(mut writer: W, data: &[u8], checksum: u32) -> std::io:: Ok(()) } +/// WritE a Begin command to a writer fn begin_command( writer: W, size: u32, @@ -394,6 +403,7 @@ fn begin_command( write_basic(writer, data, 0) } +/// Write a Data command to a writer fn data_command( mut writer: W, block_data: &[u8], diff --git a/espflash/src/connection.rs b/espflash/src/connection.rs index e653885b..fde0664f 100644 --- a/espflash/src/connection.rs +++ b/espflash/src/connection.rs @@ -48,6 +48,7 @@ impl Connection { } } + /// Initialize a connection with a device pub fn begin(&mut self) -> Result<(), Error> { let mut extra_delay = false; for _ in 0..DEFAULT_CONNECT_ATTEMPTS { @@ -66,6 +67,7 @@ impl Connection { Err(Error::Connection(ConnectionError::ConnectionFailed)) } + /// Try to connect to a device fn connect_attempt(&mut self, extra_delay: bool) -> Result<(), Error> { self.reset_to_flash(extra_delay)?; @@ -79,6 +81,7 @@ impl Connection { Err(Error::Connection(ConnectionError::ConnectionFailed)) } + /// Try to sync with the device for a given timeout pub(crate) fn sync(&mut self) -> Result<(), Error> { self.with_timeout(CommandType::Sync.timeout(), |connection| { connection.command(Command::Sync)?; @@ -110,11 +113,13 @@ impl Connection { Ok(()) } + // Reset the device pub fn reset(&mut self) -> Result<(), Error> { let pid = self.port_info.pid; Ok(reset_after_flash(&mut self.serial, pid)?) } + // Reset the device to flash mode pub fn reset_to_flash(&mut self, extra_delay: bool) -> Result<(), Error> { if self.port_info.pid == USB_SERIAL_JTAG_PID { self.serial.write_data_terminal_ready(false)?; @@ -153,21 +158,25 @@ impl Connection { Ok(()) } + /// Set timeout for the serial port pub fn set_timeout(&mut self, timeout: Duration) -> Result<(), Error> { self.serial.serial_port_mut().set_timeout(timeout)?; Ok(()) } + /// Set baudrate for the serial port pub fn set_baud(&mut self, speed: u32) -> Result<(), Error> { self.serial.serial_port_mut().set_baud_rate(speed)?; Ok(()) } + /// Get the current baudrate of the serial port pub fn get_baud(&self) -> Result { Ok(self.serial.serial_port().baud_rate()?) } + /// Run a command with a timeout defined by the command type pub fn with_timeout Result>( &mut self, timeout: Duration, @@ -187,6 +196,7 @@ impl Connection { result } + /// Read the response from a serial port pub fn read_response(&mut self) -> Result, Error> { match self.read(10)? { None => Ok(None), @@ -198,6 +208,7 @@ impl Connection { } } + /// Write a command to the serial port pub fn write_command(&mut self, command: Command) -> Result<(), Error> { let serial = self.serial.serial_port_mut(); @@ -209,6 +220,7 @@ impl Connection { Ok(()) } + /// Write a command and reads the response pub fn command(&mut self, command: Command) -> Result { let ty = command.command_type(); self.write_command(command).for_command(ty)?; @@ -234,12 +246,14 @@ impl Connection { Err(Error::Connection(ConnectionError::ConnectionFailed)) } + /// Read a register command with a timeout pub fn read_reg(&mut self, reg: u32) -> Result { self.with_timeout(CommandType::ReadReg.timeout(), |connection| { connection.command(Command::ReadReg { address: reg }) }) } + /// Write a register command with a timeout pub fn write_reg(&mut self, addr: u32, value: u32, mask: Option) -> Result<(), Error> { self.with_timeout(CommandType::WriteReg.timeout(), |connection| { connection.command(Command::WriteReg { @@ -262,15 +276,18 @@ impl Connection { } } + /// Flush the serial port pub fn flush(&mut self) -> Result<(), Error> { self.serial.serial_port_mut().flush()?; Ok(()) } + /// Turn a serial port into a Interface pub fn into_interface(self) -> Interface { self.serial } + /// Get the USB PID of the serial port pub fn get_usb_pid(&self) -> Result { Ok(self.port_info.pid) } diff --git a/espflash/src/elf.rs b/espflash/src/elf.rs index 474f5856..20f2650d 100644 --- a/espflash/src/elf.rs +++ b/espflash/src/elf.rs @@ -163,14 +163,17 @@ impl<'a> CodeSegment<'a> { } } + /// Return the size of the segment pub fn size(&self) -> u32 { self.data.len() as u32 } + /// Return the data of the segment pub fn data(&self) -> &[u8] { self.data.as_ref() } + /// Pad the segment to the given alignment pub fn pad_align(&mut self, align: usize) { let padding = (align - self.data.len() % align) % align; if padding > 0 { diff --git a/espflash/src/error.rs b/espflash/src/error.rs index eaf8bf1a..e1966c92 100644 --- a/espflash/src/error.rs +++ b/espflash/src/error.rs @@ -396,6 +396,7 @@ impl From<&'static str> for ElfError { } } +/// Uunsuported image format error #[derive(Debug)] pub struct UnsupportedImageFormatError { format: ImageFormatKind, @@ -414,6 +415,7 @@ impl UnsupportedImageFormatError { } } + /// Return a comma-separated list of supported image formats fn supported_formats(&self) -> String { self.chip .into_target() @@ -424,6 +426,7 @@ impl UnsupportedImageFormatError { .join(", ") } + /// Update the context of the unsported image format error pub fn with_context(mut self, ctx: String) -> Self { self.context.replace(ctx); diff --git a/espflash/src/flasher/mod.rs b/espflash/src/flasher/mod.rs index b53eb54a..f61a3182 100644 --- a/espflash/src/flasher/mod.rs +++ b/espflash/src/flasher/mod.rs @@ -118,6 +118,7 @@ pub enum FlashSize { } impl FlashSize { + /// Create a `FlashSize` from an `u8` fn from(value: u8) -> Result { match value { 0x12 => Ok(FlashSize::_256Kb), @@ -134,7 +135,7 @@ impl FlashSize { } } - /// Returns the flash size in bytes + /// Return the flash size in bytes pub fn size(self) -> u32 { match self { FlashSize::_256Kb => 0x0040000, @@ -153,7 +154,7 @@ impl FlashSize { impl FromStr for FlashSize { type Err = Error; - + /// Create a `FlashSize` from a string fn from_str(s: &str) -> Result { use strum::{IntoEnumIterator, VariantNames}; let upper = s.to_uppercase(); @@ -189,6 +190,7 @@ impl SpiAttachParams { } } + // Default SPI parameters for ESP32-PICO-D4 pub const fn esp32_pico_d4() -> Self { SpiAttachParams { clk: 6, @@ -199,6 +201,7 @@ impl SpiAttachParams { } } + /// Encode the parameters into a byte array pub fn encode(self, stub: bool) -> Vec { let packed = ((self.hd as u32) << 24) | ((self.cs as u32) << 18) diff --git a/espflash/src/image_format/direct_boot.rs b/espflash/src/image_format/direct_boot.rs index f865aed0..9399b12a 100644 --- a/espflash/src/image_format/direct_boot.rs +++ b/espflash/src/image_format/direct_boot.rs @@ -6,6 +6,7 @@ use crate::{ image_format::ImageFormat, }; +/// Magic number for Direct boot which should be the first 8 bytes in flash const DIRECT_BOOT_MAGIC: &[u8] = &[0x1d, 0x04, 0xdb, 0xae, 0x1d, 0x04, 0xdb, 0xae]; /// Image format for ESP32 family chips not using a second-stage bootloader diff --git a/espflash/src/image_format/idf_bootloader.rs b/espflash/src/image_format/idf_bootloader.rs index ad71cf30..169ec3b5 100644 --- a/espflash/src/image_format/idf_bootloader.rs +++ b/espflash/src/image_format/idf_bootloader.rs @@ -18,6 +18,7 @@ use crate::{ const IROM_ALIGN: u32 = 0x10000; const SEG_HEADER_LEN: u32 = 8; +/// Wrapper for the extended header used by the ESP-IDF bootloader #[derive(Debug, Default, Clone, Copy, Pod, Zeroable)] #[repr(C)] struct ExtendedHeader { @@ -239,6 +240,7 @@ impl<'a> ImageFormat<'a> for IdfBootloaderFormat<'a> { } } +/// Enconde the flash size into the format used by the bootloader. fn encode_flash_size(size: FlashSize) -> Result { use FlashSize::*; @@ -274,6 +276,7 @@ fn get_segment_padding(offset: usize, segment: &CodeSegment) -> u32 { } } +/// Merge adjacent segments into one. fn merge_adjacent_segments(mut segments: Vec) -> Vec { segments.sort(); @@ -292,6 +295,7 @@ fn merge_adjacent_segments(mut segments: Vec) -> Vec { merged } +/// Save a segment to the data buffer. fn save_flash_segment( data: &mut Vec, mut segment: CodeSegment, @@ -314,6 +318,7 @@ fn save_flash_segment( Ok(checksum) } +/// Stores a segment header and the segment data in the data buffer. fn save_segment(data: &mut Vec, segment: &CodeSegment, checksum: u8) -> Result { let padding = (4 - segment.size() % 4) % 4; let header = SegmentHeader { diff --git a/espflash/src/image_format/mod.rs b/espflash/src/image_format/mod.rs index de715b7c..13b54d48 100644 --- a/espflash/src/image_format/mod.rs +++ b/espflash/src/image_format/mod.rs @@ -92,6 +92,7 @@ impl FromStr for ImageFormatKind { } } +/// Return the frequency encoding for the given chip and frequency fn encode_flash_frequency(chip: Chip, frequency: FlashFrequency) -> Result { let encodings = chip.into_target().flash_frequency_encodings(); if let Some(&f) = encodings.get(&frequency) { @@ -101,6 +102,7 @@ fn encode_flash_frequency(chip: Chip, frequency: FlashFrequency) -> Result u8 { for byte in data { checksum ^= *byte; diff --git a/espflash/src/interface.rs b/espflash/src/interface.rs index cd39574e..1662ff73 100644 --- a/espflash/src/interface.rs +++ b/espflash/src/interface.rs @@ -38,6 +38,7 @@ pub struct Interface { pub rts: Option, } +/// Set the level of a GPIO #[cfg(feature = "raspberry")] fn write_gpio(gpio: &mut OutputPin, level: bool) { if level { @@ -47,6 +48,7 @@ fn write_gpio(gpio: &mut OutputPin, level: bool) { } } +/// Open a serial port fn open_port(port_info: &SerialPortInfo) -> Result> { serialport::new(&port_info.port_name, 115_200) .flow_control(FlowControl::None) @@ -99,6 +101,7 @@ impl Interface { }) } + /// Set the level of the DTR pin pub fn write_data_terminal_ready(&mut self, pin_state: bool) -> serialport::Result<()> { #[cfg(feature = "raspberry")] if let Some(gpio) = self.dtr.as_mut() { @@ -109,6 +112,7 @@ impl Interface { self.serial_port.write_data_terminal_ready(pin_state) } + /// Set the level of the RTS pin pub fn write_request_to_send(&mut self, pin_state: bool) -> serialport::Result<()> { #[cfg(feature = "raspberry")] if let Some(gpio) = self.rts.as_mut() { @@ -119,20 +123,23 @@ impl Interface { self.serial_port.write_request_to_send(pin_state) } + /// Turn an `Interface` into a `SerialPort` pub fn into_serial(self) -> Box { self.serial_port } + /// Turn an `Interface` into a `&SerialPort` pub fn serial_port(&self) -> &dyn SerialPort { self.serial_port.as_ref() } + /// Turn an `Interface` into a `&mut SerialPort` pub fn serial_port_mut(&mut self) -> &mut dyn SerialPort { self.serial_port.as_mut() } } -// Note(dbuga): this impl is necessary because using `dyn SerialPort` as `dyn +// Note(dbuga): this `impl` is necessary because using `dyn SerialPort` as `dyn // Read` requires trait_upcasting which isn't stable yet. impl Read for Interface { fn read(&mut self, buf: &mut [u8]) -> std::io::Result { diff --git a/espflash/src/targets/esp32.rs b/espflash/src/targets/esp32.rs index 962bd591..802f70c6 100644 --- a/espflash/src/targets/esp32.rs +++ b/espflash/src/targets/esp32.rs @@ -35,10 +35,12 @@ const XTAL_CLK_DIVIDER: u32 = 1; pub struct Esp32; impl Esp32 { + /// Check if the magic value contains the specified value pub fn has_magic_value(value: u32) -> bool { CHIP_DETECT_MAGIC_VALUES.contains(&value) } + /// Return the package version based on the eFuses fn package_version(&self, connection: &mut Connection) -> Result { let word3 = self.read_efuse(connection, 3)?; diff --git a/espflash/src/targets/esp32c2.rs b/espflash/src/targets/esp32c2.rs index 03460387..10057cd6 100644 --- a/espflash/src/targets/esp32c2.rs +++ b/espflash/src/targets/esp32c2.rs @@ -38,6 +38,7 @@ const XTAL_CLK_DIVIDER: u32 = 1; pub struct Esp32c2; impl Esp32c2 { + /// Check if the magic value contains the specified value pub fn has_magic_value(value: u32) -> bool { CHIP_DETECT_MAGIC_VALUES.contains(&value) } diff --git a/espflash/src/targets/esp32c3.rs b/espflash/src/targets/esp32c3.rs index 512f9bf1..cb582bda 100644 --- a/espflash/src/targets/esp32c3.rs +++ b/espflash/src/targets/esp32c3.rs @@ -33,6 +33,7 @@ const PARAMS: Esp32Params = Esp32Params::new( pub struct Esp32c3; impl Esp32c3 { + /// Check if the magic value contains the specified value pub fn has_magic_value(value: u32) -> bool { CHIP_DETECT_MAGIC_VALUES.contains(&value) } diff --git a/espflash/src/targets/esp32c6.rs b/espflash/src/targets/esp32c6.rs index 2d6d28be..4e58747c 100644 --- a/espflash/src/targets/esp32c6.rs +++ b/espflash/src/targets/esp32c6.rs @@ -30,6 +30,7 @@ const PARAMS: Esp32Params = Esp32Params::new( pub struct Esp32c6; impl Esp32c6 { + /// Check if the magic value contains the specified value pub fn has_magic_value(value: u32) -> bool { CHIP_DETECT_MAGIC_VALUES.contains(&value) } diff --git a/espflash/src/targets/esp32s2.rs b/espflash/src/targets/esp32s2.rs index f9df0f76..706f2722 100644 --- a/espflash/src/targets/esp32s2.rs +++ b/espflash/src/targets/esp32s2.rs @@ -32,6 +32,7 @@ const PARAMS: Esp32Params = Esp32Params::new( pub struct Esp32s2; impl Esp32s2 { + /// Return if the connection is USB OTG fn connection_is_usb_otg(&self, connection: &mut Connection) -> Result { const UARTDEV_BUF_NO: u32 = 0x3fff_fd14; // Address which indicates OTG in use const UARTDEV_BUF_NO_USB_OTG: u32 = 2; // Value of UARTDEV_BUF_NO when OTG is in use @@ -39,6 +40,7 @@ impl Esp32s2 { Ok(connection.read_reg(UARTDEV_BUF_NO)? == UARTDEV_BUF_NO_USB_OTG) } + /// Return the block2 version based on eFuses fn get_block2_version(&self, connection: &mut Connection) -> Result { let blk2_word4 = self.read_efuse(connection, 27)?; let block2_version = (blk2_word4 >> 4) & 0x7; @@ -46,6 +48,7 @@ impl Esp32s2 { Ok(block2_version) } + /// Return the flash version based on eFuses fn get_flash_version(&self, connection: &mut Connection) -> Result { let blk1_word3 = self.read_efuse(connection, 20)?; let flash_version = (blk1_word3 >> 21) & 0xf; @@ -53,6 +56,7 @@ impl Esp32s2 { Ok(flash_version) } + /// Return the psram version based on eFuses fn get_psram_version(&self, connection: &mut Connection) -> Result { let blk1_word3 = self.read_efuse(connection, 20)?; let psram_version = (blk1_word3 >> 28) & 0xf; @@ -60,6 +64,7 @@ impl Esp32s2 { Ok(psram_version) } + /// Check if the magic value contains the specified value pub fn has_magic_value(value: u32) -> bool { CHIP_DETECT_MAGIC_VALUES.contains(&value) } diff --git a/espflash/src/targets/esp32s3.rs b/espflash/src/targets/esp32s3.rs index b409e8e0..03245d17 100644 --- a/espflash/src/targets/esp32s3.rs +++ b/espflash/src/targets/esp32s3.rs @@ -30,17 +30,20 @@ const PARAMS: Esp32Params = Esp32Params::new( pub struct Esp32s3; impl Esp32s3 { - pub fn has_magic_value(value: u32) -> bool { - CHIP_DETECT_MAGIC_VALUES.contains(&value) - } - + /// Return the major BLK version based on eFuses fn blk_version_major(&self, connection: &mut Connection) -> Result { Ok(self.read_efuse(connection, 96)? & 0x3) } + /// Return the minor BLK version based on eFuses fn blk_version_minor(&self, connection: &mut Connection) -> Result { Ok(self.read_efuse(connection, 20)? >> 24 & 0x7) } + + /// Check if the magic value contains the specified value + pub fn has_magic_value(value: u32) -> bool { + CHIP_DETECT_MAGIC_VALUES.contains(&value) + } } impl ReadEFuse for Esp32s3 { diff --git a/espflash/src/targets/esp8266.rs b/espflash/src/targets/esp8266.rs index c27dfb41..993366ca 100644 --- a/espflash/src/targets/esp8266.rs +++ b/espflash/src/targets/esp8266.rs @@ -26,6 +26,7 @@ const XTAL_CLK_DIVIDER: u32 = 2; pub struct Esp8266; impl Esp8266 { + /// Check if the magic value contains the specified value pub fn has_magic_value(value: u32) -> bool { CHIP_DETECT_MAGIC_VALUES.contains(&value) } From 002310cbe2de764f4ef3176f74e31a362042c549 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 12:59:01 +0100 Subject: [PATCH 27/35] =?UTF-8?q?style:=20=F0=9F=94=8A=20Update=20log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/cli/monitor/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/espflash/src/cli/monitor/mod.rs b/espflash/src/cli/monitor/mod.rs index c442f5de..28f29052 100644 --- a/espflash/src/cli/monitor/mod.rs +++ b/espflash/src/cli/monitor/mod.rs @@ -67,7 +67,7 @@ impl RawModeGuard { impl Drop for RawModeGuard { fn drop(&mut self) { if let Err(e) = disable_raw_mode() { - error!("{:#}", e) + error!("Failed to disable raw_mode: {:#}", e) } } } From aa0947f2f5c8ace3f633f24e43085356b013b066 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 15:03:51 +0100 Subject: [PATCH 28/35] =?UTF-8?q?revert:=20=E2=8F=AA=EF=B8=8F=20Revert=20c?= =?UTF-8?q?argo=20version=20upgrade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cargo-espflash/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cargo-espflash/Cargo.toml b/cargo-espflash/Cargo.toml index 6c906238..c75adf87 100644 --- a/cargo-espflash/Cargo.toml +++ b/cargo-espflash/Cargo.toml @@ -21,7 +21,7 @@ bin-dir = "{ bin }{ binary-ext }" pkg-fmt = "zip" [dependencies] -cargo = { version = "0.69.0", features = ["vendored-openssl"] } +cargo = { version = "0.66.0", features = ["vendored-openssl"] } cargo_metadata = "0.15.2" clap = { version = "4.0.32", features = ["derive"] } env_logger = "0.10.0" From f6ad6429a7edd03acf392c71d313300f0a8ce482 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 15:04:05 +0100 Subject: [PATCH 29/35] =?UTF-8?q?revert:=20=E2=8F=AA=EF=B8=8F=20Revert=20c?= =?UTF-8?q?argo=20version=20upgrade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 427 ++++++++--------------------------------------------- 1 file changed, 62 insertions(+), 365 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3e51e04d..70815978 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -125,12 +125,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - [[package]] name = "base64" version = "0.13.1" @@ -143,12 +137,6 @@ version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - [[package]] name = "binread" version = "2.2.0" @@ -284,20 +272,20 @@ dependencies = [ [[package]] name = "cargo" -version = "0.69.0" +version = "0.66.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fdc51fbabb210bf9bb6ad6127a647cd6c96fb0f0ce6877fdabc6043d3013fe6" +checksum = "4cbff5076ff17b84f81946ca2d5536e60bfa2344cd365efb57c19fd808a17640" dependencies = [ "anyhow", - "base64 0.13.1", + "atty", "bytesize", "cargo-platform", "cargo-util", - "clap", + "clap 3.2.23", "crates-io", "curl", "curl-sys", - "env_logger", + "env_logger 0.9.3", "filetime", "flate2", "fwdansi", @@ -305,14 +293,11 @@ dependencies = [ "git2-curl", "glob", "hex 0.4.3", - "hmac", "home", - "http-auth", "humantime", "ignore", "im-rc", "indexmap", - "is-terminal", "itertools", "jobserver", "lazy_static", @@ -324,23 +309,19 @@ dependencies = [ "opener", "openssl", "os_info", - "pasetors", "pathdiff", "percent-encoding", "rustc-workspace-hack", "rustfix", "semver", "serde", - "serde-value", "serde_ignored", "serde_json", - "sha1", "shell-escape", "strip-ansi-escapes", "tar", "tempfile", "termcolor", - "time", "toml_edit", "unicode-width", "unicode-xid", @@ -355,8 +336,8 @@ version = "2.0.0-rc.3" dependencies = [ "cargo", "cargo_metadata", - "clap", - "env_logger", + "clap 4.1.10", + "env_logger 0.10.0", "esp-idf-part", "espflash", "log", @@ -426,6 +407,21 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +[[package]] +name = "clap" +version = "3.2.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +dependencies = [ + "atty", + "bitflags", + "clap_lex 0.2.4", + "indexmap", + "strsim", + "termcolor", + "textwrap 0.16.0", +] + [[package]] name = "clap" version = "4.1.10" @@ -434,7 +430,7 @@ checksum = "ce38afc168d8665cfc75c7b1dd9672e50716a137f433f070991619744a67342a" dependencies = [ "bitflags", "clap_derive", - "clap_lex", + "clap_lex 0.3.0", "is-terminal", "once_cell", "strsim", @@ -454,6 +450,15 @@ dependencies = [ "syn", ] +[[package]] +name = "clap_lex" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +dependencies = [ + "os_str_bytes", +] + [[package]] name = "clap_lex" version = "0.3.0" @@ -516,12 +521,6 @@ dependencies = [ "windows-sys 0.42.0", ] -[[package]] -name = "const-oid" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" - [[package]] name = "core-foundation" version = "0.9.3" @@ -558,9 +557,9 @@ dependencies = [ [[package]] name = "crates-io" -version = "0.35.1" +version = "0.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2dfb6077da60207264ab2eb0e3734f02e0a0c50c347b32c728e42c6fbbf7e2e" +checksum = "6b4a87459133b2e708195eaab34be55039bc30e0d120658bd40794bb00b6328d" dependencies = [ "anyhow", "curl", @@ -626,18 +625,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "crypto-bigint" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2538c4e68e52548bacb3e83ac549f903d44f011ac9d5abb5e132e67d0808f7" -dependencies = [ - "generic-array", - "rand_core", - "subtle", - "zeroize", -] - [[package]] name = "crypto-common" version = "0.1.6" @@ -682,12 +669,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "ct-codecs" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3b7eb4404b8195a9abb6356f4ac07d8ba267045c8d6d220ac4dc992e6cc75df" - [[package]] name = "curl" version = "0.4.44" @@ -777,17 +758,6 @@ dependencies = [ "syn", ] -[[package]] -name = "der" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc906908ea6458456e5eaa160a9c08543ec3d1e6f71e2235cedd660cb65f9df0" -dependencies = [ - "const-oid", - "pem-rfc7468", - "zeroize", -] - [[package]] name = "dialoguer" version = "0.10.2" @@ -807,7 +777,6 @@ checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" dependencies = [ "block-buffer", "crypto-common", - "subtle", ] [[package]] @@ -851,60 +820,31 @@ dependencies = [ "winapi", ] -[[package]] -name = "ecdsa" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1b0a1222f8072619e8a6b667a854020a03d363738303203c09468b3424a420a" -dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", -] - -[[package]] -name = "ed25519-compact" -version = "2.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a3d382e8464107391c8706b4c14b087808ecb909f6c15c34114bc42e53a9e4c" -dependencies = [ - "getrandom", -] - [[package]] name = "either" version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" -[[package]] -name = "elliptic-curve" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ea5a92946e8614bb585254898bb7dd1ddad241ace60c52149e3765e34cc039d" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest", - "ff", - "generic-array", - "group", - "hkdf", - "pem-rfc7468", - "pkcs8", - "rand_core", - "sec1", - "subtle", - "zeroize", -] - [[package]] name = "encode_unicode" version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f" +[[package]] +name = "env_logger" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +dependencies = [ + "atty", + "humantime", + "log", + "regex", + "termcolor", +] + [[package]] name = "env_logger" version = "0.10.0" @@ -965,12 +905,12 @@ dependencies = [ "base64 0.21.0", "binread", "bytemuck", - "clap", + "clap 4.1.10", "comfy-table", "crossterm 0.26.1", "dialoguer", "directories-next", - "env_logger", + "env_logger 0.10.0", "esp-idf-part", "flate2", "indicatif", @@ -1007,22 +947,6 @@ dependencies = [ "instant", ] -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "rand_core", - "subtle", -] - -[[package]] -name = "fiat-crypto" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93ace6ec7cc19c8ed33a32eaa9ea692d7faea05006b5356b9e2b668ec4bc3955" - [[package]] name = "filetime" version = "0.2.19" @@ -1100,7 +1024,6 @@ checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" dependencies = [ "typenum", "version_check", - "zeroize", ] [[package]] @@ -1110,10 +1033,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] [[package]] @@ -1128,9 +1049,9 @@ dependencies = [ [[package]] name = "git2" -version = "0.16.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be36bc9e0546df253c0cc41fd0af34f5e92845ad8509462ec76672fac6997f5b" +checksum = "2994bee4a3a6a51eb90c218523be382fd7ea09b16380b9312e9dbe955ff7c7d1" dependencies = [ "bitflags", "libc", @@ -1143,9 +1064,9 @@ dependencies = [ [[package]] name = "git2-curl" -version = "0.17.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7577f4e6341ba7c90d883511130a45b956c274ba5f4d205d9f9da990f654cd33" +checksum = "ed817a00721e2f8037ba722e60358d4956dae9cca10315fc982f967907d3b0cd" dependencies = [ "curl", "git2", @@ -1172,17 +1093,6 @@ dependencies = [ "regex", ] -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core", - "subtle", -] - [[package]] name = "hash32" version = "0.2.1" @@ -1248,24 +1158,6 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -[[package]] -name = "hkdf" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" -dependencies = [ - "hmac", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - [[package]] name = "home" version = "0.5.4" @@ -1275,15 +1167,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "http-auth" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5430cacd7a1f9a02fbeb350dfc81a0e5ed42d81f3398cb0ba184017f85bdcfbc" -dependencies = [ - "memchr", -] - [[package]] name = "humantime" version = "2.1.0" @@ -1608,7 +1491,7 @@ dependencies = [ "supports-hyperlinks", "supports-unicode", "terminal_size", - "textwrap", + "textwrap 0.15.2", "thiserror", "unicode-width", ] @@ -1767,26 +1650,6 @@ dependencies = [ "vcpkg", ] -[[package]] -name = "ordered-float" -version = "2.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7940cf2ca942593318d07fcf2596cdca60a85c9e7fab408a5e21a4f9dcd40d87" -dependencies = [ - "num-traits", -] - -[[package]] -name = "orion" -version = "0.17.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbe74a766292f94f7e69db5a7bf010eadd944f24186c463fe578a7e637582066" -dependencies = [ - "fiat-crypto", - "subtle", - "zeroize", -] - [[package]] name = "os_info" version = "3.5.1" @@ -1810,18 +1673,6 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" -[[package]] -name = "p384" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" -dependencies = [ - "ecdsa", - "elliptic-curve", - "primeorder", - "sha2", -] - [[package]] name = "parking_lot" version = "0.12.1" @@ -1854,58 +1705,18 @@ dependencies = [ "num-traits", ] -[[package]] -name = "pasetors" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "824bf633b85dc1dece2eb07161627ba5d90a951597cd5dbf8d85f4d82b7aea69" -dependencies = [ - "ct-codecs", - "ed25519-compact", - "getrandom", - "orion", - "p384", - "rand_core", - "regex", - "serde", - "serde_json", - "sha2", - "subtle", - "time", - "zeroize", -] - [[package]] name = "pathdiff" version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" -[[package]] -name = "pem-rfc7468" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" -dependencies = [ - "base64ct", -] - [[package]] name = "percent-encoding" version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" -[[package]] -name = "pkcs8" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d2820d87d2b008616e5c27212dd9e0e694fb4c6b522de06094106813328cb49" -dependencies = [ - "der", - "spki", -] - [[package]] name = "pkg-config" version = "0.3.26" @@ -1918,15 +1729,6 @@ version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26f6a7b87c2e435a3241addceeeff740ff8b7e76b74c13bf9acb17fa454ea00b" -[[package]] -name = "primeorder" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7613fdcc0831c10060fa69833ea8fa2caa94b6456f51e25356a885b530a2e3d0" -dependencies = [ - "elliptic-curve", -] - [[package]] name = "proc-macro-crate" version = "1.2.1" @@ -1991,9 +1793,6 @@ name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] [[package]] name = "rand_xoshiro" @@ -2056,16 +1855,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - [[package]] name = "ring" version = "0.16.20" @@ -2195,20 +1984,6 @@ dependencies = [ "untrusted", ] -[[package]] -name = "sec1" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48518a2b5775ba8ca5b46596aae011caa431e6ce7e4a67ead66d92f08884220e" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", -] - [[package]] name = "semver" version = "1.0.16" @@ -2238,16 +2013,6 @@ dependencies = [ "smallvec 0.6.14", ] -[[package]] -name = "serde-value" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3a1a3341211875ef120e117ea7fd5228530ae7e7036a779fdc9117be6b3282c" -dependencies = [ - "ordered-float", - "serde", -] - [[package]] name = "serde_derive" version = "1.0.152" @@ -2305,17 +2070,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "sha1" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f04293dc80c3993519f2d7f6f511707ee7094fe0c6d3406feb330cdb3540eba3" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - [[package]] name = "sha2" version = "0.10.6" @@ -2363,16 +2117,6 @@ dependencies = [ "libc", ] -[[package]] -name = "signature" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fe458c98333f9c8152221191a77e2a44e8325d0193484af2e9421a53019e57d" -dependencies = [ - "digest", - "rand_core", -] - [[package]] name = "sized-chunks" version = "0.6.5" @@ -2435,16 +2179,6 @@ dependencies = [ "lock_api", ] -[[package]] -name = "spki" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0445c905640145c7ea8c1993555957f65e7c46d0535b91ba501bc9bfc85522f" -dependencies = [ - "base64ct", - "der", -] - [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -2494,12 +2228,6 @@ dependencies = [ "syn", ] -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - [[package]] name = "supports-color" version = "1.3.1" @@ -2599,6 +2327,12 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "textwrap" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" + [[package]] name = "thiserror" version = "1.0.38" @@ -2628,33 +2362,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "time" -version = "0.3.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" -dependencies = [ - "itoa 1.0.5", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" - -[[package]] -name = "time-macros" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" -dependencies = [ - "time-core", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -2679,27 +2386,17 @@ dependencies = [ "serde", ] -[[package]] -name = "toml_datetime" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" -dependencies = [ - "serde", -] - [[package]] name = "toml_edit" -version = "0.15.0" +version = "0.14.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1541ba70885967e662f69d31ab3aeca7b1aaecfcd58679590b893e9239c3646" +checksum = "5376256e44f2443f8896ac012507c19a012df0fe8758b55246ae51a2279db51f" dependencies = [ "combine", "indexmap", "itertools", "kstring", "serde", - "toml_datetime", ] [[package]] From 67378ded6a61fc49a7202138ed042b2b812ac402 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Sat, 18 Mar 2023 15:05:06 +0100 Subject: [PATCH 30/35] =?UTF-8?q?ci:=20=E2=9A=A1=EF=B8=8F=20Fail=20on=20cl?= =?UTF-8?q?ippy=20warnings?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/raspberry_rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/raspberry_rust.yml b/.github/workflows/raspberry_rust.yml index 13b24ac0..05783c54 100644 --- a/.github/workflows/raspberry_rust.yml +++ b/.github/workflows/raspberry_rust.yml @@ -43,7 +43,7 @@ jobs: toolchain: stable components: clippy cargo-command: clippy - args: --features=raspberry -- -A clippy::too_many_arguments + args: --features=raspberry -- -D warnings -A clippy::too_many_arguments steps: - uses: actions/checkout@v3 - uses: dtolnay/rust-toolchain@v1 From 16457312f2f356e5912ad0a75cdb6fa975dffabd Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Mon, 20 Mar 2023 10:47:37 +0100 Subject: [PATCH 31/35] =?UTF-8?q?build:=20=E2=AC=87=EF=B8=8F=20Downgrade?= =?UTF-8?q?=20dependencies=20to=20maintain=20msrv?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cargo.lock | 107 +++++++++++++++----------------------- cargo-espflash/Cargo.toml | 2 +- espflash/Cargo.toml | 4 +- 3 files changed, 46 insertions(+), 67 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 70815978..d8ec0e97 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -336,7 +336,7 @@ version = "2.0.0-rc.3" dependencies = [ "cargo", "cargo_metadata", - "clap 4.1.10", + "clap 4.0.32", "env_logger 0.10.0", "esp-idf-part", "espflash", @@ -358,9 +358,9 @@ dependencies = [ [[package]] name = "cargo-util" -version = "0.2.3" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4e0cd00582e110eb8d99de768521d36fce9e24a286babf3cea68824ae09948f" +checksum = "b75f6bfca7b85d6e8c6a42405e9b4ecadd2e63f75f94aabfb524378b57a557a4" dependencies = [ "anyhow", "core-foundation", @@ -424,9 +424,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.1.10" +version = "4.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce38afc168d8665cfc75c7b1dd9672e50716a137f433f070991619744a67342a" +checksum = "a7db700bc935f9e43e88d00b0850dae18a63773cfbec6d8e070fccf7fef89a39" dependencies = [ "bitflags", "clap_derive", @@ -439,9 +439,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.1.9" +version = "4.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fddf67631444a3a3e3e5ac51c36a5e01335302de677bd78759eaa90ab1f46644" +checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" dependencies = [ "heck", "proc-macro-error", @@ -518,7 +518,7 @@ dependencies = [ "lazy_static", "libc", "unicode-width", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -881,9 +881,9 @@ dependencies = [ [[package]] name = "esp-idf-part" -version = "0.3.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f47dd277680b17e865d133dcdefefa400f75c7dac41d54a8b788509a4e9b7a14" +checksum = "8342fd812ec65d2d5f4b4930001f5dcd894440a561acd3ba081c1417159fee21" dependencies = [ "csv", "deku", @@ -905,7 +905,7 @@ dependencies = [ "base64 0.21.0", "binread", "bytemuck", - "clap 4.1.10", + "clap 4.0.32", "comfy-table", "crossterm 0.26.1", "dialoguer", @@ -956,7 +956,7 @@ dependencies = [ "cfg-if", "libc", "redox_syscall", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -1142,9 +1142,12 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.3.1" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] [[package]] name = "hex" @@ -1258,19 +1261,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" dependencies = [ "libc", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] name = "is-terminal" -version = "0.4.4" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +checksum = "28dfb6c8100ccc63462345b67d1bbc3679177c75ee4bf59bf29c8b1d110b8189" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi 0.2.6", "io-lifetimes", "rustix", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -1525,16 +1528,16 @@ dependencies = [ "libc", "log", "wasi", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] name = "miow" -version = "0.5.0" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52ffbca2f655e33c08be35d87278e5b18b89550a37dbd598c20db92f6a471123" +checksum = "b9f1c5b025cda876f66ef43a113f91ebc9f4ccef34843000e0adf6ebbab84e21" dependencies = [ - "windows-sys 0.42.0", + "winapi", ] [[package]] @@ -1693,7 +1696,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec 1.10.0", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -1923,7 +1926,7 @@ dependencies = [ "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -1965,7 +1968,7 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "windows-sys 0.42.0", + "windows-sys", ] [[package]] @@ -2681,71 +2684,47 @@ dependencies = [ "windows_x86_64_msvc", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.2" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" [[package]] name = "windows_aarch64_msvc" -version = "0.42.2" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" [[package]] name = "windows_i686_gnu" -version = "0.42.2" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" [[package]] name = "windows_i686_msvc" -version = "0.42.2" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" [[package]] name = "windows_x86_64_gnu" -version = "0.42.2" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.2" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" [[package]] name = "windows_x86_64_msvc" -version = "0.42.2" +version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5" [[package]] name = "wyz" diff --git a/cargo-espflash/Cargo.toml b/cargo-espflash/Cargo.toml index c75adf87..f03faec9 100644 --- a/cargo-espflash/Cargo.toml +++ b/cargo-espflash/Cargo.toml @@ -25,7 +25,7 @@ cargo = { version = "0.66.0", features = ["vendored-openssl"] } cargo_metadata = "0.15.2" clap = { version = "4.0.32", features = ["derive"] } env_logger = "0.10.0" -esp-idf-part = "0.3.0" +esp-idf-part = "0.2.0" espflash = { version = "=2.0.0-rc.3", path = "../espflash" } log = "0.4.17" miette = { version = "5.5.0", features = ["fancy"] } diff --git a/espflash/Cargo.toml b/espflash/Cargo.toml index 5a7339fd..8e9cf85d 100644 --- a/espflash/Cargo.toml +++ b/espflash/Cargo.toml @@ -28,13 +28,13 @@ addr2line = { version = "0.19.0", optional = true } base64 = "0.21.0" binread = "2.2.0" bytemuck = { version = "1.12.3", features = ["derive"] } -clap = { version = "4.0.32", features = ["derive", "env"], optional = true } +clap = { version = "=4.0.32", features = ["derive", "env"], optional = true } comfy-table = { version = "6.1.4", optional = true } crossterm = { version = "0.26.1", optional = true } dialoguer = { version = "0.10.2", optional = true } directories-next = { version = "2.0.0", optional = true } env_logger = { version = "0.10.0", optional = true } -esp-idf-part = "0.3.0" +esp-idf-part = "0.2.0" flate2 = "1.0.25" indicatif = { version = "0.17.2", optional = true } lazy_static = { version = "1.4.0", optional = true } From 0b74729bc3fd9a3340fa0f4bbef2f2cbcaabda52 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Mon, 20 Mar 2023 11:02:56 +0100 Subject: [PATCH 32/35] =?UTF-8?q?build:=20=E2=8F=AA=EF=B8=8F=20Rever=20pin?= =?UTF-8?q?ned=20dependency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/espflash/Cargo.toml b/espflash/Cargo.toml index 8e9cf85d..39de6ef8 100644 --- a/espflash/Cargo.toml +++ b/espflash/Cargo.toml @@ -28,7 +28,7 @@ addr2line = { version = "0.19.0", optional = true } base64 = "0.21.0" binread = "2.2.0" bytemuck = { version = "1.12.3", features = ["derive"] } -clap = { version = "=4.0.32", features = ["derive", "env"], optional = true } +clap = { version = "4.0.32", features = ["derive", "env"], optional = true } comfy-table = { version = "6.1.4", optional = true } crossterm = { version = "0.26.1", optional = true } dialoguer = { version = "0.10.2", optional = true } From d18d92f0f1d3b068ea768c81d4872200b609a293 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Arcos Date: Fri, 24 Mar 2023 22:20:40 +0100 Subject: [PATCH 33/35] Update espflash/src/flasher/mod.rs Co-authored-by: Jesse Braham --- espflash/src/flasher/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/espflash/src/flasher/mod.rs b/espflash/src/flasher/mod.rs index 98df08ae..e5f3b84f 100644 --- a/espflash/src/flasher/mod.rs +++ b/espflash/src/flasher/mod.rs @@ -154,7 +154,7 @@ impl FlashSize { impl FromStr for FlashSize { type Err = Error; - /// Create a `FlashSize` from a string + /// Create a [FlashSize] from a string fn from_str(s: &str) -> Result { use strum::{IntoEnumIterator, VariantNames}; let upper = s.to_uppercase(); From 0a823eccc8c80819798b7a426275838c7a27b79a Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Fri, 24 Mar 2023 22:35:32 +0100 Subject: [PATCH 34/35] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Add=20refences=20t?= =?UTF-8?q?o=20types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/interface.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/espflash/src/interface.rs b/espflash/src/interface.rs index 1662ff73..a999d956 100644 --- a/espflash/src/interface.rs +++ b/espflash/src/interface.rs @@ -123,17 +123,17 @@ impl Interface { self.serial_port.write_request_to_send(pin_state) } - /// Turn an `Interface` into a `SerialPort` + /// Turn an [Interface] into a [SerialPort] pub fn into_serial(self) -> Box { self.serial_port } - /// Turn an `Interface` into a `&SerialPort` + /// Turn an [Interface] into a `&`[SerialPort] pub fn serial_port(&self) -> &dyn SerialPort { self.serial_port.as_ref() } - /// Turn an `Interface` into a `&mut SerialPort` + /// Turn an [Interface] into a `&mut `[SerialPort] pub fn serial_port_mut(&mut self) -> &mut dyn SerialPort { self.serial_port.as_mut() } From 345b2dbed247a7b31c098d635c687081af897d60 Mon Sep 17 00:00:00 2001 From: Sergio Gasquez Date: Fri, 24 Mar 2023 22:35:38 +0100 Subject: [PATCH 35/35] =?UTF-8?q?docs:=20=F0=9F=93=9D=20Fix=20typo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- espflash/src/command.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/espflash/src/command.rs b/espflash/src/command.rs index 05a4e78d..d581b510 100644 --- a/espflash/src/command.rs +++ b/espflash/src/command.rs @@ -365,7 +365,7 @@ fn write_basic(mut writer: W, data: &[u8], checksum: u32) -> std::io:: Ok(()) } -/// WritE a Begin command to a writer +/// Write a Begin command to a writer fn begin_command( writer: W, size: u32,