diff --git a/cpu/riscv_common/Makefile.include b/cpu/riscv_common/Makefile.include index 8182f8dfe56f..ee4e6975bf4e 100644 --- a/cpu/riscv_common/Makefile.include +++ b/cpu/riscv_common/Makefile.include @@ -21,6 +21,13 @@ ifneq (,$(ITIM_START_ADDR)) LINKFLAGS += $(LINKFLAGPREFIX)--defsym=_itim_length=$(ITIM_LEN) endif +# Increase stack size of ISR stack if DEVELHELP is enabled. This is +# needed because handle_trap() uses printf on the ISR stack and printf +# usage results in a stack overflow with the default stack size. +ifeq (1,$(DEVELHELP)) + LINKFLAGS += $(LINKFLAGPREFIX)--defsym=__stack_size=512 +endif + LINKER_SCRIPT ?= riscv.ld include $(RIOTMAKE)/arch/riscv.inc.mk