1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-15 09:33:50 +01:00

Merge pull request #17554 from chrysn-pull-requests/rust-gcoap-add-saul

examples/rust-gcoap: Add SAUL
This commit is contained in:
chrysn 2024-03-21 00:47:27 +00:00 committed by GitHub
commit d10fa1b394
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 71 additions and 6 deletions

View File

@ -146,6 +146,16 @@ version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "05afea1e0a06c9be33d539b876f1ce3692f4afea2cb41f740e7743225ed1c757"
[[package]]
name = "ciborium-ll"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "57663b653d948a338bfb3eeba9bb2fd5fcfaecb9e199e87e1eda4d9e8b240fd9"
dependencies = [
"ciborium-io",
"half 2.4.0",
]
[[package]]
name = "clang-sys"
version = "1.7.0"
@ -290,6 +300,12 @@ version = "1.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7059fff8937831a9ae6f0fe4d658ffabf58f2ca96aa9dec1c889f936f705f216"
[[package]]
name = "crunchy"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7"
[[package]]
name = "crypto-common"
version = "0.1.6"
@ -422,6 +438,16 @@ version = "1.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b43ede17f21864e81be2fa654110bf1e793774238d86ef8555c37e6519c0403"
[[package]]
name = "half"
version = "2.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b5eceaaeec696539ddaf7b333340f1af35a5aa87ae3e4f3ead0532f72affab2e"
dependencies = [
"cfg-if",
"crunchy",
]
[[package]]
name = "hash32"
version = "0.1.1"
@ -711,6 +737,8 @@ name = "riot-coap-handler-demos"
version = "0.2.0"
source = "git+https://gitlab.com/etonomy/riot-module-examples/#26a7d27b4c0d518be1d26d07403f57261ee37cd5"
dependencies = [
"ciborium-io",
"ciborium-ll",
"coap-handler 0.2.0",
"coap-handler-implementations",
"coap-message 0.3.1",
@ -719,7 +747,9 @@ dependencies = [
"embedded-graphics",
"embedded-hal 0.2.7",
"heapless 0.7.17",
"hex",
"minicbor",
"riot-shell-commands",
"riot-sys",
"riot-wrappers",
"serde",
@ -727,6 +757,16 @@ dependencies = [
"serde_cbor",
]
[[package]]
name = "riot-shell-commands"
version = "0.1.0"
source = "git+https://gitlab.com/etonomy/riot-module-examples/#26a7d27b4c0d518be1d26d07403f57261ee37cd5"
dependencies = [
"heapless 0.7.17",
"riot-sys",
"riot-wrappers",
]
[[package]]
name = "riot-sys"
version = "0.7.11"
@ -856,7 +896,7 @@ version = "0.11.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5"
dependencies = [
"half",
"half 1.8.3",
"serde",
]

View File

@ -23,7 +23,7 @@ riot-wrappers = { version = "^0.8", features = [ "set_panic_handler", "panic_han
coap-message-demos = { git = "https://gitlab.com/chrysn/coap-message-demos/", default-features = false }
coap-handler-implementations = "0.5"
riot-coap-handler-demos = { git = "https://gitlab.com/etonomy/riot-module-examples/", features = [ "vfs" ] }
riot-coap-handler-demos = { git = "https://gitlab.com/etonomy/riot-module-examples/", features = [ "vfs", "saul" ] }
# While currently this exmple does not use any RIOT modules implemented in
# Rust, that may change; it is best practice for any RIOT application that has

View File

@ -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:
@ -30,10 +34,13 @@ 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,
# Add 8k 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)'
CFLAGS += -DGCOAP_STACK_SIZE='(THREAD_STACKSIZE_DEFAULT+DEBUG_EXTRA_STACKSIZE+sizeof(coap_pkt_t)+8192)'
# This thread needs some more stack for printing the addresses, once more being
# hit by string formatting.
CFLAGS += -DTHREAD_STACKSIZE_MAIN='(THREAD_STACKSIZE_DEFAULT+THREAD_EXTRA_STACKSIZE_PRINTF+2048)'
# The name of crate (as per Cargo.toml package name, but with '-' replaced with '_')
APPLICATION_RUST_MODULE = rust_gcoap

View File

@ -1,12 +1,26 @@
BOARD_INSUFFICIENT_MEMORY := \
airfy-beacon \
b-l072z-lrwan1 \
blackpill-stm32f103c8 \
blackpill-stm32f103cb \
bluepill-stm32f030c8 \
bluepill-stm32f103c8 \
bluepill-stm32f103cb \
calliope-mini \
cc1350-launchpad \
cc2650-launchpad \
cc2650stk \
e104-bt5010a-tb \
e104-bt5011a-tb \
gd32vf103c-start \
hifive1 \
hifive1b \
i-nucleo-lrwan1 \
im880b \
lsn50 \
maple-mini \
microbit \
microbit-v2 \
nrf51dongle \
nrf6310 \
nucleo-c031c6 \
@ -15,19 +29,22 @@ BOARD_INSUFFICIENT_MEMORY := \
nucleo-f042k6 \
nucleo-f070rb \
nucleo-f072rb \
nucleo-f103rb \
nucleo-f302r8 \
nucleo-f303k8 \
nucleo-f334r8 \
nucleo-l011k4 \
nucleo-l031k6 \
nucleo-l053r8 \
nucleo-l073rz \
olimexino-stm32 \
opencm904 \
samd10-xmini \
saml10-xpro \
saml11-xpro \
seeedstudio-gd32 \
sipeed-longan-nano \
sipeed-longan-nano-tft \
slstk3400a \
spark-core \
stk3200 \
stm32f030f4-demo \
stm32f0discovery \

View File

@ -24,6 +24,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::v0_2::GcoapHandler(handler);