Reboot into UART download mode without external wiring or interaction by twischer · Pull Request #7854 · esp8266/Arduino · GitHub
Skip to content

Reboot into UART download mode without external wiring or interaction#7854

Merged
earlephilhower merged 1 commit into
esp8266:masterfrom
twischer:reboot_uart_download
Feb 17, 2021
Merged

Reboot into UART download mode without external wiring or interaction#7854
earlephilhower merged 1 commit into
esp8266:masterfrom
twischer:reboot_uart_download

Conversation

@twischer

@twischer twischer commented Jan 31, 2021

Copy link
Copy Markdown
Contributor

This patch introduces the new method Esp.reboot_uart_dwnld().
With this method the UART download mode can be selected by software only.

When the user calls this method the ESP8266 reboots into the UART
download mode. In this mode the user can use esptool.py to flash a new
firmware file.
This patch was tested with the following command:

$ esptool.py --before no_reset --after soft_reset \
    --chip esp8266 --port /dev/ttyUSB0 --baud 460800 \
    write_flash 0x0 ./firmware.bin

The implementation is based on the original implementation in the
boot ROM. Some parts of the original implementation can be found in
https://github.com/twischer/xtensa-subjects/tree/reversed/reversed

@earlephilhower

Copy link
Copy Markdown
Collaborator

@twischer

twischer commented Feb 1, 2021

Copy link
Copy Markdown
Contributor Author

@twischer twischer force-pushed the reboot_uart_download branch 3 times, most recently from ccd5dbe to af404b3 Compare February 3, 2021 20:18

@earlephilhower earlephilhower left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation in the PR.

Overall seems like a fine idea and useful in some circumstances, but a little polish would help make it maintainable later on.

Comment thread cores/esp8266/esp8266_undocumented.h Outdated
Comment thread tools/sdk/ld/eagle.rom.addr.v6.ld Outdated
Comment thread tools/sdk/ld/eagle.rom.addr.v6.ld Outdated
Comment thread cores/esp8266/esp8266_undocumented.h Outdated
Comment thread cores/esp8266/reboot_uart_dwnld.cpp Outdated
Comment thread cores/esp8266/reboot_uart_dwnld.cpp Outdated
Comment thread cores/esp8266/Esp.cpp Outdated
Comment thread cores/esp8266/reboot_uart_dwnld.cpp Outdated

@earlephilhower earlephilhower left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the add'l comments and cleanup. LGTM!

@earlephilhower earlephilhower left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup and add'l comments. LGTM!

@twischer twischer force-pushed the reboot_uart_download branch from 256d87b to b113626 Compare February 9, 2021 18:25
@earlephilhower earlephilhower requested a review from d-a-v February 13, 2021 16:39
Comment thread tools/sdk/lib/fix_sdk_libs.sh Outdated

@d-a-v d-a-v left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.
Regular builds are unmodified according to a quick test when this new API is not used.

without any external wiring.

This patch introduces the new method
Esp.rebootIntoUartDownloadMode()

When the user calls this method the ESP8266 reboots into the UART
download mode. In this mode the user can use esptool.py to flash a new
firmware file. The following command was used to test it:
$ esptool.py --before no_reset --after soft_reset --chip esp8266 \
    --port /dev/ttyUSB0 --baud 460800 write_flash 0x0 firmware.bin

The implementation is based on the original implementation in the
boot ROM. Some parts of the original implementation can be found in
[1]. This patch is a squashed and simplified version of [2]. The non
squashed version might be helpful in case of debugging issues.

[1] https://github.com/twischer/xtensa-subjects/blob/master/reversed/bootrom.c
[2] https://github.com/twischer/Arduino/tree/reboot_uart_download_full

Signed-off-by: Timo Wischer <twischer@freenet.de>
@twischer twischer force-pushed the reboot_uart_download branch from 3ef1772 to c7efc35 Compare February 16, 2021 15:53
@earlephilhower earlephilhower merged commit 83f5f29 into esp8266:master Feb 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants