glenn20 / mp-image-tool-esp32

Tool for manipulating MicroPython esp32 image files.
MIT License
16 stars 1 forks source link

Not able to open device in Windows to inspect paritions #3

Closed kwjones closed 3 weeks ago

kwjones commented 1 month ago

Nice project! Many thanks for this contribution.

I ran into a challenge when trying to view the partition table information via: "mp-image-tool-esp32 COMX" (where X is serial port under Windows 11). This works under Linux via "mp-image-tool-esp32 /dev/ttyUSB0" as well as via "mp-image-tool-esp32 u0"

I tried the short-hand device option under Windows "mp-image-tool-esp32 c6" but in both Windows cases, the serial device could not be opened, even though it is an available and unblocked serial COM port.

Any ideas? I'm testing on multiple ESP32-WROVER-E dev boards with the same result.

Also, I found that I can resize the flash on Micropython 1.23.0 image (ESP32_GENERIC-SPIRAM-20240602-v1.23.0.bin) to 16MB and saved as a new binary, but when I flash that updated binary to the device (ESP32 WROVER-E) that the device was not usable. HOWEVER, if I flash the micropython.org ESP32_GENERIC-SPIRAM-20240602-v1.23.0.bin to the device and THEN increase the flash size on the device itself (only on Linux due to the device reference issue cited at the top of this note) I can see the 16MB (14MB usable).

In both cases I'm using ESPTOOL 4.7 on both Linux (Ubuntu 22.04) and Windows 11.

Thanks in advance for any guidance on this.

glenn20 commented 1 month ago

I ran into a challenge when trying to view the partition table information via: "mp-image-tool-esp32 COMX" (where X is serial port under Windows 11). This works under Linux via "mp-image-tool-esp32 /dev/ttyUSB0" as well as via "mp-image-tool-esp32 u0"

I tried the short-hand device option under Windows "mp-image-tool-esp32 c6" but in both Windows cases, the serial device could not be opened, even though it is an available and unblocked serial COM port.

Ah, sorry about that. Thanks for reporting this. I wasnt able to test the final released version on Windows (I don't currently have any windows machines I can use for testing). I tried to use portable python constructs throughout, but that doesn't seem to have been sufficient.

I am guessing it will be an issue in the subprocess handling (launching esptool.py).

Can you provide a description of what went wrong and any error messages?

Also, I found that I can resize the flash on Micropython 1.23.0 image (ESP32_GENERIC-SPIRAM-20240602-v1.23.0.bin) to 16MB and saved as a new binary, but when I flash that updated binary to the device (ESP32 WROVER-E) that the device was not usable. HOWEVER, if I flash the micropython.org ESP32_GENERIC-SPIRAM-20240602-v1.23.0.bin to the device and THEN increase the flash size on the device itself (only on Linux due to the device reference issue cited at the top of this note) I can see the 16MB (14MB usable).

Try erasing the flash first (before flashing the new image) with esptool.py erase_flash. It may be necessary to reset the old vfs partitions before flashing a new firmware image.

Let me know if that does or does not resolve the issue, and if not, please provide some additional information, including what you mean by "unusuable" and what mp-image-tool-esp32 u0 reports after you have flashed the device (replace u0 with the name of the device you are using).

Good luck and thanks again for the report.

glenn20 commented 1 month ago

@kwjones - A few more diagnostic things to try on windows:

If the problems persist on Windows, please post the output of these commands.

glenn20 commented 1 month ago

I have pushed an update which might improve/fix the issue. Try pulling the latest from github (version 0.0.4) and see if that works on Windows.

If you have built and installed mp-image-tool-esp32 as a package, you will need to rebuild and reinstall. If you installed with the -e method, it will automatically use the updates.

glenn20 commented 1 month ago

And there is a newer version on my dev branch which does not run esptool.py as a subprocess at all. Instead, it imports the esptool module and calls the functions to operate on the device. This SHOULD be completely compatible with Windows.

glenn20 commented 3 weeks ago

Those changes have been merged from dev into the main branch. Please let me know if you continue to have issues on Windows.

glenn20 commented 2 weeks ago

Whoops - I hadn't merged the changes I thought I had. Fixed now. See v0.0.5 on github.