micropython icon indicating copy to clipboard operation
micropython copied to clipboard

Nano ESP32: allow `machine.bootloader` to run either hardware or DFU bootloader

Open pillo79 opened this issue 1 year ago • 4 comments

Summary

The machine.bootloderimplementation on the Arduino Nano ESP32 is different from other Espressif-based boards in that it calls a custom "bootloader" (actually, a different application) which allows DFU uploads. This allows users to easily switch between Micropython and Arduino C environments.

However in some cases the hardware bootloader is still useful - for example when a full flash is required. This PR introduces argument parsing of the machine.bootloader() implementation so that when it is called with 1 as argument, the hardware bootloader is started - in all other cases, as before, the Arduino bootloader will run.

Testing

Tested on Arduino Nano ESP32:

  • machine.bootloader() starts the Arduino bootloader (for use with dfu-tool)
  • machine.bootloader(1) starts the ESP32-S3 hardware bootloader (for use with esptool)

pillo79 avatar Aug 23 '24 09:08 pillo79

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.43%. Comparing base (6c3dc0c) to head (b3b99ab).

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #15697   +/-   ##
=======================================
  Coverage   98.43%   98.43%           
=======================================
  Files         163      163           
  Lines       21290    21290           
=======================================
  Hits        20956    20956           
  Misses        334      334           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Aug 23 '24 09:08 codecov[bot]

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:   +16 +0.002% RPI_PICO_W
       samd:    +4 +0.002% ADAFRUIT_ITSYBITSY_M4_EXPRESS

github-actions[bot] avatar Aug 23 '24 09:08 github-actions[bot]

Thanks for the contribution. This will need to wait until #15108 is merged.

dpgeorge avatar Aug 26 '24 01:08 dpgeorge

@dpgeorge Rebased to include the now-merged #15108.

pillo79 avatar Oct 09 '24 07:10 pillo79