You are reading a single comment by @fanoush and its replies. Click here to read the full conversation.
  • I'm using precisely this as it is what most smart watches do to enter bootloder, so something like this could work

    +++ b/targets/nrf5x_dfu/main.c
    @@ -100,13 +100,39 @@ bool dfu_enter_check(void) {
     [#else](http://forum.espruino.com/search­/?q=%23else)
       dfu_start = dfuIsColdBoot; // if no button, enter bootloader if it's a cold boot, then exit after a few seconds
     [#endif](http://forum.espruino.com/searc­h/?q=%23endif)
    +  if (NRF_POWER->GPREGRET == 1) { NRF_POWER->GPREGRET=0; return true; }
    [#ifdef](http://forum.espruino.com/searc­h/?q=%23ifdef) BUTTONPRESS_TO_REBOOT_BOOTLOADER^M
         // if DFU looks invalid, go straight to bootloader
         if (s_dfu_settings.bank_0.bank_code == NRF_DFU_BANK_INVALID) {
           lcd_println("BANK0 INVALID");
    

    so just one line to put here https://github.com/espruino/Espruino/blo­b/master/targets/nrf5x_dfu/main.c#L103

    and then just poke32(0x4000051c,1) triggers DFU. However as Gordon mentions it is a bit dangerous, anyone can trigger DFU update remotely if you don't set up console password or other protection (like whitelisting/refusing unknown connections)

About

Avatar for fanoush @fanoush started