title: Why do I need an infinite loop in STM32 programming?
body: <p>I'm programing a STM32F4 in C (gcc), it's a ARM Cortex M4, I see all examples finish their main() function with an infinite loop, even when the rest of the program will be executed from interruptions. If I try to remove the loop from my program, the interruptions stop being fired too.</p>
  
  <p>Why can't I just remove this loop and exit the main thread?</p>
  
  <p>here is the assembly (I guess it's thumb, but I can't read that, even with the doc): </p>
  
  <pre><code>LoopFillZerobss:
  ldr  r3, = _ebss
  cmp  r2, r3
  bcc  FillZerobss
  
  /* Call the clock system intitialization function.*/
  bl  SystemInit 
  /* Call the application's entry point.*/
  bl  main
  bx  lr    
  .size  Reset_Handler, .-Reset_Handler
  </code></pre>