Skip to content

Commit

Permalink
rp2040.enableDoubleResetBootloader only on RP2040 (#2607)
Browse files Browse the repository at this point in the history
The RP2350 boot ROM seems to randomize memory on a HW reset, including
both CPU stacks where we normally stuff the "reset to bootloader" flag.
Update the docs and source to remove rp2040.enableDoubleResetBootloader()
on RP2350-based boards.

Fixes #2606
  • Loading branch information
earlephilhower authored Nov 14, 2024
1 parent 7a0adfe commit 083d86d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cores/rp2040/RP2040Support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/

#ifdef PICO_RP2040

#include <Arduino.h>
#include <hardware/structs/psm.h>

Expand All @@ -31,3 +33,5 @@ void RP2040::enableDoubleResetBootloader() {
boot_double_tap_check();
}
}

#endif
2 changes: 2 additions & 0 deletions cores/rp2040/RP2040Support.h
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ class RP2040 {
}
}

#ifdef PICO_RP2040
static void enableDoubleResetBootloader();
#endif

void wdt_begin(uint32_t delay_ms) {
watchdog_enable(delay_ms, 1);
Expand Down
4 changes: 2 additions & 2 deletions docs/rp2040.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ doing any WiFi calls.
Bootloader
----------

void rp2040.enableDoubleResetBootloader()
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
void rp2040.enableDoubleResetBootloader() (Pico/RP2040 only)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Add a call anywhere in the sketch to ``rp2040.enableDoubleResetBootloader()`` and
the core will check for a double-tap on reset, and if found will start the USB
bootloader.
Expand Down

0 comments on commit 083d86d

Please sign in to comment.