Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to Espressif32@6.0.0 will break upload #1004

Closed
jenschr opened this issue Jan 17, 2023 · 10 comments
Closed

Updating to Espressif32@6.0.0 will break upload #1004

jenschr opened this issue Jan 17, 2023 · 10 comments

Comments

@jenschr
Copy link

jenschr commented Jan 17, 2023

Two of my students updated dependencies in Platformio today and they both get the error during compilation:

Compiling .pio/build/adafruit_feather_esp32s3_nopsram/src/main.cpp.o
*** [.pio/build/adafruit_feather_esp32s3_nopsram/partitions.bin] Source `partitions-4MB-tinyuf2.csv' not found, needed by target `.pio/build/adafruit_feather_esp32s3_nopsram/partitions.bin'.

This error occurs when the espressif32 tools are updated to version 6.0.0. It happens when the main.cpp file is built. I've confirmed the error on three different machines. This was confirmed using Adafruit Feather ESP32-S3 NoPSRAM (https://www.adafruit.com/product/5323) to test with. If you run into this issue using a different board, leave a message on this issue with the board name.

To fix the issue:
Find out why PlatfromIO want to load "partitions-4MB-tinyuf2.csv" when i clearly should have used "partitions-8MB-tinyuf2.csv" as can be seen from here: https://github.com/espressif/arduino-esp32/tree/master/variants/adafruit_feather_esp32s3_nopsram For some reason, it insists on loading the a file from the adafruit_feather_esp32s2 definition found here: https://github.com/espressif/arduino-esp32/tree/master/variants/adafruit_feather_esp32s2

To work around the issue until fixed:
A simple workaround is to force a lower version of espressif32 in the platformio.ini file:

platform = espressif32@5.3.0

This will make it all work as it should.

Example platformio.ini file for ESP32S3:

[env:adafruit_feather_esp32s3_nopsram]
platform = espressif32@5.3.0
board = adafruit_feather_esp32s3_nopsram
framework = arduino
monitor_speed = 115200
build_flags = -DARDUINO_USB_MODE=1

(Note that the lower two lines will solve espressif/arduino-esp32#6762 but I have no idea how to get this into the platformio.ini distribution for ESP32-S3)

@Jason2866
Copy link
Contributor

Jason2866 commented Jan 17, 2023

It is the predefined partition scheme here https://github.com/platformio/platform-espressif32/blob/develop/boards/adafruit_feather_esp32s3_nopsram.json#L5
IMHO it is a bad idea that Adafruit thinks everyone wants to use the tinyuf...
You have to override this predefined partition scheme with the one you want to use in your Env.
A other solution is not to use any provided boards.json. Using selfmade boards.json is easy. Described in docu https://docs.platformio.org/en/stable/platforms/creating_board.html

In the project Tasmota we do like that. Using only self defined boards and we have the need for custom partitions.csv too. No more surprises.

@jenschr
Copy link
Author

jenschr commented Jan 17, 2023

@Jason2866 Sure. It's just yet another thing that the students (and everybody else using the ESP32 S3) will have to learn. Then again - if Adafruit submits files for their board, I would say it's their right to use what is optimal for them.

The issue/problem is however that that espressif32@6.0.0 breaks a behavior that has worked for many months. It selects the wrong file. That is the bug I'm reporting here.

@Jason2866
Copy link
Contributor

Fully understand. Before it was wrong too, and it was changed ;-) The mess here many boards are sold under the same name with different specs.
With the S3 and OPI flash the situation has become worse. Even the Espressif Arduino guys needed some attempts to support it. Build bootloader correctly, boot flash mode and some other stuff. I had to dive deep in that to get my S3 with OPI correctly booting and working.
Did a few PRs....

@valeros
Copy link
Member

valeros commented Jan 17, 2023

Hi @jenschr ! Thanks for reporting, fixed in the dev branch. A simple workaround is to specify the required partition manually directly in your platformio.ini:

[env:adafruit_feather_esp32s3_nopsram]
platform = espressif32
framework = arduino
board = adafruit_feather_esp32s3_nopsram
monitor_speed = 115200
board_build.partitions = partitions-8MB-tinyuf2.csv

Or let me know if it's critical and you'd like a bug fix release ASAP.

@jenschr
Copy link
Author

jenschr commented Jan 22, 2023

Yeah. This is a good fix as well. It would be wise to roll this change out as quickly as possible. There's a host of boards coming out these days that are based on the S3. The WT32-SC01 PLUS is for instance really popular with hackers since you get a good TFT with touch. These new boards will all hit this problem, so if a 6.0.1 fix is out that solves this permanently, they'll get that instead of the 6.0.0.

As mentioned in the linked issue, these two lines should ideally also be added as default platformio.ini for S3 also:

monitor_speed = 115200
build_flags = -DARDUINO_USB_MODE=1

The first just sets the expected baud rate for the module, but the other selects the correct USB Upload mode. These boards can use their internal USB as either upload or OTG Host. Setting -DARDUINO_USB_MODE=1 will make uploading the default. It's 99% more likely that someone is uploading firmware than using USB Host. And - if you're using USB Host, you probably want to add some more config anyway.

So if this line is added to the default platformio.ini for this board, it'll be a lot less support requests in the coming months.

@Jason2866
Copy link
Contributor

Jason2866 commented Jan 22, 2023

@jenschr as you wrote many new boards with a S3 are already there and many more will come. It will be nearly impossible to add every board. The planned and already in the works Platformio Boards Configurator will solve this problem.

This is not a good default S3 setting, since it will break many boards from working

build_flags = -DARDUINO_USB_MODE=1

@jenschr
Copy link
Author

jenschr commented Jan 22, 2023

@Jason2866 This thread is specifically about the Adafruit Feather S3 with no PSRAM. I have a board similar to that (using the ESP32-S3-MINI-1 module with build-code M0N8), but I also have other boards that need this fix. I'd love to hear which other S3 with no PSRAM boards that this won't work for?

Adafruit also sells the same board, but with a ESP32-S3-MINI-1 module with 4MB Flash and 2MB PSRAM. This board has another config and so has all the boards from Unexpected Maker. I can't quite see what you mean here? This config will work for every ESP32-S3-MINI-1 module with 8MB Flash based on the internal USB support.

@Jason2866
Copy link
Contributor

Jason2866 commented Jan 22, 2023

I understood this for a standard for all S3 devices. The setting should only be used when no extra USB serial converter chip is on the board.
I doubt all Adafruit S3 boards will be like this, and it is for sure not for other boards.

@jenschr
Copy link
Author

jenschr commented Jan 22, 2023

@Jason2866 I'm quite sure that all Adafruit Feather ESP32 S3 boards will use the internal USB for programming, but obviously Adafruit should tell that. It's sort of the main selling point of the S2 & S3 that you only need a USB chip if you want to add USB Host. But sure... I'll leave it at that and then we can just watch the issue list to see if I'm right? ;-)

@Jason2866
Copy link
Contributor

Looked at Adafruit site. Yes it looks like all S3 boards from Adafruit have no Serial USB chip.
So the USB setting you suggested is indeed the one which has to be in the boards.json!

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

No branches or pull requests

3 participants