-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
Cross-compile profile from different workspace #360
Comments
How do you compile stuff for your embedded setup? Something like |
Typically I |
Is this code publicly available? Or can you make a small sample I can fork and mess with? |
Our full code is not available, but I can strip it down for you to have an example - please give me one to two days. |
Sure. You can also try running |
I'm developing for an embedded target, but in a setup to run unit tests locally. For this reason we have two workspaces: one for local (host) compilation of most of our code in a lib and another workspace that builds for the embedded target and depends on the same lib. That second workspace is set up for cross compilation.
Looks something like this:
I can use
cargo-show-asm
to display the RISC-V code that I'd like to like like so in the root folder:But that will then use the default settings for the target whereas I'd like it to use the settings from the embedded workspace (panic abort, lto, etc.). If I try to run in the
app
subfolder the lib won't be found.I can for sure provide the necessary command line arguments for those settings, but is there simpler way to use the profile settings consistently? (set in both the
app/Cargo.toml
and in theapp/.cargo/config.toml
)I do get that I can run with
--all-crates
in theapp
subfolder, but that often leads to the functions that I'm interested being inlined, so it would be great to run it on the library level. (one workaround here is to prevent inlining via attribute in the lib, and I am aware that it's kind of the opposite things... running with the flags I usually have but also not wanting inlining at the same time)I think that I'm not the only one with a setup like that, it's based on a blog post from Ferrous Systems from a while back: https://ferrous-systems.com/blog/test-embedded-app/
The gory details
The
workspace [1]
Cargo.toml
just provides a workspace file for all host-compiled code:The
embedded workspace [2]
Cargo.toml
is pretty standard for embedded:And this builds for the embedded target because of the
.cargo/config.toml
:The
lib [3]
Cargo.toml
is just a standard one, as for any platform-independent lib. Nothing special about itThe text was updated successfully, but these errors were encountered: