How to Change Interrupt Stack Size in MCUXpressoIDE?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to Change Interrupt Stack Size in MCUXpressoIDE?

944 Views
yhgu2000
Contributor I

Hi,

I am using MKL36Z64VLH4, with NXP SDK v2.0.4 and MCUXpressoIDE.

I write a simple PIT example. It has an blank main() which only have a infinite while loop in it. The PIT module interrupt CPU every 1 second and it blink the led in its IRQ handler.

This is the Heap and Stack Usage when in main():

Snipaste_2020-02-14_09-29-51.png

But when the interruption happens and program enter the IRQ handler:

Snipaste_2020-02-14_09-30-35.png

This is strange. I assume that this is because CPU does not reserver enough stack space when it enters the handler.

So when I started to do some complex things in IRQ handler, the stack just overflowed! How to increase interrupt stack size?

I guess i am not the first guy who have this problem. In deed, I found an old solution :https://community.nxp.com/thread/440700#comment-860538. But It is not for MCUXpresso and doesn`t work with me either. I didn`t find anything about "__DEFAULT_INTERRUPT_STACK_SIZE" in the link file generated by MCUXpresso.

What should I do?

Thank you.

Yuhao Gu

Labels (1)
0 Kudos
1 Reply

852 Views
yhgu2000
Contributor I

em..........

I solved this problem on my own.

This problem is due to that total default ram size is only 512B (MKL36Z64VLH4 has 8KB memory). I didn`t expected that the default stack size configuration is such small. I set it to 4K and nothing goes overflowed now.

This is how I solved this problem:

Projects -> Properties -> MCU C++ Linker -> Managed Linker Script

Snipaste_2020-02-14_10-11-28.png

Snipaste_2020-02-14_10-05-34.png

(default setting is only 512B)

Snipaste_2020-02-14_10-06-02.png

(making it bigger may solve the problem)

0 Kudos