Debug Stack Issue

Hello,

Firstly, I would like to apologize for plethora of emails/queries in quick succession.

But, I am having an issue. When I enable Debugging by switching the value from (0) to (1), I start getting error after uploading (to iotlab-m3). To be precise I want to debug the following files:

stm32_common/pm.c

pm_layered/pm.c

Error: Stack Too Small.

If I try to use ‘printf’ instead of DEBUG, I encounter another issue. In this case, no data appears on the serial port.

I increased EXTRA_THREAD_STACK as well. Even this did not help.

I really need to find out the how power management works when sending a packet or waiting to receive a packet. This is related to the query (Radio Interrupt Handler). Please suggest me a solution.

Thank you.

Regards,

Navneet Pandey

If you want to print inside an ISR you might want to increase the stack sizes in the configuration at https://github.com/RIOT-OS/RIOT/blob/master/cpu/cortexm_common/include/cpu_conf_common.h#L47

Due to a bug in debug.h, the stack size check in the debug macro when called from an ISR on Cortex-M is actually checking the stack size of the last running thread, even though it is the exception stack that is being used by printf. The workaround is to increase the stack size of the idle thread as well, just to get it past the stack size check. If you have lots of ram on your mcu you could just bump the idle stack size and the ISR stack size to 1024 and be fine.

Hope this helps, Joakim