How should I protect flash content


I was using RL78/G13, and I have read the articles about code flash protection in forums and manuals. if the security ID is set, No one can read the flash content of the chip. But there is a question: can someone else erase the first block, and write their own program, and read out the contents of other blocks through Uart? Is my idea right?


If the above approach is feasible, I know that Security Set can prevent other people from erasing behavior, thus preventing the above from happening. But after erasing is disabled, there is no way to reprogram the chip through the programmer, which brings some troubles in production. Is there any other solution?