title: Which one is the correct value for the initial stack pointer?
body: <p>I am using ARM-GCC compiler and I found on Internet two versions for the startup_stm32f10x_cl.c file (startup code). The processor is: STM32F105RC (ARM Cortex M3).      </p>
  
  <p>Common part :       </p>
  
  <pre><code>#define STACK_SIZE       0x100 /*!&lt; The Stack size */
  __attribute__ ((section(".co_stack")))
  unsigned long pulStack[STACK_SIZE];    
  </code></pre>
  
  <p>Then, the first version starts the vector table like this:</p>
  
  <pre><code>void (* const g_pfnVectors[])(void) =
  {       
    (void *)&amp;pulStack[STACK_SIZE],     /*!&lt; The initial stack pointer           */
    Reset_Handler,                /*!&lt; Reset Handler                            */
  ...
  </code></pre>
  
  <p>while the second version looks like this:</p>
  
  <pre><code>void (* const g_pfnVectors[])(void) =
  {       
    (void *)&amp;pulStack[STACK_SIZE - 1],     /*!&lt; The initial stack pointer           */
    Reset_Handler,                /*!&lt; Reset Handler                            */
      ...
  </code></pre>
  
  <p>So, my question is:<br>
  Which one is the correct stack pointer initialization?</p>