Skip to content

Commit

Permalink
add support for esp32s2
Browse files Browse the repository at this point in the history
  • Loading branch information
suapapa committed Dec 15, 2024
1 parent 85ff240 commit 69a70bc
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ci-esp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ cd $test_dir

# generation
$cwd/target/release/cargo-embassy embassy init test-esp32c3 --chip esp32c3
$cwd/target/release/cargo-embassy embassy init test-esp32s2 --chip esp32s2
$cwd/target/release/cargo-embassy embassy init test-esp32s3 --chip esp32s3

# esp toolchain
Expand All @@ -33,6 +34,7 @@ fi

# compile
cd $test_dir/test-esp32c3; cargo build --release
cd $test_dir/test-esp32s2; cargo build --release
cd $test_dir/test-esp32s3; cargo build --release

# clean up
Expand Down
1 change: 1 addition & 0 deletions src/chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ impl FromStr for Chip {
("stm32wl", (STM, Thumbv7e)),
// ESP32
("esp32c3", (ESP(Variant::C3), Risc32Imc)),
("esp32s2", (ESP(Variant::S2), XTensaS2)),
("esp32s3", (ESP(Variant::S3), XTensaS3)),
];

Expand Down
2 changes: 2 additions & 0 deletions src/chip/family/esp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ use std::fmt::Display;
#[derive(Clone, Debug)]
pub enum Variant {
C3,
S2,
S3,
}

impl Display for Variant {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(match self {
Self::C3 => "esp32c3",
Self::S2 => "esp32s2",
Self::S3 => "esp32s3",
})
}
Expand Down
2 changes: 2 additions & 0 deletions src/chip/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub enum Target {
Thumbv7e,
Thumbv7f,
Thumbv8,
XTensaS2,
XTensaS3,
Risc32Imc,
}
Expand All @@ -19,6 +20,7 @@ impl Display for Target {
Self::Thumbv7e => "thumbv7em-none-eabi",
Self::Thumbv7f => "thumbv7em-none-eabihf",
Self::Thumbv8 => "thumbv8m.main-none-eabihf",
Self::XTensaS2 => "xtensa-esp32s2-none-elf",
Self::XTensaS3 => "xtensa-esp32s3-none-elf",
Self::Risc32Imc => "riscv32imc-unknown-none-elf",
})
Expand Down
1 change: 1 addition & 0 deletions src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ impl Init {
target = chip.target,
rustflags = match variant {
Variant::C3 => "rustflags = [\n\"-C\", \"force-frame-pointers\",\n]",
Variant::S2 => "rustflags = [\n\"-C\", \"link-arg=-nostartfiles\",\n]",
Variant::S3 => "rustflags = [\n\"-C\", \"link-arg=-nostartfiles\",\n]",
}
),
Expand Down

0 comments on commit 69a70bc

Please sign in to comment.