Nano ESP32: allow `machine.bootloader` to run either hardware or DFU bootloader
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 withdfu-tool)machine.bootloader(1)starts the ESP32-S3 hardware bootloader (for use withesptool)
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.
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
Thanks for the contribution. This will need to wait until #15108 is merged.
@dpgeorge Rebased to include the now-merged #15108.