FLASH_Unlock(FLASH_MEMTYPE_DATA);
if(FLASH_ReadOptionByte(0x4800)!=0xaa)
{
FLASH_ProgramOptionByte(0x4800, 0xaa);
}
FLASH_Lock(FLASH_MEMTYPE_DATA);
Using stm8s003f3.
Adding these code main initialization, code protect (ROP) is setting, but my application code is not working.
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.
I need to set ROP in code.
I used the following function: