Skip to content

Commit

Permalink
examples/rust-gcoap: Update stack size
Browse files Browse the repository at this point in the history
Tests with a particle-xenon show 5KiB free stack now; before, that would
have been an overflow by 3KiB.
  • Loading branch information
chrysn committed Aug 27, 2024
1 parent 30597a1 commit 20ac402
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions examples/rust-gcoap/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RIOTBASE ?= $(CURDIR)/../..

# Basic networking, and gcoap
USEMODULE += gcoap
USEMODULE += netdev_default
#USEMODULE += netdev_default
USEMODULE += auto_init_gnrc_netif
USEMODULE += gnrc_ipv6_default
USEMODULE += gnrc_icmpv6_echo
Expand All @@ -23,6 +23,10 @@ USEMODULE += ztimer_sec
USEMODULE += vfs
USEMODULE += constfs

USEMODULE += vfs_default
USEMODULE += littlefs2
USEMODULE += vfs_auto_format

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

Expand All @@ -34,10 +38,9 @@ DEVELHELP ?= 1
# Change this to 0 show compiler invocation lines by default:
QUIET ?= 1

# 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)+8192)'
# Add 16k extra stack: The Rust examples take more of it than gcoap expects,
# for reasons that are not fully understood (it's not the string formatter).
CFLAGS += -DGCOAP_STACK_SIZE='(THREAD_STACKSIZE_DEFAULT+DEBUG_EXTRA_STACKSIZE+sizeof(coap_pkt_t)+16384)'
# 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)'
Expand Down

0 comments on commit 20ac402

Please sign in to comment.