Page 1 of 1

Stack Overflow Protection

Posted: Fri Nov 23, 2018 2:05 pm
by iain wilkie
So after discovering that an older program I had in V4 would not run in an ATTiny13 in FC8 due to the stack overflowing, I am wondering what measures FC8 could take to flag this up as an error or a warning, this should be I would have though be a fairly important check given that the programmer may have no knowledge as to how much stack is being consumed.

Also to be able to access the .lst file from within FC8 would be very handy

Iain

Re: Stack Overflow Protection

Posted: Fri Nov 23, 2018 6:19 pm
by Benj
Hello Iain,

On an AVR device we display something like this in the compiler messages.
text data bss dec hex filename
832 0 35 867 363 C:\Users\BenR\AppData\Local\Temp\Inflation REV4A_v7-1.elf
This is specifically from your posted Inflation program.

Flash usage is the .text combined with a copy of the .data initialisers

(static) RAM usage is a combination of data and bss

Might be worth looking at the AVR freaks forums as there are some relevant threads on the topic.

On a PIC things are much better and it lets you know if there are likely to be stack or memory issues. Other devices such as ARM have the same problem as AVR but also have a lot more memory available so it's much less likely to run into the problem.

Re: Stack Overflow Protection

Posted: Fri Nov 23, 2018 8:28 pm
by iain wilkie
Benj,

Thanks for the reply but I don't see or understand how this info allows an informed assessment of stack overflow ???

Iain