1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2026-01-01 01:41:18 +01:00
RIOT/sys/event/Makefile.include
Marian Buschsieweke ed3993b07c
sys/event: fix stack size requirement build system integration
The stack requirements were applied to the wrong thread in case of
a shared thread managing medium and lowest priority queues (in other
words: when `event_thread_medium` is not used).

This fixes the implementation and corrects the documentation to which
thread handles which queues.
2025-12-15 22:44:08 +01:00

40 lines
1.7 KiB
Makefile

include $(RIOTMAKE)/utils/strings.mk
# This applies to all thread stacks
ifneq (, $(EVENT_THREAD_STACKSIZE_MIN))
EVENT_THREAD_STACKSIZE_MIN := $(call max_number,$(EVENT_THREAD_STACKSIZE_MIN))
endif
ifneq (, $(EVENT_THREAD_HIGHEST_STACKSIZE_MIN))
ifeq (,$(filter event_thread_highest, $(USEMODULE)))
# No highest priority event thread, so the highest prio queue is handled by
# the same thread handling the medium priority queue. So we "trickle down"
# the requirements here
EVENT_THREAD_MEDIUM_STACKSIZE_MIN += $(EVENT_THREAD_HIGHEST_STACKSIZE_MIN)
else
ifneq (, $(EVENT_THREAD_HIGHEST_STACKSIZE_MIN))
EVENT_THREAD_HIGHEST_STACKSIZE_MIN := $(call max_number,$(EVENT_THREAD_HIGHEST_STACKSIZE_MIN) $(EVENT_THREAD_STACKSIZE_MIN))
CFLAGS += -DEVENT_THREAD_HIGHEST_STACKSIZE=$(EVENT_THREAD_HIGHEST_STACKSIZE_MIN)
endif
endif
endif
ifneq (, $(EVENT_THREAD_LOWEST_STACKSIZE_MIN))
ifeq (,$(filter event_thread_medium, $(USEMODULE)))
# No lowest priority event thread, so the lowest prio queue is handled by
# the same thread handling the medium priority queue. So we "trickle up"
# the requirements here
EVENT_THREAD_MEDIUM_STACKSIZE_MIN += $(EVENT_THREAD_LOWEST_STACKSIZE_MIN)
else
ifneq (, $(EVENT_THREAD_LOWEST_STACKSIZE_MIN))
EVENT_THREAD_LOWEST_STACKSIZE_MIN := $(call max_number,$(EVENT_THREAD_LOWEST_STACKSIZE_MIN) $(EVENT_THREAD_STACKSIZE_MIN))
CFLAGS += -DEVENT_THREAD_LOWEST_STACKSIZE=$(EVENT_THREAD_LOWEST_STACKSIZE_MIN)
endif
endif
endif
ifneq (, $(EVENT_THREAD_MEDIUM_STACKSIZE_MIN))
EVENT_THREAD_MEDIUM_STACKSIZE_MIN := $(call max_number,$(EVENT_THREAD_MEDIUM_STACKSIZE_MIN) $(EVENT_THREAD_STACKSIZE_MIN))
CFLAGS += -DEVENT_THREAD_MEDIUM_STACKSIZE=$(EVENT_THREAD_MEDIUM_STACKSIZE_MIN)
endif