-
Notifications
You must be signed in to change notification settings - Fork 6
Add cross configuration #69
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
{ | ||
"rust-analyzer.cargo.features": [ | ||
"rt", | ||
"stm32h503" | ||
"stm32h503", | ||
"async", | ||
], | ||
"rust-analyzer.check.allTargets": false, | ||
"rust-analyzer.check.targets": "thumbv8m.main-none-eabihf", | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Cross doesn't seem to look for package specific configurations when invoked in a workspace so | ||
# we put the default target in Cross.toml | ||
|
||
# Allow usage of locally built version of the cross docker image that matches the host architecture | ||
# e.g. Building a linux/arm64 image for an AARCH64 host allows native execution of the image. | ||
# Specifying the toolchain for a linux/arm64 image means the correct toolchain is used on that | ||
# platform (it defaults to x86_64). | ||
[target.aarch64-unknown-linux-gnu.image] | ||
name = "ghcr.io/cross-rs/aarch64-unknown-linux-gnu:main" | ||
toolchain = ["linux/arm64=aarch64-unknown-linux-gnu"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,6 +71,20 @@ a number of fantastic resources available to help. | |
- [Rust Embedded FAQ](https://docs.rust-embedded.org/faq.html) | ||
- [rust-embedded/awesome-embedded-rust](https://github.com/rust-embedded/awesome-embedded-rust) | ||
|
||
## Running unit tests | ||
|
||
First, you'll need to install the `aarch64-unknown-linux-gnu` target to run unit tests. | ||
|
||
If you're on a linux host, you can to run unit tests with `cargo test`. | ||
|
||
If you're not, you'll need to install [`cross`](https://github.com/cross-rs/cross), which is a cross compilation tool. See the `cross` instructions for details of installation and use. Once that is installed, using `cross test` will run the unit tests within a docker image. | ||
|
||
Running tests with `cross`: | ||
|
||
cross test --target x86_64-unknown-linux-gnu --tests --features stm32h503 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Judging by the
line in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So you can run it on either architecture. That directive in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, okay There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll add some instructions for building with a guest image that matches the host architecture when it's more accessible with cross! |
||
|
||
`cross` will automatically download the relevant docker image and install the correct rust toolchain. | ||
|
||
## Changelog | ||
|
||
See [CHANGELOG.md](CHANGELOG.md). Note: this will be populated once the first crates have been | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would I need that target specifically? Does x86_64 not work for the tests? Also why would I need to cross compile in the first place for running tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry. That's incorrect. Updated