What is a startup code in C for Microcontrollers ? When / Why / How it should be modified?
<p>This is a general question about startup code. I know it's like the bootloader or the first thing that run after reset or power up and it call the main function.</p>

<p>But i want to know it main / core functionnalities.</p>

<p>For example (Searching in google),</p>

<p>Startup code is executed immediately upon reset of the target system. The Keil startup
code performs (optionally) the following operations in order:</p>

<pre><code> Clears internal data memory
 Clears external data memory
 Clears paged external data memory
 Initializes the small model reentrant stack and pointer
 Initializes the large model reentrant stack and pointer
 Initializes the compact model reentrant stack and pointer
 Initializes the 8051 hardware stack pointer
 Transfers control to code that initializes global variables or to the main C function if
there are no initialized global variables
</code></pre>

<p>Nb: The startup code is always written in assembly since it depend on the CPU target.</p>

<p>Thanks for your time</p>