From 399e25cce3cf37e6d23371574acfd1ee5a2a19f2 Mon Sep 17 00:00:00 2001 From: chrysn Date: Sat, 1 Oct 2022 21:28:35 +0200 Subject: [PATCH 1/4] rust: Update dependencies This pulls in versions of previously nightly-only crates that can be built on 1.65 beta. The Cargo overrides that direct the resolver to the git repositories are disabled while the version used in tree also happens to be a released version of the crates, as it should be the case as per [251]. [251]: https://github.com/RIOT-OS/Release-Specs/issues/251 --- .cargo/config.toml | 4 ++-- examples/rust-gcoap/Cargo.lock | Bin 23748 -> 24076 bytes examples/rust-hello-world/Cargo.lock | Bin 20059 -> 20148 bytes sys/rust_riotmodules_standalone/Cargo.lock | Bin 20070 -> 20159 bytes tests/rust_minimal/Cargo.lock | Bin 20055 -> 20144 bytes 5 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.cargo/config.toml b/.cargo/config.toml index 03fd973948..f295621eb5 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -5,5 +5,5 @@ # Cargo.toml, copy this file over, or just use the released versions. [patch.crates-io] -riot-sys = { git = "https://github.com/RIOT-OS/rust-riot-sys" } -riot-wrappers = { git = "https://github.com/RIOT-OS/rust-riot-wrappers" } +#riot-sys = { git = "https://github.com/RIOT-OS/rust-riot-sys" } +#riot-wrappers = { git = "https://github.com/RIOT-OS/rust-riot-wrappers" } diff --git a/examples/rust-gcoap/Cargo.lock b/examples/rust-gcoap/Cargo.lock index ea368705d9029cc8523a5b31196a98cd2c41a2cd..2d9b5982a354f54809b36efc8fa469372afeb9c0 100644 GIT binary patch delta 971 zcmXw2zl#+{5auC9IFl1R?@lqr@q`FQ&iygFI|F)oVxfhQr;sv)ogbS7LQd`uAq0dF z(xow*Dy@<>(N_g*gxFhINSd_CKjFS7mc!1>_s#cx`}bdypPxTgiR|nmvYMkWRy%1&?+RY&O^XhJy_N-T21X7Z#7s-&$YAA_fwQF~JzkEI>_D85(62 zBttgPke$om5h7AeTuK_&=^#X{aesbtd-2Pqdml`eJm-60!5S*Jab02WhW~)%S}ADb zDQ2m}ONoMERv{7%zF16c^t;7Fe0A(y3ckGhY(lH!#d*vPgRz%JjeICts({o|lT!3a zO^U(@D+E_U)KH_3p_MoS#D0~r->yCF52iO}p1p74L{k{?K|o&GWUaj@yX-U{rN}pnbCkT?}GqS oCdVjjI7Hz({*)q%*8(M2kZREv&SW%X7C$X{l`SZiI)JG#@hFBn`*dOjR_2K``thB{}w2!;X?Ze9Z>GQS4V@sR! zKbP_3_T4)hgN;qIV|Spv{BpD#ViXD4xk&0PL+RXtbbr=@^I2KdaxOKHmI8?Y5+?B0 zu!2fEkk$6gthE=5Yt!G(eY5z9Xf{0vC1lUh74H;Kr~^bVRs|J{s>YbqW8|7O8Jh$v zc@N};sJ&fSosKUaoSdocbt}0qf|R8?Wv?~_vf^XnBmrF)lFmWJxaeZ$0GKgIkkk*v z={uqrSi^2C-_kY;lzkYdqe{#4zzJ2#_d-8Cy1;$|!7u9+- zrl(vB_avFTc1VT+4H{QImFTbCqn^*HncCN%t34RUgM&_dE4T_+dS@IO-+LCr%v&$5 zBNHk`BOWbwmb2(a>pi;R_KD3)^BbFaayXvu5C2$durL~;wFb$$1j$rGKKjA{!REdb jVi994u?<$7$)xDXW`Ptsdg|YWN_+e5<>}G&Tl4<`;%N2Y diff --git a/examples/rust-hello-world/Cargo.lock b/examples/rust-hello-world/Cargo.lock index ce216225a19d00598b7fdcfb50062fff39330d90..a790bff4cc79a64027eafb67d79fc5bc8d91e7b2 100644 GIT binary patch delta 524 zcmW-eziO315XJcf!9OUG#30&)n^xlP?Cj1AXt+UplP8efnOU(hcoPImZA1_ezE+>W zM!dE@gq4L)U~gmRa?4@P`ElmV?@!bB&(qgm+q+NnbmfaHFMW0P?DYBGgS|yKfP?wt zos&ZoCIrWBS~-DX(Apr1DR>IV=8=pk0dnWm$Iy{9Hm?*U&nL2bQO{p3?#}n8{q>KX zH`nH$N5{(qqLNa^;Vey2x@F4lg_Xs*IU1A@3P#4nQgb89k<`pYdT;ZM#qIT<#k;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--- tests/rust_libs/Makefile | 4 ++++ tests/rust_minimal/Makefile | 5 ++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/rust_libs/Makefile b/tests/rust_libs/Makefile index a41e323007..6195a36951 100644 --- a/tests/rust_libs/Makefile +++ b/tests/rust_libs/Makefile @@ -5,6 +5,10 @@ USEMODULE += shell_democommands FEATURES_REQUIRED += rust_target +# Testing on stable to ensure that no nightly features are needed when Rust is +# pulled in through modules. +CARGO_CHANNEL = stable + # Currently unknown, something related to the LED_PORT definition that doesn't # pass C2Rust's transpilation BOARD_BLACKLIST := ek-lm4f120xl diff --git a/tests/rust_minimal/Makefile b/tests/rust_minimal/Makefile index 0f91d760be..72a112e7cf 100644 --- a/tests/rust_minimal/Makefile +++ b/tests/rust_minimal/Makefile @@ -5,9 +5,8 @@ BASELIBS += $(APPLICATION_RUST_MODULE).module FEATURES_REQUIRED += rust_target -# This example can, on all platforms, be built with a stable version of Rust. -# For most advanced features (eg. when using CoAP, SAUL or the shell with -# Rust), this needs to be set to "nightly" for the time being. +# Testing on stable to ensure that no nightly features are needed for basic +# Rust usage. CARGO_CHANNEL = stable # Currently unknown, something related to the LED_PORT definition that doesn't From 8a61ed1caa3b37188467208d52a4b3202d02ebd7 Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 23 Sep 2022 00:46:32 +0200 Subject: [PATCH 3/4] rust: Set panic=abort on path towards building on stable --- examples/rust-gcoap/Cargo.toml | 6 ++++++ examples/rust-hello-world/Cargo.toml | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/examples/rust-gcoap/Cargo.toml b/examples/rust-gcoap/Cargo.toml index 275eedaffb..e6cf6e2f89 100644 --- a/examples/rust-gcoap/Cargo.toml +++ b/examples/rust-gcoap/Cargo.toml @@ -8,6 +8,12 @@ resolver = "2" [lib] crate-type = ["staticlib"] +[profile.release] +# Setting the panic mode has little effect on the built code (as Rust on RIOT +# supports no unwinding), but setting it allows builds on native without using +# the nightly-only lang_items feature. +panic = "abort" + [dependencies] riot-wrappers = { version = "^0.7.18", features = [ "set_panic_handler", "panic_handler_format", "with_coap_message", "with_coap_handler" ] } diff --git a/examples/rust-hello-world/Cargo.toml b/examples/rust-hello-world/Cargo.toml index 9dc05fcfd2..c5217e2998 100644 --- a/examples/rust-hello-world/Cargo.toml +++ b/examples/rust-hello-world/Cargo.toml @@ -8,6 +8,12 @@ resolver = "2" [lib] crate-type = ["staticlib"] +[profile.release] +# Setting the panic mode has little effect on the built code (as Rust on RIOT +# supports no unwinding), but setting it allows builds on native without using +# the nightly-only lang_items feature. +panic = "abort" + [dependencies] # `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 } From 963fa85893ca37bcfa59755557bb873a3bb1b852 Mon Sep 17 00:00:00 2001 From: chrysn Date: Sat, 1 Oct 2022 22:07:02 +0200 Subject: [PATCH 4/4] rust-gcoap: Add Rust options for small binaries (-Os) --- examples/rust-gcoap/Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/rust-gcoap/Cargo.toml b/examples/rust-gcoap/Cargo.toml index e6cf6e2f89..0567dde89c 100644 --- a/examples/rust-gcoap/Cargo.toml +++ b/examples/rust-gcoap/Cargo.toml @@ -13,6 +13,10 @@ crate-type = ["staticlib"] # supports no unwinding), but setting it allows builds on native without using # the nightly-only lang_items feature. panic = "abort" +# This is a typical set of options that helps Rust binaries stay small +lto = true +codegen-units = 1 +opt-level = "s" [dependencies] riot-wrappers = { version = "^0.7.18", features = [ "set_panic_handler", "panic_handler_format", "with_coap_message", "with_coap_handler" ] }