user87154: I want to use all SRAM of an Arduino by writing the code in assembly. But does the bootloader use some SRAM while the program is running, and if the answer is yes would changing that data lead to failure or does the data stored there get corrupted? Thanks for reaching out.

user7508: You did not specify what type of Arduino you are using. My answer is for
the AVR-based ones.
The bootloader does use RAM while it is running. However, once it
handles control to your program, the microcontroller is all yours: you
are free to use all the RAM.
Id did not check with optiboot but, it is possible that the bootloader
leaves some stuff in the stack. The C runtime of the avr-libc takes care
of this: one of the first things it does is to reset the stack pointer.
If you link with the avr-libc, you will find the stack empty. If you
don't, I suggest you set the stack pointer to RAMEND at the beginning of
your program, just in case.

87154: <p>I want to use all SRAM of an Arduino by writing the code in assembly. But does the bootloader use some SRAM while the program is running, and if the answer is <em>yes</em> would changing that data lead to failure or does the data stored there get corrupted? Thanks for reaching out.</p>
 7508: <p>You did not specify what type of Arduino you are using. My answer is for
the AVR-based ones.</p>
<p>The bootloader does use RAM <em>while it is running</em>. However, once it
handles control to your program, the microcontroller is all yours: you
are free to use all the RAM.</p>
<p>Id did not check with optiboot but, it is possible that the bootloader
leaves some stuff in the stack. The C runtime of the avr-libc takes care
of this: one of the first things it does is to reset the stack pointer.
If you link with the avr-libc, you will find the stack empty. If you
don't, I suggest you set the stack pointer to RAMEND at the beginning of
your program, just in case.</p>
