You are reading a single comment by @DanTheMan827 and its replies. Click here to read the full conversation.
  • There's nothing built in to Espruino though I'm afraid, but if it works maybe we should add it!

    Well, I proposed that previously but so far your argument was that it is dangerous - someone with access to console can remotely update your device so something physical (holding button) to enter DFU is safer.

    Some watches uses also value 1 in GPREGRET to trigger DFU so in my custom builds I have one liner

    --- a/targets/nrf5x_dfu/main.c
    +++ b/targets/nrf5x_dfu/main.c
    @@ -149,18 +153,19 @@ bool nrf_dfu_enter_check(void) {
     bool dfu_enter_check(void) {
     [#endif](https://forum.espruino.com/search/?q=%23endif)
       bool dfu_start;
    +  if (NRF_POWER->GPREGRET == 1) { NRF_POWER->GPREGRET=0; return true; }
     [#ifdef](https://forum.espruino.com/search/?q=%23ifdef) BTN1_PININDEX
       dfu_start = get_btn1_state();
     [#else](https://forum.espruino.com/search/?q=%23else)
    

    but I agree that it is somewhat dangerous.
    With that one liner in bootloader you enter DFU by poke32(0x4000051c,1), with softdevice enabled it automatically reboots (into DFU)

  • If it’s not enabled by default, I think it should definitely be behind an ifdef, or maybe enabled some other way. Maybe a DFU update that flips a byte flag somewhere?

    It’s hard though, because you’re trying to secure functionality through a repl console that should ultimately be password protected by the user… I get what you’re saying though

About