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

{examples,tests}/rust: Rust updates (-sys/-wrappers version, stable) #17761

Merged
merged 5 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion doc/doxygen/src/using-rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,20 @@ Toolchain {#toolchain}

To install the necessary Rust components, it is easiest use [**rustup**, installed as described on its website].

Using Rust on RIOT requires a nightly version of Rust,
Using most of Rust on RIOT requires a nightly version of Rust,
because some transpiled expressions for RIOT make use of unstable features,
and because the RIOT wrappers use some unstable idioms.

@note
Building on stable is supported for some examples and platforms starting with Rust 1.59
(e.g., the rust-hello-world on any ARM Cortex, but not yet on native).
Try it out by adding `CARGO_CHANNEL=stable` to the project's Makefile;
where it doesn't work, rustc will complain that "`#![feature]` may not be used on the stable release channel".

@note
A stable version of Rust is not currently provided with the Docker images;
consequently, builds on stable are not tested as regularly as builds on nightly.

Make sure you have both the nightly **toolchain**
and the core library for the CPU (**target**) of your choice available:

Expand Down
14 changes: 7 additions & 7 deletions examples/rust-gcoap/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/rust-gcoap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resolver = "2"
crate-type = ["staticlib"]

[dependencies]
riot-wrappers = { version = "^0.7", features = [ "with_coap_message", "with_coap_handler" ] }
riot-wrappers = { version = "^0.7.18", features = [ "set_panic_handler", "panic_handler_format", "with_coap_message", "with_coap_handler" ] }

coap-message-demos = { git = "https://gitlab.com/chrysn/coap-message-demos/", default-features = false }
coap-handler-implementations = "0.3"
Expand Down
5 changes: 5 additions & 0 deletions examples/rust-gcoap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ DEVELHELP ?= 1
# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1

# Add 3k extra stack: The Rust examples take more of it than gcoap expects,
# presumably because the example use the standard library's sting formatting
# instead of one of the more optimized formatters.
CFLAGS += -DGCOAP_STACK_SIZE='(THREAD_STACKSIZE_DEFAULT+DEBUG_EXTRA_STACKSIZE+sizeof(coap_pkt_t)+1024)'

# The name of crate (as per Cargo.toml package name, but with '-' replaced with '_')
APPLICATION_RUST_MODULE = rust_gcoap
BASELIBS += $(APPLICATION_RUST_MODULE).module
Expand Down
9 changes: 9 additions & 0 deletions examples/rust-gcoap/Makefile.ci
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
BOARD_INSUFFICIENT_MEMORY := \
airfy-beacon \
blackpill \
bluepill \
bluepill-stm32f030c8 \
calliope-mini \
im880b \
i-nucleo-lrwan1 \
microbit \
nrf51dongle \
nrf6310 \
nucleo-f030r8 \
nucleo-f031k6 \
nucleo-f042k6 \
nucleo-f070rb \
nucleo-f072rb \
nucleo-f302r8 \
nucleo-f303k8 \
nucleo-f334r8 \
Expand All @@ -22,4 +30,5 @@ BOARD_INSUFFICIENT_MEMORY := \
stm32g0316-disco \
stm32l0538-disco \
stm32mp157c-dk2 \
yunjia-nrf51822 \
#
12 changes: 6 additions & 6 deletions examples/rust-hello-world/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion examples/rust-hello-world/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ resolver = "2"
crate-type = ["staticlib"]

[dependencies]
riot-wrappers = "0.7"
# `default-features = false` can be removed with 0.8, and enables building on stable during the 0.7 series
riot-wrappers = { version = "0.7", features = [ "set_panic_handler" ], default-features = false }
12 changes: 6 additions & 6 deletions tests/rust_minimal/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion tests/rust_minimal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ resolver = "2"
crate-type = ["staticlib"]

[dependencies]
riot-wrappers = "0.7"
# `default-features = false` can be removed with 0.8, and enables building on stable during the 0.7 series
riot-wrappers = { version = "0.7", features = [ "set_panic_handler" ], default-features = false }