Skip to content

Commit

Permalink
New release
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Oct 26, 2023
1 parent bbecb3b commit dd452d6
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.33.4] - 2023-10-27
* The `MCU` environment variable was failing the `pio` build if the MCU was not uppercased
* Better error message for the `native` build in case the MCU was not recognized

## [0.33.3] - 2023-10-17
* Support for ESP IDF Component Manager - check the documentation in BUILD-OPTIONS.md
* ESP32H2 and ESP32C5 now properly assigned to the `riscv32imac-esp-espidf`
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "esp-idf-sys"
version = "0.33.3"
version = "0.33.4"
authors = ["Alexey Arbuzov <[email protected]>", "sapir <[email protected]>", "Ivan Markov <[email protected]>", "Dominik Gschwind <[email protected]>"]
edition = "2021"
resolver = "2"
Expand Down
15 changes: 9 additions & 6 deletions build/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,15 @@ fn main() -> anyhow::Result<()> {
.collect(),
};

let mcu = cfg_args.get("esp_idf_idf_target").ok_or_else(|| {
anyhow!(
"Failed to get IDF_TARGET from kconfig. cfgs:\n{:?}",
cfg_args.args
)
})?;
let mcu = cfg_args
.get("esp_idf_idf_target")
.ok_or_else(|| {
anyhow!(
"Failed to get IDF_TARGET from kconfig. cfgs:\n{:?}",
cfg_args.args
)
})?
.to_lowercase();

let manifest_dir = manifest_dir()?;

Expand Down
22 changes: 16 additions & 6 deletions build/native/cargo_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ use embuild::fs::copy_file_if_different;
use embuild::utils::{OsStrExt, PathExt};
use embuild::{bindgen, build, cargo, cmake, espidf, git, kconfig, path_buf};

use strum::IntoEnumIterator;

use self::chip::Chip;
use crate::common::{
self, list_specific_sdkconfigs, manifest_dir, sanitize_c_env_vars, sanitize_project_path,
Expand Down Expand Up @@ -44,16 +46,24 @@ pub fn build() -> Result<EspIdfBuildOutput> {
let supported_chips = Chip::detect(&target)?;

let chip = if let Some(mcu) = &config.mcu {
let chip = Chip::from_str(mcu)?;
if let Ok(chip) = Chip::from_str(mcu) {
if !supported_chips.iter().any(|sc| *sc == chip) {
bail!(
"Specified MCU '{chip}' is not amongst the MCUs ([{}]) supported by the build target ('{target}')",
supported_chips.iter().map(|chip| format!("{chip}")).collect::<Vec<_>>().join(", ")
);
}

if !supported_chips.iter().any(|sc| *sc == chip) {
chip
} else {
bail!(
"Specified MCU '{chip}' is not amongst the MCUs ([{}]) supported by the build target ('{target}')",
supported_chips.iter().map(|chip| format!("{chip}")).collect::<Vec<_>>().join(", ")
"Specified MCU '{mcu}' is not recognized as a valid Espressif MCU amongst [{}]",
Chip::iter()
.map(|chip| chip.to_string())
.collect::<Vec<_>>()
.join(", ")
);
}

chip
} else {
if supported_chips.len() > 1 {
println!(
Expand Down
4 changes: 2 additions & 2 deletions build/native/cargo_driver/chip.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
//! ESP32 chip variants support.
use anyhow::{bail, Result};
use strum::{Display, EnumString};
use strum::{Display, EnumIter, EnumString};

use embuild::espidf::EspIdfVersion;

#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, EnumString)]
#[derive(Clone, Copy, PartialEq, Eq, Debug, Display, EnumString, EnumIter)]
#[repr(u32)]
pub enum Chip {
/// Xtensa LX6 based dual core
Expand Down
2 changes: 1 addition & 1 deletion build/pio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ pub fn build() -> Result<EspIdfBuildOutput> {
.params(pio::ResolutionParams {
platform: Some("espressif32".into()),
frameworks: vec!["espidf".into()],
mcu: config.mcu.clone(),
mcu: config.mcu.clone().map(|mcu| mcu.to_uppercase()), // MCU always uppercase in PlatformIO
target: Some(env::var("TARGET")?),
..Default::default()
})
Expand Down

0 comments on commit dd452d6

Please sign in to comment.