8000 Compile without Make / migrate flags to `.cargo/config.toml` by alevy · Pull Request #4054 · tock/tock · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Compile without Make / migrate flags to .cargo/config.toml #4054

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

Closed
wants to merge 22 commits into from

Conversation

alevy
Copy link
Member
@alevy alevy commented Jun 29, 2024

Pull Request Overview

Adds support to all boards for building using plain-old-cargo in an identical way to using the Makefile infrastructure.

Without this change, in order to build with cargo , one needs a large number of RUSTCFLAGS along with cargo-specific arguments. With this change, simply:

$ cd boards/[BOARD-OF-CHOICE]
$ cargo build --release

Uses exactly the same RUSTFLAGS arguments, linker, linker arguments etc.

One additional argument (-Ztrim-paths) results in identical binaries by remapping paths:

$ cargo build -Ztrim-paths --release

This is done by adding two layers of .cargo/config.toml files:

  1. A common one in boards/.cargo/config.toml, which specifies non-target-specific RUSTFLAGS
  2. Each board has an additional .cargo/config.toml that specifies the default target for building with cargo, and the -Zbuild-std option to recompile core, as that it is a board-specific choice (not possible for boards we want to compile with stable Rust)

With this change, it is also easy to use tools such as cargo-binutils and probe-rs which rely on being able to run cargo build with normal arguments. For example, in the sma_q3 board, it is now possible to flash and attach the JLink RTT by simply installing probe-rs and running:

cargo embed --release

Testing Strategy

I manually compiled each board using make and cargo build -Ztrim-paths --release and validated that text, bss, and data segments are identical sizes and sampled that several boards function in both cases by flashing them. Though this should have no impact on normal make-based workflows.

TODO or Help Wanted

N/A

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@bradjc
Copy link
Contributor
bradjc commented Jul 1, 2024

I don't understand how this works. What am I missing:

cd hail
make V=1
...
    Finished release [optimized + debuginfo] target(s) in 25.00s
"/Users/bradjc/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/llvm"-size  /Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail
   text	   data	    bss	    dec	    hex	filename
 111714	     32	  19872	 131618	  20222	/Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail
cp /Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail /Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail.elf
"/Users/bradjc/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/x86_64-apple-darwin/bin/llvm"-objcopy --output-target=binary --strip-sections --strip-all --remove-section .apps /Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail.elf /Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail.bin
sha256sum /Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail.bin
5ac301d8d04fdbb63d238bd719846364a8efbaf61563b33759dcef3674ce9ec8  /Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail.bin
❯ rm -rf ../.cargo
❯ make
    Finished release [optimized + debuginfo] target(s) in 0.08s
   text	   data	    bss	    dec	    hex	filename
 111714	     32	  19872	 131618	  20222	/Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail
5ac301d8d04fdbb63d238bd719846364a8efbaf61563b33759dcef3674ce9ec8  /Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail.bin
❯ touch src/main.rs
❯ make
   Compiling hail v0.1.0 (/Users/bradjc/git/tock/boards/hail)
    Finished release [optimized + debuginfo] target(s) in 12.35s
   text	   data	    bss	    dec	    hex	filename
 111714	     32	  19872	 131618	  20222	/Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail
5ac301d8d04fdbb63d238bd719846364a8efbaf61563b33759dcef3674ce9ec8  /Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail.bin

The presence of the boards/.cargo directory has no impact on the built .bin file?

@alevy
Copy link
Member Author
alevy commented Jul 1, 2024

@bradjc Yes, most of these optimization arguments actually have relatively little or no impact beyond LTO most of the time on the more recent compilers.

@alevy
Copy link
Member Author
alevy commented Jul 1, 2024

@bradjc It also looks like you might be on a slightly different version. When I compile from master I get sizes similar to yours above, but from this branch, it's about 3KB smaller

@alevy alevy force-pushed the feature/compile-without-make branch from ced02b2 to 98ed88a Compare July 1, 2024 22:27
@github-actions github-actions bot added nrf Change pertains to the nRF5x family of MCUs. tock-libraries This affects libraries supported by the Tock project WG-OpenTitan In the purview of the OpenTitan working group. WG-Network In the purview of the Network working group. labels Jul 1, 2024
@bradjc
Copy link
Contributor
bradjc commented Jul 1, 2024

So these flags don't do anything? Why are we setting them?

On master if I make this diff:

diff --git a/boards/Makefile.common b/boards/Makefile.common
index ab35928fa..3c276cd9a 100644
--- a/boards/Makefile.common
+++ b/boards/Makefile.common
@@ -64,9 +64,6 @@ TARGET_DIRECTORY ?= $(TOCK_ROOT_DIRECTORY)target/
 #   See https://github.com/rust-lang/rust/issues/60705 and
 #   https://github.com/tock/tock/issues/3529.
 RUSTC_FLAGS ?= \
-  -C link-arg=-Tlayout.ld \
-  -C linker=rust-lld \
-  -C linker-flavor=ld.lld \
   -C relocation-model=static \
   -C link-arg=-nmagic \
   -C link-arg=-icf=all \

I get:

❯ make
   Compiling tock-registers v0.9.0 (/Users/bradjc/git/tock/libraries/tock-register-interface)
   Compiling tock-cells v0.1.0 (/Users/bradjc/git/tock/libraries/tock-cells)
   Compiling tock-tbf v0.1.0 (/Users/bradjc/git/tock/libraries/tock-tbf)
   Compiling tickv v1.0.0 (/Users/bradjc/git/tock/libraries/tickv)
   Compiling enum_primitive v0.1.0 (/Users/bradjc/git/tock/libraries/enum_primitive)
   Compiling kernel v0.1.0 (/Users/bradjc/git/tock/kernel)
   Compiling cortexm v0.1.0 (/Users/bradjc/git/tock/arch/cortex-m)
   Compiling cortexv7m v0.1.0 (/Users/bradjc/git/tock/arch/cortex-v7m)
   Compiling capsules-core v0.1.0 (/Users/bradjc/git/tock/capsules/core)
   Compiling capsules-system v0.1.0 (/Users/bradjc/git/tock/capsules/system)
   Compiling cortexm4 v0.1.0 (/Users/bradjc/git/tock/arch/cortex-m4)
   Compiling sam4l v0.1.0 (/Users/bradjc/git/tock/chips/sam4l)
   Compiling capsules-extra v0.1.0 (/Users/bradjc/git/tock/capsules/extra)
   Compiling components v0.1.0 (/Users/bradjc/git/tock/boards/components)
   Compiling hail v0.1.0 (/Users/bradjc/git/tock/boards/hail)
    Finished release [optimized + debuginfo] target(s) in 20.06s
   text	   data	    bss	    dec	    hex	filename
      0	      0	      0	      0	      0	/Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855  /Users/bradjc/git/tock/target/thumbv7em-none-eabi/release/hail.bin

Which makes sense I think.

But on commit 98ed88a if I entirely delete boards/.cargo it builds just fine. That seems like it shouldn't be the case? How does one know which flags are getting set? How is it choosing the linker?

@alevy
Copy link
Member Author
alevy commented Jul 2, 2024

Don't remove the layout.ld line from the Makefile (this is an oversight on my branch, it's being set in build.rs now, so that line in the cargo toml is redundant, will fix)

@alevy
Copy link
Member Author
alevy commented Jul 2, 2024

Specifically, on master this change results in the same size:

diff --git a/boards/Makefile.common b/boards/Makefile.common
index ab35928fa..045c8ec6b 100644
--- a/boards/Makefile.common
+++ b/boards/Makefile.common
@@ -65,12 +65,6 @@ TARGET_DIRECTORY ?= $(TOCK_ROOT_DIRECTORY)target/
 #   https://github.com/tock/tock/issues/3529.
 RUSTC_FLAGS ?= \
   -C link-arg=-Tlayout.ld \
-  -C linker=rust-lld \
-  -C linker-flavor=ld.lld \
-  -C relocation-model=static \
-  -C link-arg=-nmagic \
-  -C link-arg=-icf=all \
-  -C symbol-mangling-version=v0 \

 # RISC-V-specific flags.
 ifneq ($(findstring riscv32i, $(TARGET)),)

before and after both:

  text	   data	    bss	    dec	    hex	filename
 112642	     32	  19864	 132538	  205ba	/home/alevy/hack/tock/tock/target/thumbv7em-none-eabi/release/hail
1f03384de063e1b0ae85f753b5bdb13b859f187db4562053986ff05a1fc939a1  /home/alevy/hack/tock/tock/target/thumbv7em-none-eabi/release/hail.bin
sh

@alevy
Copy link
Member Author
alevy commented Jul 2, 2024

Don't remove the layout.ld line from the Makefile (this is an oversight on my branch, it's being set in build.rs now, so that line in the cargo toml is redundant, will fix)

Fixed in 33980aa

@bradjc
Copy link
Contributor
bradjc commented Jul 2, 2024

Can you rebase?

@ppannuto
Copy link
Member
ppannuto commented Jul 2, 2024

Man.. 4 years old now: rust-lang/cargo#8244

The linked tracking issues ( rust-lang/cargo#12738 , rust-lang/cargo#12739 ) seem like they would help alleviate a lot of this, but those have a lot of open issues and not a lot of progress :(

@alevy
Copy link
Member Author
alevy commented Jul 2, 2024

@lschuermann @bradjc out of tree, it is not necessary to have two separate .cargo/config.toml. If there is only one board (or several boards with the same settings, which is very likely the very common case), you can (and should) have only one .cargo/config.toml for the repo which just includes all the settings

@ppannuto
Copy link
Member
ppannuto commented Jul 2, 2024

IIUC, can we now pass a custom path for config.toml to cargo? 👀 https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides 👀

That would be a best of both worlds (... I suppose only assuming that this custom path can be specified in the Cargo.toml file so tooling picks it up automatically)

@alevy
Copy link
Member Author
alevy commented Jul 2, 2024

To be clear, to everyone reading, the .cargo/config.toml files are actually totally unnecessary to strictly build/compile a board. You only need to set a target (which is relatively simple to do on command line) and set a linker script, which in this PR is done in build.rs. The rest is just for applying various optimizations. In practice, some of those optimizations are questionable to include in a particular (out of tree) board. For example, virtual function elimination (which we currently enable only on opentitan) is very effective and somewhat dangerous. As Brad notes, the other settings may have no actual effect on a particular board/configuration. Many basic optimizations (LTO, codegen units, etc) are included in normal Cargo.toml.

So the real lesson here is that we need almost no machinery to compile a board with Cargo, except to the extent that we include optimizations automatically without making them explicit on the command line.

My contention is that the Makefile system obscures this (Makefile.common is a feat of engineering that is also quite hard to read and understand in practice). Hidden .cargo folders are an anti-feature, but otherwise makes settings and findings these more inline with the typical way of doing this for Rust projects and makes interfacing with other tools that expect typical Rust project setups work more seemlessly.

@bradjc
Copy link
Contributor
bradjc commented Jul 2, 2024

To be clear, to everyone reading, the .cargo/config.toml files are actually totally unnecessary to strictly build/compile a board. You only need to set a target (which is relatively simple to do on command line) and set a linker script, which in this PR is done in build.rs. The rest is just for applying various optimizations.

This is true until it isn't. Things will break eventually without the -nmagic flag, for example, and no one wants to be debugging that. When I asked if these flags were needed in an earlier post, I was questioning if perhaps they became the default.

In practice, some of those optimizations are questionable to include in a particular (out of tree) board. For example, virtual function elimination (which we currently enable only on opentitan) is very effective and somewhat dangerous. As Brad notes, the other settings may have no actual effect on a particular board/configuration. Many basic optimizations (LTO, codegen units, etc) are included in normal Cargo.toml.

So the real lesson here is that we need almost no machinery to compile a board with Cargo, except to the extent that we include optimizations automatically without making them explicit on the command line.

This is fair, with that one pretty significant caveat (nmagic).

In general this is one of my major concerns, critical flags that get hidden/lost amid a general sense of those flags are just optimizations, and then when someone doesn't use them they spend a long time chasing bugs due to the linker. I've opened multiple PRs to move some of the makefile flags to build.rs, and closed them all because in the end it is really nice having all of the magic in one place.

My contention is that the Makefile system obscures this (Makefile.common is a feat of engineering that is also quite hard to read and understand in practice). Hidden .cargo folders are an anti-feature, but otherwise makes settings and findings these more inline with the typical way of doing this for Rust projects and makes interfacing with other tools that expect typical Rust project setups work more seemlessly.

I think we should not have called it Makefile.common so we could have syntax highlighting on by default. Alas.

I'm fairly convinced of the opposite. Make allows us to express the actual complexity of building a project like this in one place. With rust/cargo, we have to spread the same logic over two subsystems (.cargo/config and build.rs) and an additional tool (copy-and-paste to all of the board .cargo files, at least for riscv).

I would be more convinced we should do all of this in build.rs because we need the ability to use if statements. I think it would be more sustainable to autogenerate the second half of each board/x/.cargo/config file using build.rs. This would have three key benefits:

  1. We can use if to include flags for some platforms but not all and not requiring every board to keep track of them.
  2. We can version functions in build.rs, so out-of-tree users can call the version that matches their use case. Also, if we update something in build.rs because of a newer rust feature it would be automatically included in the out-of-tree board when things are updated.
  3. We don't have to copy new flags to 30+ boards every time. For example, this PR just drops the optimize-for-code-size flag.

(When I say build.rs I mean what libtock-rs has, where there is a build-helper crate and each board can call the provided functions.)

I don't like that I'm writing all of this. But, frankly, cargo is a tool built for users running rust on their host machine, and happens to have enough support for other workflows so it kind of works. I just don't think it is expressive enough for our needs.

@lschuermann
Copy link
Member
lschuermann commented Jul 3, 2024

I would be more convinced we should do all of this in build.rs because we need the ability to use if statements.

I quite like this idea, but I don't believe it would cover our build-std usecase -- that would still need to be done in the Cargo config or passed in as a command line parameter. To be fair, that is a nightly cargo flag, so I could entertain the idea that we still pass this in via a Make wrapper. Having everything else in a build.rs would at least mean that all stable options and board build options and parameters are clearly visible and accessible to upstream & downstream consumers.

@lschuermann lschuermann mentioned this pull request Jul 3, 2024
2 tasks
lto = false
lto = true
Copy link
Contributor

Choose a reason for hiding this comment

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

What does this do? How does this relate to

  # Enable link-time-optimization
  "-C", "lto",

?

Copy link
Member

Choose a reason for hiding this comment

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

"-C", "lto" is redundant and should be removed. If you set lto = false but then pass "-C", "lto", you get a compile error on debug builds.


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

Choose a reason for hiding this comment

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

Can you add the newlines so we don't have these circles everywhere?

Copy link
Member

Choose a reason for hiding this comment

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

It seems like Cargo automatically removes them when it touches these files.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's not what I'm seeing?

❯ cd ../../teensy40
❯ git diff | cat
diff --git a/boards/teensy40/.cargo/config.toml b/boards/teensy40/.cargo/config.toml
index 956e5d913..7bb661092 100644
--- a/boards/teensy40/.cargo/config.toml
+++ b/boards/teensy40/.cargo/config.toml
@@ -7,4 +7,8 @@ target = "thumbv7em-none-eabi"

 [unstable]
 unstable-options = true
-build-std = ["core", "compiler_builtins" ]
\ No newline at end of file
+build-std = ["core", "compiler_builtins" ]
+
+
+
+
❯ cargo build
   Compiling teensy40 v0.1.0 (/Users/bradjc/git/tock/boards/teensy40)
   Compiling cortexm7 v0.1.0 (/Users/bradjc/git/tock/arch/cortex-m7)
   Compiling imxrt10xx v0.1.0 (/Users/bradjc/git/tock/chips/imxrt10xx)
    Finished `dev` profile [optimized + debuginfo] target(s) in 6.93s
❯ git diff | cat
diff --git a/boards/teensy40/.cargo/config.toml b/boards/teensy40/.cargo/config.toml
index 956e5d913..7bb661092 100644
--- a/boards/teensy40/.cargo/config.toml
+++ b/boards/teensy40/.cargo/config.toml
@@ -7,4 +7,8 @@ target = "thumbv7em-none-eabi"

 [unstable]
 unstable-options = true
-build-std = ["core", "compiler_builtins" ]
\ No newline at end of file
+build-std = ["core", "compiler_builtins" ]
+
+
+
+

Comment on lines -34 to +35
let rtt_memory = kernel::static_buf!(capsules_extra::segger_rtt::SeggerRttMemory);
let rtt_memory =
kernel::static_buf!(capsules_extra::segger_rtt::SeggerRttMemory, "_SEGGER_RTT");
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a different change to go with the static_buf PR.

Comment on lines +6 to +10
rustflags = [
# 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",
Copy link
Contributor

Choose a reason for hiding this comment

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

What happened to -C linker=rust-lld?

I get

❯ cargo build
   Compiling nrf52840dk v0.1.0 (/Users/bradjc/git/tock/boards/nordic/nrf52840dk)
   Compiling nrf5x v0.1.0 (/Users/bradjc/git/tock/chips/nrf5x)
   Compiling cortexm4 v0.1.0 (/Users/bradjc/git/tock/arch/cortex-m4)
   Compiling nrf52 v0.1.0 (/Users/bradjc/git/tock/chips/nrf52)
   Compiling nrf52_components v0.1.0 (/Users/bradjc/git/tock/boards/nordic/nrf52_components)
   Compiling nrf52840 v0.1.0 (/Users/bradjc/git/tock/chips/nrf52840)
error: linker `lld` not found
  |
  = note: No such file or directory (os error 2)

error: could not compile `nrf52840dk` (bin "nrf52840dk") due to 1 previous error

@bradjc
Copy link
Contributor
bradjc commented Jul 3, 2024

IIUC, can we now pass a custom path for config.toml to cargo? 👀 https://doc.rust-lang.org/cargo/reference/config.html#command-line-overrides 👀

That would be a best of both worlds (... I suppose only assuming that this custom path can be specified in the Cargo.toml file so tooling picks it up automatically)

Ok, so in some sense this does work. If we create a boards/cargo.config.toml file, and then edit boards/X/.cargo/config.toml to add:

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

And run cargo -Zconfig-include build it does the right thing. But, obviously no one wants to include that command line flag. But wait! According to this:

Anything which can be configured with a -Z flag can also be set in the cargo config file (.cargo/config.toml) in the unstable table.

But...that doesn't work for me. Ex:

❯ cargo config get
build.rustflags = ["-C", "linker-flavor=ld.lld"]
build.target = "thumbv7em-none-eabi"
unstable.build-std = ["core", "compiler_builtins"]
unstable.config-include = true
unstable.unstable-options = true
# The following environment variables may affect the loaded values.
# CARGO_HOME=/Users/bradjc/.cargo

(no extra flags, yet the config-include is set to true.)

Contrast with:

❯ cargo -Zconfig-include config get
build.rustflags = ["-C", "linker=rust-lld", "-C", "linker-flavor=ld.lld", "-C", "relocation-model=static", "-C", "link-arg=-nmagic", "-C", "link-arg=-icf=all", "-C", "symbol-mangling-version=v0", "-C", "lto", "-C", "linker=rust-lld", "-C", "linker-flavor=ld.lld", "-C", "relocation-model=static", "-C", "link-arg=-nmagic", "-C", "link-arg=-icf=all", "-C", "symbol-mangling-version=v0", "-C", "lto", "-C", "linker-flavor=ld.lld"]
build.target = "thumbv7em-none-eabi"
unstable.build-std = ["core", "compiler_builtins"]
unstable.config-include = true
unstable.unstable-options = true
# The following environment variables may affect the loaded values.
# CARGO_HOME=/Users/bradjc/.cargo

So, since they did not stabilize this, I don't think this is viable unfortunately. Unless of course I'm doing something wrong.

This would, of course, be really useful. All of the riscv boards could include a riscv config that includes the riscv flags. Alas.

@bradjc
Copy link
Contributor
bradjc commented Jul 5, 2024

I think to make this PR work we need rust-lang/cargo#7723 (comment) fixed.

I'm by no means familiar with the cargo source, but I think this if statement (https://github.com/rust-lang/cargo/blob/606adeeea651d3d2f17b4ff809afbeb6423d2e0c/src/cargo/util/context/mod.rs#L1282) is what causes our include directive to not be used when trying to enable the config-include feature in the config.toml file directly.

@bradjc
Copy link
Contributor
bradjc commented Jul 5, 2024

I have a strong distaste for including essential build information that end-users run (as opposed to github actions, for example) in hidden files. This configuration is as important for actually running Tock as any line of code is, and hiding configuration from users adds just another barrier for understanding how Tock works with no benefit.

With that clearly stated, for better or worse 1) cargo is defacto in the Rust community and 2) it only supports hidden configuration files. Given that, I think with enough upside we should take a step backwards in usability by using hidden configuration files.

In my opinion, we need two features for there to be enough upside:

  1. The ability to use cargo build and similar and have them just work, even for our complicated use case.
  2. The ability to have conditions in how config files are used (at least for targets that use nightly, we may need to special case stable targets for the time being which we are already doing).

Item (1) is the point of this PR so we are good there. Item (2) is harder. Logically, it seems like build.rs is designed for this (i.e., write actual code to determine how to build a particular executable), but in practice I don't think it is possible with build.rs. As such, we currently use make to implement the conditions we need.

Instead, I think that the cargo config-include feature is enough to give us the flexibility to conditionally include flags for different boards. Rather than an if statement in the makefile, individual boards would just only include the config.toml file that pertains to them. This allows individual boards to be different while not including every flag in every board config.toml which would be very difficult to maintain correctly.

So, I support this PR if we can get cargo config-include to work.

@ppannuto
Copy link
Member
ppannuto commented Jul 5, 2024

We talked about this a while on the mini-core call earlier, and I've also ceded to a universe where the only things in the hidden file are (1) which target, and (2) which non-hidden config's to include.

@lschuermann
Copy link
Member

Created a PR to cargo, to have it respect the unstable.config-include setting: rust-lang/cargo#14196

@lschuermann
Copy link
Member

Instead, I think that the cargo config-include feature is enough to give us the flexibility to conditionally include flags for different boards. Rather than an if statement in the makefile, individual boards would just only include the config.toml file that pertains to them. This allows individual boards to be different while not including every flag in every board config.toml which would be very difficult to maintain correctly.

So, I support this PR if we can get cargo config-include to work.

With rust-lang/cargo#14196, I believe we should be able to pull a new Rust nightly in a couple days and that condition should be satisfied.

@bradjc
Copy link
Contributor
bradjc commented Jul 8, 2024

I just tried this with today's nightly and can confirm that something like:

❯ cat .cargo/config.toml
# 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 = [
  "../../myconfig.toml",
  "../../build-core.toml",
]

[build]
target = "thumbv7em-none-eabi"

[unstable]
config-include = true

does work as we want.

@lschuermann
Copy link
Member

include = [
"../../myconfig.toml",
"../../build-core.toml",
]

FWIW, I think that recursive includes should work as well now.

@lschuermann lschuermann changed the title Feature/compile without make Compile without Make / migrate flags to .cargo/config.toml Jul 8, 2024
@NegrilaRares
Copy link
Contributor

Tried using cargo flash with a microbit_v2.

The only issue i ran into was this warning:
WARN probe_rs::architecture::arm::core::armv7m: Core is running, but we expected it to be halted

@bradjc
Copy link
Contributor
bradjc commented Jul 9, 2024

FYI I'm working on this PR

@bradjc
Copy link
Contributor
bradjc commented Jul 9, 2024

I think this is the fix for remap-paths: 7e2ed4f

image

@alevy alevy added the blocked Waiting on something, like a different PR or a dependency. label Jul 12, 2024
@alevy
Copy link
Member Author
alevy commented Jul 12, 2024

Blocked in favor of #4075 (assuming that merges we'll close this)

@alevy alevy closed this Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Waiting on something, like a different PR or a dependency. component kernel needs-rebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0