A Cisco router enters setup mode when it cannot locate a valid configuration file in NVRAM. This happens on a new router or when the configuration register is set to ignore the startup-config. The IOS image being corrupt would cause boot failure, not setup mode. Setup mode is the router's way of getting initial configuration from the user.