Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions esp-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ bluetooth = []
usb-otg = ["dep:embassy-usb-driver", "dep:embassy-usb-synopsys-otg", "dep:esp-synopsys-usb-otg", "dep:usb-device"]

__esp_hal_embassy = []
__include_rom_functions = []

## Enable debug features in the HAL (used for development).
debug = [
Expand Down
3 changes: 3 additions & 0 deletions esp-hal/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ fn main() -> Result<(), Box<dyn Error>> {
#[cfg(feature = "flip-link")]
config_symbols.push("flip-link");

#[cfg(feature = "__include_rom_functions")]
config_symbols.push("__include_rom_functions");

// Place all linker scripts in `OUT_DIR`, and instruct Cargo how to find these
// files:
let out = PathBuf::from(env::var_os("OUT_DIR").unwrap());
Expand Down
4 changes: 4 additions & 0 deletions esp-hal/ld/esp32/linkall.x
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ INCLUDE "alias.x"
INCLUDE "esp32.x"
INCLUDE "hal-defaults.x"
INCLUDE "rom-functions.x"

#IF __include_rom_functions
INCLUDE "rom_functions.x"
#ENDIF
4 changes: 4 additions & 0 deletions esp-hal/ld/esp32c2/linkall.x
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ REGION_ALIAS("RWTEXT", IRAM);
INCLUDE "esp32c2.x"
INCLUDE "hal-defaults.x"
INCLUDE "rom-functions.x"

#IF __include_rom_functions
INCLUDE "rom_functions.x"
#ENDIF
4 changes: 4 additions & 0 deletions esp-hal/ld/esp32c3/linkall.x
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ REGION_ALIAS("RTC_FAST_RWDATA", RTC_FAST);
INCLUDE "esp32c3.x"
INCLUDE "hal-defaults.x"
INCLUDE "rom-functions.x"

#IF __include_rom_functions
INCLUDE "rom_functions.x"
#ENDIF
4 changes: 4 additions & 0 deletions esp-hal/ld/esp32c6/linkall.x
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ REGION_ALIAS("RTC_FAST_RWDATA", RTC_FAST);
INCLUDE "esp32c6.x"
INCLUDE "hal-defaults.x"
INCLUDE "rom-functions.x"

#IF __include_rom_functions
INCLUDE "rom_functions.x"
#ENDIF
4 changes: 4 additions & 0 deletions esp-hal/ld/esp32h2/linkall.x
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ REGION_ALIAS("RTC_FAST_RWDATA", RTC_FAST);
INCLUDE "esp32h2.x"
INCLUDE "hal-defaults.x"
INCLUDE "rom-functions.x"

#IF __include_rom_functions
INCLUDE "rom_functions.x"
#ENDIF
4 changes: 4 additions & 0 deletions esp-hal/ld/esp32s2/linkall.x
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ INCLUDE "alias.x"
INCLUDE "esp32s2.x"
INCLUDE "hal-defaults.x"
INCLUDE "rom-functions.x"

#IF __include_rom_functions
INCLUDE "rom_functions.x"
#ENDIF
4 changes: 4 additions & 0 deletions esp-hal/ld/esp32s3/linkall.x
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,7 @@ INCLUDE "alias.x"
INCLUDE "esp32s3.x"
INCLUDE "hal-defaults.x"
INCLUDE "rom-functions.x"

#IF __include_rom_functions
INCLUDE "rom_functions.x"
#ENDIF
2 changes: 2 additions & 0 deletions esp-wifi/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

- No need to manually add `rom_functions.x` to the linker scripts (#2339)

### Fixed

### Removed
Expand Down
2 changes: 1 addition & 1 deletion esp-wifi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ defmt = { version = "0.3.8", optional = true }
log = { version = "0.4.22", optional = true }
document-features = "0.2.10"
esp-alloc = { version = "0.5.0", path = "../esp-alloc", optional = true }
esp-hal = { version = "0.21.0", path = "../esp-hal", default-features = false }
esp-hal = { version = "0.21.0", path = "../esp-hal", default-features = false, features = ["__include_rom_functions"] }
smoltcp = { version = "0.11.0", default-features = false, features = [
"medium-ethernet",
"socket-raw",
Expand Down
15 changes: 15 additions & 0 deletions esp-wifi/MIGRATING-0.10.md
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
# Migration Guide from 0.10.x to v0.11.x

## No need to add `rom_functions.x`

Don't add `rom_functions.x` manually in `build.rs` or `config.toml`

`build.rs`
```diff
- println!("cargo::rustc-link-arg=-Trom_functions.x");
```

`config.toml`
```diff
- "-C", "link-arg=-Trom_functions.x",
```

16 changes: 0 additions & 16 deletions esp-wifi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,6 @@
//! features = ["esp32s3", "wifi", "esp-now"]
//! ```
//!
//! ### Link configuration
//!
//! Make sure to include the rom functions for your target:
//!
//! ```toml
//! # .cargo/config.toml
//! rustflags = [
//! "-C", "link-arg=-Tlinkall.x",
//! "-C", "link-arg=-Trom_functions.x",
//! ]
//! ```
//!
//! At the time of writing, you will already have the `linkall` flag if you used
//! `cargo generate`. Generating from a template does not include the
//! `rom_functions` flag.
//!
//! ### Optimization Level
//!
//! It is necessary to build with optimization level 2 or 3 since otherwise, it
Expand Down
5 changes: 1 addition & 4 deletions examples/build.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
fn main() {
if cfg!(feature = "esp32c6") || cfg!(feature = "esp32h2") {
// TODO this shouldn't be required to be done by the user but done in `linkall.x`
println!("cargo::rustc-link-arg=-Trom_coexist.x");
println!("cargo::rustc-link-arg=-Trom_functions.x");
println!("cargo::rustc-link-arg=-Trom_phy.x");
}

if cfg!(feature = "esp-wifi") {
println!("cargo::rustc-link-arg=-Trom_functions.x");
}

// Allow building examples in CI in debug mode
println!("cargo:rustc-check-cfg=cfg(is_not_release)");
println!("cargo:rerun-if-env-changed=CI");
Expand Down
4 changes: 0 additions & 4 deletions hil-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,5 @@ fn main() -> Result<(), Box<dyn Error>> {
// Define all necessary configuration symbols for the configured device:
config.define_symbols();

if cfg!(feature = "esp-wifi") {
println!("cargo::rustc-link-arg=-Trom_functions.x");
}

Ok(())
}