Skip to content
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

[WIP] Initial Rust language support with make #6162

Closed
wants to merge 17 commits into from

Conversation

nmeum
Copy link
Member

@nmeum nmeum commented Nov 28, 2016

This is very loosly based on #5740 the main difference between #5740 and this pull request are that I integrated rust into the existing build system instead of depending on xargo or cargo. This has a bunch of advantages, for one thing it is now possible to build rust applications for the native family. Besides you don't need the rust-linker-hook hack.

I am not so sure if it is a good idea to integrate the wrappers in sys/rust at this point. I am currently working on better wrappers for riot modules and newlibc.

Anyways, let me know what you think…


I tested this with BOARD=native and BOARD=pba-d-01-kw2x with gcc 6.2.

Files in dist/rust have been slightly modified but where basically taken from #5740.

@nmeum nmeum force-pushed the rust_support_without_cargo_rebased branch 3 times, most recently from 3d9ccc1 to c3cf757 Compare November 29, 2016 18:12
@kaspar030
Copy link
Contributor

Indeed this seems less hacky. Is it still possible to somehow use cargo crates?

@kaspar030 kaspar030 added the Type: new feature The issue requests / The PR implemements a new feature for RIOT label Nov 29, 2016
@kaspar030 kaspar030 self-assigned this Nov 29, 2016
The idea is to integrate rust into the existing build system as well as
possible and to not use a separate buildsystem like cargo or xargo.

Makefile.base has been modified to include support for main.rs and
lib.rs files and a Makefile.rust has been added which sets a few rust
related variables.

This is very loosly based on RIOT-OS#5740
This package is needed to built rust applications with `#![no_std]`. We
can't really use the rust standard library because it is too fat for our
little MCUs.
Including an example file demonstrating how to use them.
@nmeum nmeum force-pushed the rust_support_without_cargo_rebased branch from c3cf757 to 46cd682 Compare November 29, 2016 19:07
@nmeum
Copy link
Member Author

nmeum commented Nov 29, 2016

Is it still possible to somehow use cargo crates?

Not really. My idea was to allow users to integrate crates by adding a pkg for them in pkg/ that works in theory (pkg/libcore is a cargo crate). In reality, however, it doesn't seem to be possible to make packages in pkg/ depend on each other in a decent way.

This is relevant because if you build rust creates with #![no_std] each crate has to be linked against libcore, so each crate that you would want to add as a package to pkg/ would need to depend on pkg/libcore. With the current setup this doesn't seem to be possible you could however move libcore to dist/rust/libcore (or any other location for that matter) and modify Makefile.include in a way that it always compiles libcore first before doing anything else when building rust code.

Even though including external crates as a package doesn't really work currently compiling crates does of cause work. The directories in sys/fmt are normal rust crates.

But even if you would fix the dependency problem most cargo crates that you can find on crates.io wouldn't work with riot anyhow because most of them need libstd.

@nmeum
Copy link
Member Author

nmeum commented Dec 6, 2016

I managed to integrate crates more closely into the existing pkg/-System I am currently testing and cleaning that up a bit and will update the pull request the following week (or so).

@nmeum nmeum changed the title Initial Rust language support with make [WIP] Initial Rust language support with make Dec 15, 2016
@kaspar030
Copy link
Contributor

I managed to integrate crates more closely into the existing pkg/-System I am currently testing and cleaning that up a bit and will update the pull request the following week (or so).

I'm opposed to not using the cargo/xargo infrastructure.

Users developing with rust will now cargo, and their packaging system is actually quite nice.
Rust RIOT packages should be cargo.io crates.

I suggest going with the linker hack now and rather try to get a "linker_args" option upstream, where we can just pass "$archives", which just get linked in using RIOT's build system.

@BafDyce BafDyce mentioned this pull request Dec 21, 2016
@nmeum
Copy link
Member Author

nmeum commented Feb 23, 2017

We made some progress with rust support on RIOT. We mirrored our master branch to a GitHub Repository (in case anybody wants to test it), this repository can be viewed here. We just integrated wrappers for sock and are now planning to rebase our changes against the current upstream master branch. If you want to experiment with rust on RIOT you should probably wait until we did that (it's scheduled for this weekend).

Afterwards we will work on wrappers for coap and as soon as we are finished doing that we will make some changes to our buildsystem requested by @kaspar030. After all of that has been done this merge request will be updated.

@nmeum nmeum closed this Apr 29, 2017
@nmeum nmeum deleted the rust_support_without_cargo_rebased branch April 29, 2017 22:22
@aabadie
Copy link
Contributor

aabadie commented Apr 30, 2017

why ?

@nmeum
Copy link
Member Author

nmeum commented May 1, 2017

This was closed by accident. We will reopen this shortly. In the meantime just use the beduino github repository if you are interested in playing around with rust.

@nmeum nmeum reopened this May 1, 2017
@smlng smlng removed this from the Release 2018.01 milestone Jan 17, 2018
@miri64
Copy link
Member

miri64 commented Mar 15, 2018

No new development for over a year. Let's close this for now.

@miri64 miri64 closed this Mar 15, 2018
@miri64 miri64 added the State: archived State: The PR has been archived for possible future re-adaptation label Mar 15, 2018
@chrysn chrysn mentioned this pull request Aug 20, 2018
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
State: archived State: The PR has been archived for possible future re-adaptation Type: new feature The issue requests / The PR implemements a new feature for RIOT
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants