I'm looking at the disassembled startup code for C code compiled for an atmega32u4, using AS4. For some reason, the SPH and SPL are read, then decremented by 0x40 and then written back to SP. I dont understand why, it leaves 0x40 bytes of un-used stack space. I noticed this while playing around with stack monitoring code, thought it was an odd thing to do, and was hoping someone could explain the reason behind it.
IN R28,0x3D In from I/O location IN R29,0x3E In from I/O location SUBI R28,0x40 Subtract immediate SBCI R29,0x00 Subtract immediate with carry IN R0,0x3F In from I/O location CLI Global Interrupt Disable OUT 0x3E,R29 Out to I/O location OUT 0x3F,R0 Out to I/O location OUT 0x3D,R28 Out to I/O location