title: How to re-enable interrupts from within an interrupt handler on ARM Cortex-M3?
body: <p><strong>Background:</strong><br>
  I am using a cortex-M3 ARM core without an OS. </p>
  
  <p>My main loop waits for a flag from an interrupt handler and then executes a function <code>doBigTask()</code>.</p>
  
  <p>Within a separate interrupt handler, I want to execute another function <code>doSmallTask()</code>, but since this function is also non-trivial, I still want other I/O related interrupts to be handled.</p>
  
  <p><strong>My Question:</strong><br>
  Are there any issues with simply enabling interrupts from within <code>doSmallTask()</code>? For example, are there any complications with exiting an interrupt handler after interrupts have already been disabled?.</p>
  
  <p><em>Note:</em> I'm not expecting a re-entrant interrupt to occur as <code>doSmallTask()</code> will finish well before the next interrupt triggers it.</p>
  
  <pre><code>int flag = 0;
  
  void doSmallTask()
  {
     asm volatile ("cpsie i");  // Enable interrupts
     // do rest of function
     // ...
  }
  
  void irqHandler1()
  {
     flag = 1;
  }
  
  void irqHandler2()
  {
    doSmallTask();
  }
  
  void irqHandler3()
  {
    // service I/O
  }
  
  int main()
  {
    while(1)
      if (flag)
      {
        doBigTask();
        flag = 0;
      }
  }
  </code></pre>