cpu/riscv_common: Enable Rust applications #17520
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
This is largely just stating it works.
It contains a workaround for
rust-lang/rust-bindgen#1555 (withouot which
bindgen would fail, with little information helping remedy the cause)
[edit: added] Note that the actual RUST_TARGET referred to in "HAS_RUST_TARGET" has already been set since the introduction to Rust (so that experimentation could be done when forcing one's way around the features); only now it is used. When any other targets than riscv32imac are supported,
makefiles/arch/riscv.inc.mk
will need adjustments both on the CFLAGS and RUST_TARGET side.Testing procedure
(I did it with a hifive1 and rust-hello).
Even though I thought I had all the right and matching compilers, things did not work for me when building from my Debian environment -- I blame it on the weird way C2Rust is installed here. In the docker images, all works fine, so despite my reluctance I'm doing tests
BUILD_IN_DOCKER=1
.Status
This is marked as a Draft PR while I'm doing a bit more testing, and also I don't want to clog CI right now.Ready for experimentation as long as CI says it's good.