An internal nonvolatile memory contains a program to be executed during a
rewrite operation mode. During the rewrite operation mode a CPU core
writes received rewrite data to an external nonvolatile memory according
to a program in the internal nonvolatile memory. A first selector circuit
transmits a first chip select signal to the external nonvolatile memory
when a mode signal indicates a normal operation mode, and transmits the
first chip select signal to the internal nonvolatile memory when the mode
signal indicates the rewrite operation mode. Since the activation of the
internal nonvolatile memory is inhibited during the normal operation
mode, it is possible to prevent erroneous execution of the program in the
internal nonvolatile memory during the normal operation mode, and to
prevent data rewrite to the external nonvolatile memory.