1. A method comprising: forming an insulating film having a multilayered structure over a semiconductor substrate; forming a memory gate over the insulating film; forming a gate oxide film over the uppermost surface and sidewalls of the memory gate; forming a first polysilicon layer over an entire surface of the semiconductor substrate including the memory gate and the gate oxide film; forming a second polysilicon layer over an entire surface of the first polysilicon layer; performing a first etching process on the first polysilicon and the second polysilicon; and then forming selective gates by performing a second etching process on the first polysilicon layer.