esp-hal/esp-phy/build.rs
Simon Neuenhausen 8e29b925cb
Split out PHY init into esp-phy crate. (#3892)
* Minimal infrastructure

* Implemented dig reg backup.

* usb bbpll

* Removed default feature.

* OS adapter tweaks

* Fixed S2 and implemented PhyController

* Added manual deinit.

* Fixed linker scripts and migrated esp-radio to esp-phy

* Fixed warnings.

* Fixed NPL

* Tried fixing NPL again

* Fixed ieee802154

* Fixed reading chip version of S3.

* fmt

* Added changelog entry

* Added changelog for esp-radio

* Deleted chip specific common adapters.

* Added docs and unstable

* Migrated cal data load/store to esp-phy

* Fixed PHY cal CI error

* Removed instability

* Removed feature from esp-phy

* fmt

* Fixed esp-sync docs.

* Removed log with CONFIG

* Removed nonreentrantmutex from common adapter

* Disable reset for radio blocks where required.

* Fixed cfg_if for s2

* fmt

* Added bt_bb_v2_init_cmplx to phy_provides.x

* Added CHANGELOG

* Moved EXTERN and fixed comment.

* Fixed lint

* Fixed common adapter again.

* Docs and Readme.

* Fixed ref count.

* This time pls.

* Added MAC time update CB for esp-radio

* fixed field init

* Fixed inconsistency in metadata

* Removed useless changelog entry

* Fixed S2.

* Swaped addr_of for &raw mut

* Properly initialize NVS

* Fixed lint

* Fixed C6

* Fixed remaining issues

* Fixed CI

* Added link

* Updated esp-wifi-sys in esp-phy

* Address reviews

* Renamed PHY lock

* Moved syscon let in common_adapter

* Fmt

* Remove critical_section

* Don't steal when not necessary

* Added esp-phy changelog to workflow

* Add cargo metadata for esp-phy

* Added reference to #4015

* Refixed Cargo.toml

---------

Co-authored-by: Dániel Buga <bugadani@gmail.com>
2025-09-19 14:14:25 +00:00

30 lines
1.1 KiB
Rust

use std::error::Error as StdError;
use esp_config::generate_config_from_yaml_definition;
fn main() -> Result<(), Box<dyn StdError>> {
// Load the configuration for the configured device:
let chip = esp_metadata_generated::Chip::from_cargo_feature()?;
// Define all necessary configuration symbols for the configured device:
chip.define_cfgs();
println!("cargo:rerun-if-changed=./esp_config.yml");
let cfg_yaml = std::fs::read_to_string("./esp_config.yml")
.expect("Failed to read esp_config.yml for esp-phy");
let _cfg = generate_config_from_yaml_definition(&cfg_yaml, true, true, Some(chip)).unwrap();
let out = std::path::PathBuf::from(std::env::var_os("OUT_DIR").unwrap());
println!("cargo:rustc-link-search={}", out.display());
let linker_script = "phy_provides.x";
let out_file = out.join("libesp-phy.a");
let _ = std::fs::copy(linker_script, out_file);
println!("cargo:rerun-if-changed={linker_script}");
// exploit the fact that linkers treat an unknown library format as a linker
// script
println!("cargo:rustc-link-lib=esp-phy");
Ok(())
}