mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-28 16:01:18 +01:00
This adds a mechanism for modules to declare requirements on the thread stack size in their `Makefile.dep` and let the build system then override the default stack size, if any requirements are declared. The motivation is to allow multiple modules to have special requirements without causing conflicts, as just adding the following to their `Makefile.include` would do: ```Makefile CFLAGS += -DEVENT_THREAD_MEDIUM_STACKSIZE=<MAGIC_NUMBER> ``` Instead, the new mechanism would work by having them both declare in their `Makefile.dep`: ```Makefile EVENT_THREAD_MEDIUM_STACKSIZE_MIN += ``` The build system then picks the maximum number in `EVENT_THREAD_MEDIUM_STACKSIZE_MIN` and exposes this as stack size, if any module did declare a minimum requirement. Co-authored-by: benpicco <benpicco@googlemail.com>
36 lines
1.6 KiB
Makefile
36 lines
1.6 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
|
|
|
|
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
|
|
|
|
ifeq (,$(filter event_thread_medium, $(USEMODULE)))
|
|
# No medium priority event thread, so the medium prio queue is handled by
|
|
# the same thread handling the lowest priority queue. So we "trickle down"
|
|
# the requirements here
|
|
EVENT_THREAD_LOWEST_STACKSIZE_MIN += $(EVENT_THREAD_MEDIUM_STACKSIZE_MIN)
|
|
else
|
|
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
|
|
endif
|
|
|
|
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
|