Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically add rom_functions.x to the linker scripts #2339

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 3 additions & 0 deletions esp-hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ octal-psram = []
# This feature is intended for testing; you probably don't want to enable it:
ci = ["defmt", "bluetooth"]

# Internal feature set by esp-wifi
__include_rom_functions = []
jessebraham marked this conversation as resolved.
Show resolved Hide resolved

[lints.clippy]
mixed_attributes_style = "allow"

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: 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
4 changes: 0 additions & 4 deletions examples/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ fn main() {
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
Loading