diff --git a/build/common.rs b/build/common.rs index 07bc559ea80..74d577a2f72 100644 --- a/build/common.rs +++ b/build/common.rs @@ -19,6 +19,9 @@ pub const V_4_3_2_PATCHES: &[&str] = &[ "patches/pthread_destructor_fix.diff", ]; +#[allow(dead_code)] +pub const MASTER_PATCHES: &[&str] = &["patches/i2s_types_master.diff"]; + const TOOLS_WORKSPACE_INSTALL_DIR: &str = ".embuild"; pub struct EspIdfBuildOutput { diff --git a/build/native/cargo_driver.rs b/build/native/cargo_driver.rs index 0ffc0c605f3..1dcea905ba1 100644 --- a/build/native/cargo_driver.rs +++ b/build/native/cargo_driver.rs @@ -17,7 +17,7 @@ use embuild::{bindgen, build, cargo, cmake, espidf, git, kconfig, path_buf}; use self::chip::Chip; use crate::common::{ self, list_specific_sdkconfigs, manifest_dir, workspace_dir, EspIdfBuildOutput, - EspIdfComponents, InstallDir, V_4_3_2_PATCHES, + EspIdfComponents, InstallDir, MASTER_PATCHES, V_4_3_2_PATCHES, }; use crate::config::{BuildConfig, ESP_IDF_GLOB_VAR_PREFIX, ESP_IDF_TOOLS_INSTALL_DIR_VAR}; @@ -77,6 +77,12 @@ pub fn build() -> Result { Ok(tools) }; + // The `kconfig.cmake` script looks at this variable if it should compile `mconf` on + // windows. `idf_tools.py` also fails when this variable is set because it thinks + // we're using msys/cygwin. + // But this variable is also present when using git-bash. + env::remove_var("MSYSTEM"); + // Get the install dir location from the build config, or use // [`crate::config::DEFAULT_TOOLS_INSTALL_DIR`] if unset. let (install_dir, allow_from_env) = config.esp_idf_tools_install_dir()?; @@ -159,7 +165,7 @@ pub fn build() -> Result { // master branch _ if idf.repository.get_default_branch()? == idf.repository.get_branch_name()? => &[], Ok((4, 4, _)) => &[], - Ok((4, 3, patch)) if patch > 2 => &[], + Ok((4, 3, patch)) if patch > 2 => MASTER_PATCHES, Ok((4, 3, patch)) if patch == 2 => V_4_3_2_PATCHES, Ok((major, minor, patch)) => { cargo::print_warning(format_args!( @@ -182,10 +188,6 @@ pub fn build() -> Result { env::set_var("PATH", &idf.exported_path); - // The `kconfig.cmake` script looks at this variable if it should compile `mconf` on windows. - // But this variable is also present when using git-bash which doesn't have gcc. - env::remove_var("MSYSTEM"); - // Remove the sdkconfig file generated by the esp-idf so that potential changes // in the user provided sdkconfig and sdkconfig.defaults don't get ignored. // TODO: I'm really not sure why we have to do this. diff --git a/patches/i2s_types_master.diff b/patches/i2s_types_master.diff new file mode 100644 index 00000000000..90ebf835f92 --- /dev/null +++ b/patches/i2s_types_master.diff @@ -0,0 +1,16 @@ +diff --git a/components/driver/include/driver/i2s_types.h b/components/driver/include/driver/i2s_types.h +index 84cd39241b40eed7885378da73771d418d75c331..f09a6fc06831992c7819e04a3cdf4b98867b4f56 100644 +--- a/components/driver/include/driver/i2s_types.h ++++ b/components/driver/include/driver/i2s_types.h +@@ -63,7 +63,11 @@ typedef struct { + */ + } i2s_event_data_t; + ++#ifdef __bindgen ++typedef void *i2s_chan_handle_t; /*!< i2s channel handle, the control unit of the i2s driver*/ ++#else + typedef struct i2s_channel_t *i2s_chan_handle_t; /*!< i2s channel handle, the control unit of the i2s driver*/ ++#endif + + /** + * @brief I2S event callback