A peripheral apparatus reserves and stores, on a nonvolatile storage
medium, a first storage area which stores a control program for
implementing a function of the peripheral apparatus, and a second storage
area which stores a rewrite program for rewriting the control program.
The firmware is formed from at least the control program and the rewrite
program. When selectively switching and controlling a first mode for
updating the firmware of the rewrite program, and a second mode for
executing the control program, the first mode receives updating data of
the control program from an external apparatus, rewrites the control
program stored in the first storage area to updating data, using the
rewrite program, determines that a rewrite operation is normally ended,
and performs the rewrite operation again when the rewrite operation is
not normally ended.