Skip to content

Commit

Permalink
update to new esp-idf release versions (#209)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Vollbrecht authored Jun 23, 2024
1 parent 13b60a4 commit 18d57bf
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 42 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/ci_cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci_cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- hal: false
std: false
esp-idf:
- version: v5.1
- version: v5.2
# - version: master
# name: master
steps:
Expand Down
19 changes: 6 additions & 13 deletions cargo/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}
Expand All @@ -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"
6 changes: 3 additions & 3 deletions cargo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}"
Expand Down Expand Up @@ -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"
12 changes: 3 additions & 9 deletions cargo/cargo-generate.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion cargo/pre-script.rhai
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
7 changes: 4 additions & 3 deletions cmake/components/rust-{{project-name}}/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 %}

0 comments on commit 18d57bf

Please sign in to comment.