title: On Target Unit testing for STM32L0x3 using IAR
body: <p>I want to have a test frame work in my IAR Project. The processor is an STM32L0. </p>
  
  <p>What I've tried:</p>
  
  <ul>
  <li><p><a href="https://github.com/cpputest/cpputest" rel="nofollow noreferrer">https://github.com/cpputest/cpputest</a> followed the turoial at : <a href="https://cpputest.github.io/stories.html" rel="nofollow noreferrer">https://cpputest.github.io/stories.html</a>
  Didn't work because there is only 64K Flash &amp; 8K RAM</p>
  
  <p><a href="https://i.stack.imgur.com/CUHyx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CUHyx.png" alt="enter image description here"></a></p>
  
  <p>and its not enough for this framework</p></li>
  <li><p><a href="https://github.com/ThrowTheSwitch/Unity.git" rel="nofollow noreferrer">https://github.com/ThrowTheSwitch/Unity.git</a> I tried to intigrate into IAR Embedded workbench but had a lot of compiler errors also not enough space so I tried to run it on my Desktop. This doesn't work because it has too many Hardware dependencies in the code..</p></li>
  <li><p>Next I tried to just make "Pseudo" unit testing by putting a test routine at boot of the device which can be switched on and off by precompiler directives.</p></li>
  </ul>
  
  <p>Like this (not finished): </p>
  
  <pre><code>#if PREFORM_TESTS
      TEST_run();
  #endif  
  </code></pre>
  
  <p>And then with files: </p>
  
  <pre><code>#include "testAll.h"
  #include "testEvent.h"
  #include "stm32l0xx_hal.h"
  
  void TEST_run(){
    TEST_EVENT_run();
  }
  void assert_failed(uint8_t* file, uint32_t line){
    while(1);  
  }
  
  #include "testEvent.h"
  #include "testAll.h"
  #include "event.h"
  #include "stm32l0xx_hal.h"
  
  void test_add_event();
  
  void TEST_EVENT_run(){
      test_add_event();
  }
  
  void test_add_event(){
    ASSERT(1); 
  }
  </code></pre>
  
  <p>How can I run Unit Tests on my STM32L0x3?</p>