title: stm8 Read Out Protection (ROP) setting option byte in code
body: <pre><code>    FLASH_Unlock(FLASH_MEMTYPE_DATA); 
      if(FLASH_ReadOptionByte(0x4800)!=0xaa) 
      { 
      FLASH_ProgramOptionByte(0x4800, 0xaa);  
      } 
      FLASH_Lock(FLASH_MEMTYPE_DATA); 
  </code></pre>
  
  <p>Using stm8s003f3.</p>
  
  <p>Adding these code main initialization, code protect (ROP) is setting, but my application code is not working. </p>
  
  <p>If setting option byte via IAR or ST Visual Programmer option byte tab, then both of application code and code protect (ROP) are working correctly.</p>
  
  <p>I need to set ROP in code.</p>