Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does avr-gcc bother to save the register state when calling main()?

The main() function in an avr-gcc program saves the register state on the stack, but when the runtime calls it I understand on a microcontroller there isn't anything to return to. Is this a waste of RAM? How can this state saving be prevented?

like image 438
joeforker Avatar asked Jan 23 '26 00:01

joeforker


1 Answers

How can the compiler be sure that you aren't going to recursively call main()?

like image 102
Darron Avatar answered Jan 24 '26 17:01

Darron



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!