It's easy enough to check if the reset reason is SW_RESET and then enter bootloader. But to avoid accidental entry you could also set the GPREGRET register in Espruino, and then check it in the bootloader before entering automatically?
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
Nothing added yet - I have avoided doing this precisely because you could do firmware updates with no physical access. It seems like a bit of a worry.
The bootloader would be pretty easy to modify though. For instance we check the 'reset reason' at https://github.com/espruino/Espruino/blob/master/targets/nrf5x_dfu/main.c#L283
It's easy enough to check if the reset reason is SW_RESET and then enter bootloader. But to avoid accidental entry you could also set the GPREGRET register in Espruino, and then check it in the bootloader before entering automatically?