Skip to content

Commit

Permalink
some wip on custom includes
Browse files Browse the repository at this point in the history
  • Loading branch information
bradjc committed Jul 3, 2024
1 parent d07f071 commit cc62c80
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 30 deletions.
28 changes: 1 addition & 27 deletions boards/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,2 @@
# Licensed under the Apache License, Version 2.0 or the MIT License.
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Copyright Tock Contributors 2024.
include = "../cargo.config.toml"

[build]
rustflags = [
"-C", "linker=rust-lld",
# Use the LLVM lld executable with the `-flavor gnu` flag.
"-C", "linker-flavor=ld.lld",
# Use static relocation model. See https://github.com/tock/tock/pull/2853
"-C", "relocation-model=static",
# lld by default uses a default page size to align program sections. Tock
# expects that program sections are set back-to-back. `-nmagic` instructs the
# linker to not page-align sections.
"-C", "link-arg=-nmagic",
# Identical Code Folding (ICF) set to all. This tells the linker to be more
# aggressive about removing duplicate code. The default is `safe`, and the
# downside to `all` is that different functions in the code can end up with
# the same address in the binary. However, it can save a fair bit of code
# size.
"-C", "link-arg=-icf=all",
# Opt-in to Rust v0 symbol mangling scheme. See
# https://github.com/rust-lang/rust/issues/60705 and
# https://github.com/tock/tock/issues/3529.
"-C", "symbol-mangling-version=v0",
# Enable link-time-optimization
"-C", "lto",
]
2 changes: 1 addition & 1 deletion boards/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ fn main() {
}

println!("cargo:rustc-link-arg=-L{}", std::env!("CARGO_MANIFEST_DIR"));
println!("cargo:rustc-link-arg=-T{}", LINKER_SCRIPT);
// println!("cargo:rustc-link-arg=-T{}", LINKER_SCRIPT);

track_linker_script(LINKER_SCRIPT);
}
Expand Down
28 changes: 28 additions & 0 deletions boards/cargo.config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Licensed under the Apache License, Version 2.0 or the MIT License.
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Copyright Tock Contributors 2024.

[build]
rustflags = [
"-C", "linker=rust-lld",
# Use the LLVM lld executable with the `-flavor gnu` flag.
"-C", "linker-flavor=ld.lld",
# Use static relocation model. See https://github.com/tock/tock/pull/2853
"-C", "relocation-model=static",
# lld by default uses a default page size to align program sections. Tock
# expects that program sections are set back-to-back. `-nmagic` instructs the
# linker to not page-align sections.
"-C", "link-arg=-nmagic",
# Identical Code Folding (ICF) set to all. This tells the linker to be more
# aggressive about removing duplicate code. The default is `safe`, and the
# downside to `all` is that different functions in the code can end up with
# the same address in the binary. However, it can save a fair bit of code
# size.
"-C", "link-arg=-icf=all",
# Opt-in to Rust v0 symbol mangling scheme. See
# https://github.com/rust-lang/rust/issues/60705 and
# https://github.com/tock/tock/issues/3529.
"-C", "symbol-mangling-version=v0",
# Enable link-time-optimization
"-C", "lto",
]
6 changes: 5 additions & 1 deletion boards/teensy40/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ target = "thumbv7em-none-eabi"

[unstable]
unstable-options = true
build-std = ["core", "compiler_builtins" ]
build-std = ["core", "compiler_builtins" ]




11 changes: 10 additions & 1 deletion boards/wm1110dev/.cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Copyright Tock Contributors 2024.


include = "../../cargo.config.toml"

[build]
target = "thumbv7em-none-eabi"
rustflags = [
"-C", "linker-flavor=ld.lld",
]


[unstable]
config-include = true
unstable-options = true
build-std = ["core", "compiler_builtins" ]
build-std = ["core", "compiler_builtins" ]

2 changes: 2 additions & 0 deletions boards/wm1110dev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Copyright Tock Contributors 2023.

include = "../cargo.config.toml"

[package]
name = "wm1110dev"
version.workspace = true
Expand Down

0 comments on commit cc62c80

Please sign in to comment.