In squirrel how do I make the imp restart as if power had been removed and applied again?
I don’t believe you can. Restarting the imp through Squirrel (or via, for example, a runtime error) sets a flag which tells the imp’s CPU that it’s not booting cold. This flag is only ever cleared as a result of a power cut.
That said, since Squirrel starts up afresh each time, your application code doesn’t implicitly ‘know’ that it wasn’t warm booted (until it checks hardware.wakereason() or data persisted in the nv table).
Actually remove power and apply it again?
Connect one pin to a 555 timer and NC relay (opening the relay) that will break power? So you will be removing power for maybe 5 seconds, and then the relay will close again and repower the imp? Not sure why anyone would need to do that, but anyhow.
If you deep sleep (eg imp.deepsleepfor(1)) then the CPU core gets turned off, RAM gets cleared, and the device starts running code from the start again.
Not quite a cold boot, but as close as you can get. Why are you wanting to restart it in this way?
That worked. It is for testing purposes during production.