Skip to content

Add protocol-explicit upload.tool properties required for pluggable discovery compatibility #7517

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

Merged
merged 2 commits into from
Dec 13, 2022

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Nov 26, 2022

Description of Change

A new flexible and powerful "pluggable discovery" system was added to the Arduino boards platform framework. This system makes it easy for Arduino boards platform authors to use any arbitrary communication channel between the board and development tools.

Boards platform configurations that use the old property syntax are automatically translated to the new syntax by Arduino CLI:

https://arduino.github.io/arduino-cli/latest/platform-specification/#sketch-upload-configuration

For backward compatibility with IDE 1.8.15 and older the previous syntax is still supported

This translation is only done in platforms that use the old syntax exclusively. If pluggable_discovery properties are defined for the platform then the new pluggable discovery-style upload.tool.<protocol_name> properties must be defined for each board as well.

This platform was converted to use the new pluggable discovery platform properties syntax (#6506), so those properties are now required. Although such properties were added to board definitions at the time the syntax was changed, some board definitions were missed at that time, or added later without the required properties (#6630).

Those missing properties caused uploads to fail for users of the recent versions of Arduino IDE and Arduino CLI with an error of the form:

Error during Upload: Property 'upload.tool.<protocol_name>' is undefined

(where <protocol_name> is the protocol of the selected port, if any)

It is also important to provide compatibility with versions of Arduino development tools from before the introduction of the modern pluggable discovery system. For this reason, the old style <board ID>.upload.tool properties are retained. Old versions of the development tools will treat the <board ID>.upload.tool.<protocol_name> properties as an unused arbitrary user defined property with no special significance and the new versions of the development tools will do the same for the <board ID>.upload.tool properties.

Tests scenarios

Upload to each of the boards via Arduino IDE 2.0.2 without encountering Property 'upload.tool.serial' is undefined error:

  • DOIT ESPduino32
  • ESP32 FM DevKit
  • UM RMP

Related links

Originally reported at https://forum.arduino.cc/t/xiao-boards-property-upload-tool-serial-is-undefined/1035010/16

The upload tool name was changed from `esptool` to `esptool_py`. The author of the "ESP32 FM DevKit" board definition used the old tool name and evidently never tested it, since the upload fails:

java.lang.NullPointerException
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingProgrammer(SerialUploader.java:295)
	at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:90)
	at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
	at processing.app.SketchController.upload(SketchController.java:732)
	at processing.app.SketchController.exportApplet(SketchController.java:703)
	at processing.app.Editor$UploadHandler.run(Editor.java:2055)
	at java.lang.Thread.run(Thread.java:748)
… discovery compatibility

A new flexible and powerful "pluggable discovery" system was added to the Arduino boards platform framework. This system
makes it easy for Arduino boards platform authors to use any arbitrary communication channel between the board and
development tools.

Boards platform configurations that use the old property syntax are automatically translated to the new syntax by
Arduino CLI:

https://arduino.github.io/arduino-cli/latest/platform-specification/#sketch-upload-configuration

> For backward compatibility with IDE 1.8.15 and older the previous syntax is still supported

This translation is only done in platforms that use the old syntax exclusively. If `pluggable_discovery` properties are
defined for the platform then the new pluggable discovery-style `upload.tool.<protocol_name>` properties must be defined
for each board as well.

This platform was converted to use the new pluggable discovery platform properties syntax, so those properties are
required. Although such properties were added to board definitions at the time the syntax was changed, some board
definitions were missed at that time, or added later without the required properties.

Those missing properties caused uploads to fail for users of the recent versions of Arduino IDE and Arduino CLI with an
error of the form:

Error during Upload: Property 'upload.tool.<protocol_name>' is undefined

(where `<protocol_name>` is the protocol of the selected port, if any)

It is also important to provide compatibility with versions of Arduino development tools from before the introduction of
the modern pluggable discovery system. For this reason, the old style `<board ID>.upload.tool` properties are retained.
Old versions of the development tools will treat the `<board ID>.upload.tool.<protocol_name>` properties as an unused
arbitrary user defined property with no special significance and the new versions of the development tools will do the
same for the `upload.tool` properties.
@CLAassistant
Copy link

CLAassistant commented Nov 26, 2022

CLA assistant check
All committers have signed the CLA.

@me-no-dev me-no-dev merged commit b2b4bf8 into espressif:master Dec 13, 2022
@me-no-dev
Copy link
Member

Thanks @per1234 for the fixes :)

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

Successfully merging this pull request may close these issues.

3 participants