Repository navigation
Add esptool backend the ESP32-C3, switch to XIP flash layout - #149
lschuermann wants to merge 2 commits into
Conversation
1dae316 to
70e4fc9
Compare
bradjc
left a comment
There was a problem hiding this comment.
The separation between connecting and entering the bootloader is a little messy, but, it doesn't matter that much.
| """ | ||
| Import esptool lazily, such that it is only required for users of this | ||
| channel. | ||
| """ | ||
| try: | ||
| import esptool.cmds | ||
| from esptool.logger import log | ||
| except ImportError: | ||
| raise TockLoaderException( | ||
| "Tockloader esptool support requires esptool >= 5.0. " | ||
| "Install it with `pip install esptool`." | ||
| ) |
There was a problem hiding this comment.
We should just install it with the package. There is nothing worse than using a tool and then having it tell you you need to install its dependencies for it when it could have just done it.
There was a problem hiding this comment.
Yeah, that makes sense! I guess I was defaulting to the way the nRF tools work given they're proprietary.
There was a problem hiding this comment.
Hm, esptool is GPL-2.0 and Tockloader is MIT, so we couldn't re-distribute a bundle if we add it as a required dependency. 😒
Yeah, I don't know how to improve it given those are inherently the same thing with the ESP's bootloader. |
This adds a Tockloader `BoardInterface` implementation that uses the Python API of `esptool` to read and write the external SPI flash of Espressif chips through their ROM serial bootloader. It keeps a single connection to the chip open for each Tockloader command, which avoids a chip reset and flasher stub upload for every flash read. `esptool` is imported lazily, such that it is only required for users of this backend. This requires `esptool` >= 5.0. Tockloader uses this backend when passed `--esptool`. Otherwise, it probes serial ports with Espressif's USB VID or a USB-UART bridge commonly found on Espressif development kits, and only selects this backend when `esptool` reports a supported chip on that port. This probing runs before the serial bootloader probing, which would otherwise claim the chip's serial port. This also switches the ESP32-C3-DevKitM-1 board definition to the XIP flash layout introduced in tock/tock#5260, with the kernel mapped at 0x42000000 and apps starting at 0x42040000. The previous layout, which had the ROM bootloader copy the kernel into SRAM, is no longer supported. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
70e4fc9 to
1bdec0e
Compare
As the title says, this:
esptoolsupport which can read and write the chip's external SPI flash, adding native support for both chip discovery and modifying Tock's app list.