Gee, I composed a long answer, got distracted, and came back to press the preview button. The forum then took me to a login page, but ate my post. Classy!
The TLDR is that this is, in fact, not really Espressif's problem. I chased the problem all the way down to the wire and the upload of ~1MB of *.bins takes about 7.8 seconds at 1000000bps and 7.1 at 4000000bps, though it was unreliable on the WCH at that speed. Ekeing out that half second at the cost of reliability is stress I don't need.
The overall problem is that
` is doing about 23 seconds of
something, even on a 'do nothing' build. Only 7-8 seconds of my case is eaten in the actual serial transfer done by esptool. Visualy, the way it's presented throws esptool under the bus, but that's not where the REAL time goes.
username, to what do you attribute the difference? You're seeing a MB/sec with 4MB/4sec, but I'm seeing .5MB/~8sec. I don't think there's a life-changing amount of difference I can make without replacing Platformio/VSCode ((Wicked Witch voice, "and your little Arduino, too!") but now that I've dug deeply, I'm interested in understanding the engineering explanation for what's left.
Thank you for encouraging me to dig deeper.
The rest is just details for anyone curious about the research process and results found.
Another funny thing is that if you use cached builds and do a clean build, it takes ...
Code: Select all
========================= [SUCCESS] Took 31.21 seconds =========================
so apparently the actual copying (because it copies files from the cache to the build directories !?!?!) and linking takes about one second in my case. If I then do a clean AND remove the build cache, we see that optimizing all 500KB of object from scratch takes 3x as long as platformio just doing absolutely nothing.
Code: Select all
========================= 1 succeeded in 00:01:58.463 =========================
If you're moving 4MB in 4sec, your data must be WAY more compressed than mine is or your flash is faster.. Mine moves about 550MB in four sections at about half wire speed at 500kbps. My testing just won't go faster than that at any bit rate so I suspect I'm flash-bound. Is your 4MB image perhaps largely an empty filesystem or data that's more compressed than my executables? Are you using JTAG or faster flash or flashing straight to RAM? I can't seem to replicate your success on any combination of "real" UART or CDC-ACM implementation on the chips from the last 4 years.
For future generations reading this, the actual upload command is:
Code: Select all
esptool.py \
--chip esp32s3 --port /dev/cu.wchusbserial* --baud 3000000 \
write_flash --flash_mode keep \
--flash_freq 80m --flash_size 8MB \
0x0000 .pio/build/yd-esp32-s3-demo/bootloader.bin \
0x8000 .pio/build/yd-esp32-s3-demo/partitions.bin \
0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin \
0x10000 .pio/build/yd-esp32-s3-demo/firmware.bin
Flash will be erased from 0x00000000 to 0x00003fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x0000e000 to 0x0000ffff...
Flash will be erased from 0x00010000 to 0x000fcfff...
Compressed 15104 bytes to 10430...
Wrote 15104 bytes (10430 compressed) at 0x00000000 in 0.2 seconds (effective 499.2 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 146...
Wrote 3072 bytes (146 compressed) at 0x00008000 in 0.0 seconds (effective 511.9 kbit/s)...
Hash of data verified.
Compressed 8192 bytes to 47...
Wrote 8192 bytes (47 compressed) at 0x0000e000 in 0.1 seconds (effective 675.6 kbit/s)...
Hash of data verified.
Compressed 969952 bytes to 532866...
Wrote 969952 bytes (532866 compressed) at 0x00010000 in 7.0 seconds (effective 1106.0 kbit/s)...
Hash of data verified.
In case you suspect that esptool is smart and doesn't erase/write memory that hasn't change, it doesn't appear to be that clever. In my testing, it always erases and it always rewrites. So even if adding a read could save two write cycles and the reality that writes are slower than reads, it just doesn't seem to do so.
Thank you for making me question my tools and place blame and anger where it belongs.
P.S. I dig that this is a conversation between 'username' and "randomguy".