It depends on the chip you use. Some microcontrollers has firmware protection features (on the system level) so you will need to check with your microcontroller providers/vendors on this. It is unlikely that you can enable it by ROM code, but you might be able to erase the whole flash and reprogram it.