From 1f36afe97691a9c2b0c14d36973c8b3335942f77 Mon Sep 17 00:00:00 2001 From: chrysn Date: Sun, 23 Jan 2022 16:01:34 +0100 Subject: [PATCH 1/5] examples/rust-gcoap: Sharpen depenency Since 9503809f, a relatively recent version of riot-wrappers is required. --- examples/rust-gcoap/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/rust-gcoap/Cargo.toml b/examples/rust-gcoap/Cargo.toml index 8ef7ff4e01..8a3e77fb52 100644 --- a/examples/rust-gcoap/Cargo.toml +++ b/examples/rust-gcoap/Cargo.toml @@ -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" From 47b25c359586b43881ff7eeef435a32665e07db8 Mon Sep 17 00:00:00 2001 From: chrysn Date: Sun, 23 Jan 2022 15:43:21 +0100 Subject: [PATCH 2/5] examples/rust-gcoap: Increase gcoap stack On microbit-v2, getting .well-known/core would otherwise result in a stack overflow. Consequently, some boards were removed from the list of supported boards as the currently required RAM exceeds their capacity. --- examples/rust-gcoap/Makefile | 6 ++++++ examples/rust-gcoap/Makefile.ci | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/examples/rust-gcoap/Makefile b/examples/rust-gcoap/Makefile index eb59d94b5e..af37358b10 100644 --- a/examples/rust-gcoap/Makefile +++ b/examples/rust-gcoap/Makefile @@ -30,6 +30,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)' + # The name of crate (as per Cargo.toml package name, but with '-' replaced with '_') APPLICATION_RUST_MODULE = rust_gcoap BASELIBS += $(APPLICATION_RUST_MODULE).module diff --git a/examples/rust-gcoap/Makefile.ci b/examples/rust-gcoap/Makefile.ci index 136960a4e9..d0c413c823 100644 --- a/examples/rust-gcoap/Makefile.ci +++ b/examples/rust-gcoap/Makefile.ci @@ -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 \ @@ -22,4 +30,5 @@ BOARD_INSUFFICIENT_MEMORY := \ stm32g0316-disco \ stm32l0538-disco \ stm32mp157c-dk2 \ + yunjia-nrf51822 \ # From 40efa06eb474229d15dd01c20c230fe78d909587 Mon Sep 17 00:00:00 2001 From: chrysn Date: Sun, 23 Jan 2022 15:56:35 +0100 Subject: [PATCH 3/5] examples/rust-gcoap: Add CoAP SAUL demo from module examples --- examples/rust-gcoap/Makefile | 4 ++++ examples/rust-gcoap/src/lib.rs | 1 + 2 files changed, 5 insertions(+) diff --git a/examples/rust-gcoap/Makefile b/examples/rust-gcoap/Makefile index af37358b10..8d66022886 100644 --- a/examples/rust-gcoap/Makefile +++ b/examples/rust-gcoap/Makefile @@ -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: diff --git a/examples/rust-gcoap/src/lib.rs b/examples/rust-gcoap/src/lib.rs index 4fdcdbba21..0ea3d55b64 100644 --- a/examples/rust-gcoap/src/lib.rs +++ b/examples/rust-gcoap/src/lib.rs @@ -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); From 280327e2091ff32a98dddb1486baba823d815b60 Mon Sep 17 00:00:00 2001 From: chrysn Date: Tue, 19 Mar 2024 22:42:32 +1000 Subject: [PATCH 4/5] examples/rust-gcoap: Increase stack size to avoid crashes --- examples/rust-gcoap/Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/examples/rust-gcoap/Makefile b/examples/rust-gcoap/Makefile index dc8725b150..9fa9de2543 100644 --- a/examples/rust-gcoap/Makefile +++ b/examples/rust-gcoap/Makefile @@ -34,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 From 6acbebb294a3139f1ed78453a915af36bcb111e3 Mon Sep 17 00:00:00 2001 From: chrysn Date: Tue, 19 Mar 2024 23:54:53 +1000 Subject: [PATCH 5/5] examples/rust-gcoap: Regenerated Makefile.ci --- examples/rust-gcoap/Makefile.ci | 56 +++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/examples/rust-gcoap/Makefile.ci b/examples/rust-gcoap/Makefile.ci index e69de29bb2..5e57cd581b 100644 --- a/examples/rust-gcoap/Makefile.ci +++ b/examples/rust-gcoap/Makefile.ci @@ -0,0 +1,56 @@ +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 \ + nucleo-f030r8 \ + nucleo-f031k6 \ + 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 \ + seeedstudio-gd32 \ + sipeed-longan-nano \ + sipeed-longan-nano-tft \ + slstk3400a \ + spark-core \ + stk3200 \ + stm32f030f4-demo \ + stm32f0discovery \ + stm32g0316-disco \ + stm32l0538-disco \ + stm32mp157c-dk2 \ + weact-g030f6 \ + yunjia-nrf51822 \ + #