From 18d57bf6ce41b8aa24bb66f4abaa8291fc68267f Mon Sep 17 00:00:00 2001 From: Frederick Vollbrecht Date: Sun, 23 Jun 2024 20:50:08 +0200 Subject: [PATCH] update to new esp-idf release versions (#209) * update to new esp-idf release versions * update CI * temp: add back v5.1 option * use the latest idf releases * remove esp-idf v4.4 option * cargo ci test against all targets --- .github/workflows/ci_cargo.yml | 24 +++++++++---------- .github/workflows/ci_cmake.yml | 2 +- cargo/.cargo/config.toml | 19 +++++---------- cargo/Cargo.toml | 6 ++--- cargo/cargo-generate.toml | 12 +++------- cargo/pre-script.rhai | 2 +- .../rust-{{project-name}}/Cargo.toml | 7 +++--- 7 files changed, 30 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci_cargo.yml b/.github/workflows/ci_cargo.yml index f4641d0..4b2f1e5 100644 --- a/.github/workflows/ci_cargo.yml +++ b/.github/workflows/ci_cargo.yml @@ -31,8 +31,8 @@ jobs: - std: true - std: false esp-idf: - - version: v5.1 - - version: v4.4 + - version: v5.2 + - version: v5.1 # only for compairson why no_std build fails on v5.2 # - version: master steps: - name: Setup | Rust (RISC-V) @@ -72,18 +72,18 @@ jobs: - uses: actions/checkout@v4 with: path: /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template - - name: Generate - if: matrix.esp-idf.version != 'v4.4' || matrix.target == 'esp32' || matrix.target == 'esp32s2' || matrix.target == 'esp32s3' || matrix.target == 'esp32c3' - run: cargo generate --path /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template cargo --name test --vcs none --silent -d mcu=${{ matrix.target }} -d advanced=true -d espidfver=${{ matrix.esp-idf.version }} -d std=${{ matrix.std-config.std }} -d devcontainer=false -d wokwi=false -d ci=false + - name: Generate v5.2 + if: matrix.esp-idf.version == 'v5.2' || matrix.esp-idf.version == 'v5.1' + run: cargo generate --path /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template cargo --name ${{ matrix.target }}-${{ matrix.std-config.std }} --vcs none --silent -d mcu=${{ matrix.target }} -d advanced=true -d espidfver=${{ matrix.esp-idf.version }} -d std=${{ matrix.std-config.std }} -d devcontainer=false -d wokwi=false -d ci=false - name: Build | Fmt Check - if: matrix.esp-idf.version == 'v4.4' && matrix.target == 'esp32c3' - run: cd test; cargo fmt -- --check + if: matrix.esp-idf.version == 'v5.2' && matrix.target == 'esp32c3' + run: cd ${{ matrix.target }}-${{ matrix.std-config.std }}; cargo fmt -- --check - name: Build | Clippy - if: matrix.esp-idf.version != 'v4.4' || matrix.target == 'esp32' || matrix.target == 'esp32s2' || matrix.target == 'esp32s3' || matrix.target == 'esp32c3' - run: cd test; cargo clippy --no-deps -- -Dwarnings + if: matrix.esp-idf.version == 'v5.2' || matrix.esp-idf.version == 'v5.1' + run: cd ${{ matrix.target }}-${{ matrix.std-config.std }}; cargo clippy --no-deps -- -Dwarnings - name: Build | Compile - if: matrix.esp-idf.version != 'v4.4' || matrix.target == 'esp32' || matrix.target == 'esp32s2' || matrix.target == 'esp32s3' || matrix.target == 'esp32c3' - run: cd test; cargo build + if: matrix.esp-idf.version == 'v5.2' || matrix.esp-idf.version == 'v5.1' + run: cd ${{ matrix.target }}-${{ matrix.std-config.std }}; cargo build container-checks: name: "Container Check: ${{ matrix.target }}" runs-on: ubuntu-latest @@ -109,7 +109,7 @@ jobs: with: path: /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template - name: Generate - run: cargo generate --path /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template cargo --name test-${{ matrix.target }} --vcs none --silent -d mcu=${{ matrix.target }} -d advanced=true -d espidfver=v5.1 -d std=true -d devcontainer=true -d wokwi=false -d ci=false + run: cargo generate --path /home/runner/work/esp-idf-template/esp-idf-template/github-esp-idf-template cargo --name test-${{ matrix.target }} --vcs none --silent -d mcu=${{ matrix.target }} -d advanced=true -d espidfver=v5.2 -d std=true -d devcontainer=true -d wokwi=false -d ci=false - name: Update ownership run: | sudo chown 1000:1000 -R test-${{ matrix.target }} diff --git a/.github/workflows/ci_cmake.yml b/.github/workflows/ci_cmake.yml index d8e5aba..1cced98 100644 --- a/.github/workflows/ci_cmake.yml +++ b/.github/workflows/ci_cmake.yml @@ -49,7 +49,7 @@ jobs: - hal: false std: false esp-idf: - - version: v5.1 + - version: v5.2 # - version: master # name: master steps: diff --git a/cargo/.cargo/config.toml b/cargo/.cargo/config.toml index 2478b4b..e749ecb 100644 --- a/cargo/.cargo/config.toml +++ b/cargo/.cargo/config.toml @@ -3,13 +3,8 @@ target = "{{ rust_target }}" [target.{{ rust_target }}] linker = "ldproxy" -# runner = "espflash --monitor" # Select this runner for espflash v1.x.x -runner = "espflash flash --monitor" # Select this runner for espflash v2.x.x -{% if espidfver != "v4.4" -%} +runner = "espflash flash --monitor" # Select this runner for espflash v3.x.x rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110 -{%- elsif espidfver == "v4.4" and arch == "riscv" -%} -rustflags = ["-C", "default-linker-libraries"] -{%- endif %} [unstable] {% if std -%} @@ -21,14 +16,12 @@ build-std = ["core", "alloc", "panic_abort"] [env] MCU="{{ mcu }}" # Note: this variable is not used by the pio builder (`cargo build --features pio`) -{%- if espidfver == "v4.4" %} -ESP_IDF_VERSION = "v4.4.7" -{% elsif espidfver == "v5.1" %} -ESP_IDF_VERSION = "v5.1.3" +{%- if espidfver == "v5.1" %} +ESP_IDF_VERSION = "v5.1.4" +{% elsif espidfver == "v5.2" %} +ESP_IDF_VERSION = "v5.2.2" {% elsif espidfver == "master" %} ESP_IDF_VERSION = "master" {% endif %} -# Workaround for https://github.com/esp-rs/esp-idf-template/issues/174 until -# https://github.com/esp-rs/esp-idf-hal/pull/387 gets released and the template -# updated. +# Workaround for https://github.com/esp-rs/esp-idf-template/issues/174 CRATE_CC_NO_DEFAULTS = "1" diff --git a/cargo/Cargo.toml b/cargo/Cargo.toml index b74c475..b939f2b 100644 --- a/cargo/Cargo.toml +++ b/cargo/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["{{authors}}"] edition = "2021" resolver = "2" -rust-version = "1.71" +rust-version = "1.77" [[bin]] name = "{{project-name}}" @@ -33,7 +33,7 @@ embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf- [dependencies] log = { version = "0.4", default-features = false } -esp-idf-svc = { version = "0.48", default-features = false } +esp-idf-svc = { version = "0.49", default-features = false } [build-dependencies] -embuild = "0.31.3" +embuild = "0.32.0" \ No newline at end of file diff --git a/cargo/cargo-generate.toml b/cargo/cargo-generate.toml index e5b94de..a42a000 100644 --- a/cargo/cargo-generate.toml +++ b/cargo/cargo-generate.toml @@ -21,17 +21,11 @@ type = "bool" prompt = "Enable STD support?" default = true -[conditional.'advanced && (mcu == "esp32c6" || mcu == "esp32h2" || mcu == "esp32c2")'.placeholders.espidfver] +[conditional.'advanced'.placeholders.espidfver] type = "string" prompt = "ESP-IDF version (master = UNSTABLE)" -choices = ["v5.1", "master"] -default = "v5.1" - -[conditional.'advanced && (mcu == "esp32" || mcu == "esp32c3" || mcu == "esp32s2" || mcu == "esp32s3")'.placeholders.espidfver] -type = "string" -prompt = "ESP-IDF version (master = UNSTABLE)" -choices = ["v4.4", "v5.1", "master"] -default = "v5.1" +choices = ["v5.1", "v5.2", "master"] +default = "v5.2" [conditional.'advanced'.placeholders.devcontainer] type = "bool" diff --git a/cargo/pre-script.rhai b/cargo/pre-script.rhai index 1f4d185..f01a988 100644 --- a/cargo/pre-script.rhai +++ b/cargo/pre-script.rhai @@ -52,7 +52,7 @@ for key in target_properties.keys() { let advanced = variable::get("advanced"); if !advanced { variable::set("std", true); - variable::set("espidfver", "v5.1"); + variable::set("espidfver", "v5.2"); variable::set("devcontainer", false); variable::set("wokwi", false); } diff --git a/cmake/components/rust-{{project-name}}/Cargo.toml b/cmake/components/rust-{{project-name}}/Cargo.toml index 81ca037..8d93085 100644 --- a/cmake/components/rust-{{project-name}}/Cargo.toml +++ b/cmake/components/rust-{{project-name}}/Cargo.toml @@ -4,10 +4,11 @@ version = "0.1.0" authors = ["{{authors}}"] edition = "2021" resolver = "2" -rust-version = "1.71" +rust-version = "1.77" [lib] crate-type = ["staticlib"] +harness = false # do not use the built in cargo test harness -> resolve rust-analyzer errors [profile.release] opt-level = "s" @@ -33,8 +34,8 @@ embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf- [dependencies] log = { version = "0.4", default-features = false } -esp-idf-svc = { version = "0.48", default-features = false } +esp-idf-svc = { version = "0.49", default-features = false } [build-dependencies] -embuild = "0.31.3" +embuild = "0.32.0" {%- endif %}