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/rust-gcoap: Add SAUL #17554

Merged
merged 7 commits into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
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.10", features = [ "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
10 changes: 10 additions & 0 deletions examples/rust-gcoap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ USEMODULE += ztimer_usec
USEMODULE += ztimer_msec
USEMODULE += ztimer_sec

# for the "vfs" feature of riot-coap-handler-demos (and vfs.c)
USEMODULE += vfs
USEMODULE += constfs

# for the "saul" feature of riot-coap-handler-demos
USEMODULE += saul_default

# Comment this out to disable code in RIOT that does safety checking
# which is not needed in a production environment but helps in the
# development process:
Expand All @@ -30,6 +34,12 @@ 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) + 3072)'
Teufelchen1 marked this conversation as resolved.
Show resolved Hide resolved

# 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 \
#
1 change: 1 addition & 0 deletions examples/rust-gcoap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ fn main() {
let handler = coap_message_demos::full_application_tree(None)
.below(&["ps"], riot_coap_handler_demos::ps::ps_tree())
.below(&["vfs"], riot_coap_handler_demos::vfs::vfs("/const"))
.below(&["saul"], riot_coap_handler_demos::saul::SaulHandler::new(&["saul"]))
.with_wkc()
;
let mut handler = riot_wrappers::coap_handler::GcoapHandler(handler);
Expand Down