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

platformio-build-esp32*.py scripts do not respect upload.extra_flags #5255

Closed
maxgerhardt opened this issue Jun 8, 2021 · 8 comments
Closed
Labels
IDE: PlaformIO Issue relates to PlatformIO IDE Resolution: Wontfix Arduino ESP32 team will not fix the issue

Comments

@maxgerhardt
Copy link
Contributor

maxgerhardt commented Jun 8, 2021

Hardware:

Board: Feather ESP32-S2 and related
Core Installation version: current git version, a618fc1
IDE name: PlatformIO
Flash Frequency: 80Mhz
PSRAM enabled: no
Upload Speed: 115200
Computer OS: Windows 10

Description:

Looking at the Arduino IDE description of the board

arduino-esp32/boards.txt

Lines 3772 to 3774 in a618fc1

adafruit_feather_esp32s2_nopsram.upload.flags=
adafruit_feather_esp32s2_nopsram.upload.extra_flags=0x2d0000 "{runtime.platform.path}/variants/{build.variant}/tinyuf2.bin"
adafruit_feather_esp32s2_nopsram.upload.use_1200bps_touch=true

and the PlatformIO board definition, I do not see anything in the build script that would implement the extra_flags with the TinyUF2 bootloader in PlatformIO.

I would have expected that the information of this "extra flash image" is encoded in e.g. the board JSON definition and in the builder script, which can then use FLASH_EXTRA_IMAGES to trigger the uploading of that binary file.

https://github.com/platformio/platform-espressif32/blob/4cb06337d678312dbcb293f508d7de7d7124ee68/builder/main.py#L318-L319

so e.g. in or after

FLASH_EXTRA_IMAGES=[
("0x1000", join(FRAMEWORK_DIR, "tools", "sdk", "esp32s2", "bin", "bootloader_${BOARD_FLASH_MODE}_${__get_board_f_flash(__env__)}.bin")),
("0x8000", join(env.subst("$BUILD_DIR"), "partitions.bin")),
("0xe000", join(FRAMEWORK_DIR, "tools", "partitions", "boot_app0.bin"))
]

I would have expected a check if the board needs extra flash images (currently in the boards.txt, 4 boards use extra flags), and then add these to the array, as e.g. with

    ("0x2d0000", join(FRAMEWORK_DIR, "variants", env.BoardConfig().get("build.variant"), "tinyuf2.bin")

or somewhere between the lines (above code is simplified and would not work with a changed build.variants_dir, just PoC). With that missing, these 4 boards are probably only working within the Arduino IDE right now (with regards to the TinyUF2 bootloader).

This would also resolve this where people are asking how to use new board definitions with PlatformIO.

@brentru
Copy link

brentru commented Aug 10, 2021

Bumping this issue - having the same issue as @maxgerhardt

@me-no-dev
Copy link
Member

this issue is particular to PlatformIO. Please take the problem there :) This should be done in the PIO board config (or maybe added to the project)

cc: @ivankravets @valeros

@maxgerhardt
Copy link
Contributor Author

The current builder scripts already declare the extra images to flash, and the TinyUF2 bootloader is specific to Arduino-ESP32. In my view this must by handled in the platformio-build-*.py, not in platform-espressif32. The platform scripts directly call into the framework's script, expecting them to do the heay platform-specific lifting (source)

@me-no-dev
Copy link
Member

the TinyUF2 bootloader is specific to particular boards. It is not used in general to be in platformio-build-*.py

@VojtechBartoska
Copy link
Collaborator

Hello @maxgerhardt , I'm closing this issue as there is nothing to do on our side. Thanks for your contribution.

@maxgerhardt
Copy link
Contributor Author

Doing it in only platform-espressif32 scripts is way more complicated. The board definitions for the boards using the TinyUF2 bootloader should be expanded by an attribute (say, board.build.arduino.tinyuf2_bootloader = true) which can then be reacted to in the builder scripts in this respository. Otherwise code for some bootloaders is in the builder script here and some others in some weird post-fixup-things-not-done-in-arduino-esp32-script. Please rethink this design decision.

@VojtechBartoska
Copy link
Collaborator

Thanks for fast reply, @me-no-dev can you please take a look in meantime on last comment and if it's applicable? Thanks!

@VojtechBartoska
Copy link
Collaborator

Hello, at this moment we are not able to consider this, marking us won't fix for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
IDE: PlaformIO Issue relates to PlatformIO IDE Resolution: Wontfix Arduino ESP32 team will not fix the issue
Projects
None yet
Development

No branches or pull requests

4 participants