From 89c52800b71b54da7b944e11c9b02b946fd5bc85 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 5 Feb 2025 11:35:52 +0100 Subject: [PATCH 1/2] update project files --- .cargo/config.toml | 30 +++++++++++++++++++++++++++++ esp-hal-smartled/.cargo/config.toml | 14 ++++++++++++++ esp-hal-smartled/.gitignore | 2 ++ rust-toolchain-risc-v.toml | 4 ++++ rust-toolchain-xtensa.toml | 2 ++ 5 files changed, 52 insertions(+) create mode 100644 .cargo/config.toml create mode 100644 esp-hal-smartled/.gitignore create mode 100644 rust-toolchain-risc-v.toml create mode 100644 rust-toolchain-xtensa.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..f5f2506 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,30 @@ +[alias] +esp32 = "run --release --features=esp32 --target=xtensa-esp32-none-elf" +esp32c2 = "run --release --features=esp32c2 --target=riscv32imc-unknown-none-elf" +esp32c3 = "run --release --features=esp32c3 --target=riscv32imc-unknown-none-elf" +esp32c6 = "run --release --features=esp32c6 --target=riscv32imac-unknown-none-elf" +esp32h2 = "run --release --features=esp32h2 --target=riscv32imac-unknown-none-elf" +esp32s2 = "run --release --features=esp32s2 --target=xtensa-esp32s2-none-elf" +esp32s3 = "run --release --features=esp32s3 --target=xtensa-esp32s3-none-elf" + +[target.'cfg(target_arch = "riscv32")'] +runner = "espflash flash --monitor" +rustflags = [ + "-C", "link-arg=-Tlinkall.x", + "-C", "force-frame-pointers", +] + +[target.'cfg(target_arch = "xtensa")'] +runner = "espflash flash --monitor" +rustflags = [ + # GNU LD + "-C", "link-arg=-Wl,-Tlinkall.x", + "-C", "link-arg=-nostartfiles", + + # LLD + # "-C", "link-arg=-Tlinkall.x", + # "-C", "linker=rust-lld", +] + +[unstable] +build-std = ["alloc", "core"] diff --git a/esp-hal-smartled/.cargo/config.toml b/esp-hal-smartled/.cargo/config.toml index 444af9a..37748e8 100644 --- a/esp-hal-smartled/.cargo/config.toml +++ b/esp-hal-smartled/.cargo/config.toml @@ -1,10 +1,21 @@ +[alias] +esp32 = "check --release --features=esp32 --target=xtensa-esp32-none-elf" +esp32c2 = "check --release --features=esp32c2 --target=riscv32imc-unknown-none-elf" +esp32c3 = "check --release --features=esp32c3 --target=riscv32imc-unknown-none-elf" +esp32c6 = "check --release --features=esp32c6 --target=riscv32imac-unknown-none-elf" +esp32h2 = "check --release --features=esp32h2 --target=riscv32imac-unknown-none-elf" +esp32s2 = "check --release --features=esp32s2 --target=xtensa-esp32s2-none-elf" +esp32s3 = "check --release --features=esp32s3 --target=xtensa-esp32s3-none-elf" + [target.'cfg(target_arch = "riscv32")'] +runner = "espflash flash --monitor" rustflags = [ "-C", "link-arg=-Tlinkall.x", "-C", "force-frame-pointers", ] [target.'cfg(target_arch = "xtensa")'] +runner = "espflash flash --monitor" rustflags = [ # GNU LD "-C", "link-arg=-Wl,-Tlinkall.x", @@ -14,3 +25,6 @@ rustflags = [ # "-C", "link-arg=-Tlinkall.x", # "-C", "linker=rust-lld", ] + +[unstable] +build-std = ["alloc", "core"] diff --git a/esp-hal-smartled/.gitignore b/esp-hal-smartled/.gitignore new file mode 100644 index 0000000..586597d --- /dev/null +++ b/esp-hal-smartled/.gitignore @@ -0,0 +1,2 @@ +# Ignore file because it will be different based on test target. +/rust-toolchain.toml diff --git a/rust-toolchain-risc-v.toml b/rust-toolchain-risc-v.toml new file mode 100644 index 0000000..14c7c83 --- /dev/null +++ b/rust-toolchain-risc-v.toml @@ -0,0 +1,4 @@ +[toolchain] +channel = "stable" +components = ["rust-src"] +targets = ["riscv32imac-unknown-none-elf", "riscv32imac-unknown-none-elf"] diff --git a/rust-toolchain-xtensa.toml b/rust-toolchain-xtensa.toml new file mode 100644 index 0000000..a2f5ab5 --- /dev/null +++ b/rust-toolchain-xtensa.toml @@ -0,0 +1,2 @@ +[toolchain] +channel = "esp" From c06ae2cccc3dceda96044a5b4b0bcac637b4480b Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Wed, 5 Feb 2025 12:18:04 +0100 Subject: [PATCH 2/2] set default target to RiscV IMAC --- .cargo/config.toml | 7 +++++++ esp-hal-smartled/.cargo/config.toml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/.cargo/config.toml b/.cargo/config.toml index f5f2506..e54768c 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -7,6 +7,13 @@ esp32h2 = "run --release --features=esp32h2 --target=riscv32imac-unknown-none-el esp32s2 = "run --release --features=esp32s2 --target=xtensa-esp32s2-none-elf" esp32s3 = "run --release --features=esp32s3 --target=xtensa-esp32s3-none-elf" +[build] +target = "riscv32imac-unknown-none-elf" +# target = "riscv32imc-unknown-none-elf" +# target = "xtensa-esp32s2-none-elf" +# target = "xtensa-esp32s3-none-elf" +# target = "xtensa-esp32-none-elf" + [target.'cfg(target_arch = "riscv32")'] runner = "espflash flash --monitor" rustflags = [ diff --git a/esp-hal-smartled/.cargo/config.toml b/esp-hal-smartled/.cargo/config.toml index 37748e8..a9a7993 100644 --- a/esp-hal-smartled/.cargo/config.toml +++ b/esp-hal-smartled/.cargo/config.toml @@ -7,6 +7,13 @@ esp32h2 = "check --release --features=esp32h2 --target=riscv32imac-unknown-none- esp32s2 = "check --release --features=esp32s2 --target=xtensa-esp32s2-none-elf" esp32s3 = "check --release --features=esp32s3 --target=xtensa-esp32s3-none-elf" +[build] +target = "riscv32imac-unknown-none-elf" +# target = "riscv32imc-unknown-none-elf" +# target = "xtensa-esp32s2-none-elf" +# target = "xtensa-esp32s3-none-elf" +# target = "xtensa-esp32-none-elf" + [target.'cfg(target_arch = "riscv32")'] runner = "espflash flash --monitor" rustflags = [