Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
2 changes: 2 additions & 0 deletions esp-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ 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 = []
__include_rom_coexist_and_phy = []

## 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
9 changes: 9 additions & 0 deletions esp-hal/ld/esp32/linkall.x
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,12 @@ INCLUDE "alias.x"
INCLUDE "esp32.x"
INCLUDE "hal-defaults.x"
INCLUDE "rom-functions.x"

#IF __include_rom_functions
INCLUDE "rom_functions.x"
#ENDIF

#IF __include_rom_coexist_and_phy
INCLUDE "rom_coexist.x"
INCLUDE "rom_phy.x"
#ENDIF
Comment on lines +11 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to keep these on incompatible devices?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given it's an internal feature my thinking was it's doesn't need additional safety belts - we could certainly check it in build.rs if we think we should

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

T.b.h long term we should change esp-wifi-sys to include all rom functions via rom_functions.x but maybe when we have some more interesting reasons to justify a new version

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

#IF __include_rom_functions
INCLUDE "rom_functions.x"
#ENDIF

#IF __include_rom_coexist_and_phy
INCLUDE "rom_coexist.x"
INCLUDE "rom_phy.x"
#ENDIF
9 changes: 9 additions & 0 deletions esp-hal/ld/esp32c3/linkall.x
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ 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

#IF __include_rom_coexist_and_phy
INCLUDE "rom_coexist.x"
INCLUDE "rom_phy.x"
#ENDIF
9 changes: 9 additions & 0 deletions esp-hal/ld/esp32c6/linkall.x
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ 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

#IF __include_rom_coexist_and_phy
INCLUDE "rom_coexist.x"
INCLUDE "rom_phy.x"
#ENDIF
9 changes: 9 additions & 0 deletions esp-hal/ld/esp32h2/linkall.x
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,12 @@ 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

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

#IF __include_rom_functions
INCLUDE "rom_functions.x"
#ENDIF

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

#IF __include_rom_functions
INCLUDE "rom_functions.x"
#ENDIF

#IF __include_rom_coexist_and_phy
INCLUDE "rom_coexist.x"
INCLUDE "rom_phy.x"
#ENDIF
2 changes: 2 additions & 0 deletions esp-ieee802154/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

- Automatically include the necessary linker scripts (#2339)

### Fixed

### Removed
Expand Down
2 changes: 1 addition & 1 deletion esp-ieee802154/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test = false
byte = "0.2.7"
critical-section = "1.1.3"
document-features = "0.2.10"
esp-hal = { version = "0.21.0", path = "../esp-hal" }
esp-hal = { version = "0.21.0", default-features = false, features = ["__include_rom_functions", "__include_rom_coexist_and_phy"], path = "../esp-hal" }
esp-wifi-sys = { version = "0.6.0" }
heapless = "0.8.0"
ieee802154 = "0.6.1"
Expand Down
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
10 changes: 0 additions & 10 deletions examples/build.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
fn main() {
if cfg!(feature = "esp32c6") || cfg!(feature = "esp32h2") {
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(())
}