upon pressing the reset button which is connected to pin1
I see “reset button wakeup” being printed in the log, but when I uncomment main(), I do not see it in log, so my assumption is it doesn’t enter reboot function
Again, you are not posting complete code, or how the button is connected to pin 1 (does it have a pull-up or pull-down? where does it short to when the switch is pressed?) so hard to help here.
When the imp goes to deep sleep, the Squirrel program stops running and all its variables are forgotten. When it wakes up from deep sleep, whether on pin1 or from a timer, then the code starts again from the top (not in your “reboot” function). To distinguish pin1 wake-ups from power-cycles, timer wake-ups etc., use hardware.wakereason(): so, the top of your code might look like this: if (hardware.wakereason() == WAKEREASON_PIN1) { reboot(); }