Skip to content

Commit 050d01e

Browse files
Fix documentation and code comments
Co-authored-by: per1234 <[email protected]>
1 parent 5ab1ecd commit 050d01e

File tree

6 files changed

+72
-90
lines changed

6 files changed

+72
-90
lines changed

arduino/cores/packagemanager/loader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ func (pm *PackageManager) loadDiscoveries(release *cores.PlatformRelease) []*sta
664664

665665
discoveryIDs := discoveryProperties.FirstLevelOf()
666666
delete(discoveryIDs, "required")
667-
// Get the list of tools only we if have there are discoveries that use Direct discovery integration.
667+
// Get the list of tools only if there are discoveries that use Direct discovery integration.
668668
// See:
669669
// https://github.com/arduino/tooling-rfcs/blob/main/RFCs/0002-pluggable-discovery.md#direct-discovery-integration-not-recommended
670670
// We need the tools only in that case since we might need some tool's

arduino/discovery/discoverymanager/discoverymanager.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type DiscoveryManager struct {
2727
globalEventCh chan *discovery.Event
2828
}
2929

30-
// New creates a new DiscoveriesManager
30+
// New creates a new DiscoveryManager
3131
func New() *DiscoveryManager {
3232
return &DiscoveryManager{
3333
discoveries: map[string]*discovery.PluggableDiscovery{},

cli/arguments/reference.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (r *Reference) String() string {
3636
}
3737

3838
// ParseReferences is a convenient wrapper that operates on a slice of strings and
39-
// calls ParseReferenceArg for each of them. It returns at the first invalid argument.
39+
// calls ParseReference for each of them. It returns at the first invalid argument.
4040
func ParseReferences(args []string, parseArch bool) ([]*Reference, error) {
4141
ret := []*Reference{}
4242
for _, arg := range args {
@@ -49,7 +49,7 @@ func ParseReferences(args []string, parseArch bool) ([]*Reference, error) {
4949
return ret, nil
5050
}
5151

52-
// ParseReference parses a string and return a ReferenceArg object. If `parseArch` is passed,
52+
// ParseReference parses a string and returns a Reference object. If `parseArch` is passed,
5353
// the method also tries to parse the architecture bit, i.e. string must be in the form
5454
// "packager:arch@version", useful to represent a platform (or core) name.
5555
func ParseReference(arg string, parseArch bool) (*Reference, error) {

docs/UPGRADING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Here you can find a list of migration guides to handle breaking changes between
44

55
## Unreleased
66

7-
### gRPC interface `UploadRequest`, `UploadUsingProgrammerRequest`, `BurnBootloaderRequest`, `DetectedPort` arguments changes
7+
### gRPC interface `UploadRequest`, `UploadUsingProgrammerRequest`, `BurnBootloaderRequest`, `DetectedPort` field changes
88

9-
`UploadRequest`, `UploadUsingProgrammerRequest` and `BurnBootloaderRequest` had their `port` argument change from type
9+
`UploadRequest`, `UploadUsingProgrammerRequest` and `BurnBootloaderRequest` had their `port` field change from type
1010
`string` to `Port`.
1111

1212
`Port` contains the following information:
@@ -57,12 +57,12 @@ message DetectedPort {
5757

5858
The properties previously contained directly in the message are now stored in the `port` property.
5959

60-
This changes are necessary for the Pluggable Discovery.
60+
These changes are necessary for the Pluggable Discovery.
6161

6262
### gRPC interface `BoardListItem` change
6363

64-
The `vid` and `pid` properties of the `BoardListItem` have been removed. They used to only be available when requesting
65-
connected board lists, now that information is stored in the `port` property of `DetectedPort`.
64+
The `vid` and `pid` fields of the `BoardListItem` message have been removed. They used to only be available when
65+
requesting connected board lists, now that information is stored in the `port` field of `DetectedPort`.
6666

6767
### Change public library interface
6868

docs/package_index_json-specification.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -217,10 +217,10 @@ Finally, let's see how `PLATFORMS` are made.
217217
{ "packager": "arduino", "name": "avr-gcc", "version": "4.8.1-arduino5" },
218218
{ "packager": "arduino", "name": "avrdude", "version": "6.0.1-arduino5" }
219219
],
220-
"discoveryDependencies": [
221-
{ "packager": "arduino", "name": "serial-discovery" },
222-
{ "packager": "arduino", "name": "mdns-discovery" }
223-
]
220+
"discoveryDependencies": [
221+
{ "packager": "arduino", "name": "serial-discovery" },
222+
{ "packager": "arduino", "name": "mdns-discovery" }
223+
]
224224
},
225225
```
226226

docs/platform-specification.md

Lines changed: 59 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -627,61 +627,48 @@ variables.
627627

628628
#### Pluggable Discovery
629629

630-
Discovery tools are a special kind of tools that are used to find supported boards, a platform must declare one or more
631-
Pluggable Discoveries in its `platform.txt`. It's ok to use another platform discovery or the builtin ones if necessary.
630+
Discovery tools are a special kind of tool used to find supported boards. A platform must declare one or more Pluggable
631+
Discoveries in its [`platform.txt`](#platformtxt). Discoveries can be referenced from other packages, including the
632+
`builtin` dummy package which contains the traditional discoveries.
632633

633-
There are two different syntaxes to declare discoveries, if the platform uses just one discovery:
634+
There are two different syntaxes to declare discoveries. If the platform uses just one discovery:
634635

635-
```
636-
discovery.required=PLATFORM:DISCOVERY_NAME
637-
```
636+
discovery.required=VENDOR_ID:DISCOVERY_NAME
638637

639638
instead if it needs multiple discoveries:
640639

641-
```
642-
discovery.required.0=PLATFORM:DISCOVERY_ID_1
643-
discovery.required.1=PLATFORM:DISCOVERY_ID_2
644-
```
640+
discovery.required.0=VENDOR_ID:DISCOVERY_0_NAME
641+
discovery.required.1=VENDOR_ID:DISCOVERY_1_NAME
645642

646-
A platform that supports only boards connected to the serial can easily use the builtin `serial-discovery` without
647-
creating a custom Pluggable Discovery:
643+
A platform that supports only boards connected via serial ports can easily use the `builtin` package's
644+
`serial-discovery` without creating a custom Pluggable Discovery:
648645

649-
```
650-
discovery.required=builtin:serial-discovery
651-
```
646+
discovery.required=builtin:serial-discovery
652647

653-
if it supports also boards connected to the network it can use the builtin `mdns-discovery`:
648+
if it also supports boards connected via the network, it can use the `builtin` package's `mdns-discovery`:
654649

655-
```
656-
discovery.required.0=builtin:serial-discovery
657-
discovery.required.1=builtin:mdns-discovery
658-
```
650+
discovery.required.0=builtin:serial-discovery
651+
discovery.required.1=builtin:mdns-discovery
659652

660-
Since the above syntax requires adding a discovery in the `discoveryDependencies` field in the platform
661-
`package_index.json` it might be cumbersome to do it before releasing it so we also provide another syntax to ease
662-
development:
653+
Since the above syntax requires specifying a discovery via the `discoveryDependencies` field of the platform's
654+
[package index](package_index_json-specification.md), it might be cumbersome to use with manual installations. So we
655+
provide another syntax to ease development and beta testing:
663656

664-
```
665-
discovery.DISCOVERY_ID.pattern=DISCOVERY_RECIPE
666-
```
657+
discovery.DISCOVERY_ID.pattern=DISCOVERY_RECIPE
667658

668659
`DISCOVERY_ID` must be replaced by a unique identifier for the particular discovery and `DISCOVERY_RECIPE` must be
669660
replaced by the command line to launch the discovery. An example could be:
670661

671-
```
672-
## Teensy Ports Discovery
673-
discovery.teensy.pattern="{runtime.tools.teensy_ports.path}/hardware/tools/teensy_ports" -J2
674-
```
662+
## Teensy Ports Discovery
663+
discovery.teensy.pattern="{runtime.tools.teensy_ports.path}/hardware/tools/teensy_ports" -J2
675664

676-
We strongly recommend not using this syntax on released platforms but only for development purposes.
665+
We strongly recommend using this syntax only for development purposes and not on released platforms.
677666

678667
For backward compatibility, if a platform does not declare any discovery (using the `discovery.*` properties in
679-
`platform.txt`) it will automatically inherits `builtin:serial-discovery` and `builtin:mdns-discovery` (but not other
680-
builtin discoveries that may be possibly added in the future). This will allow all legacy non-pluggable platforms to
681-
migrate to pluggable discovery without disruption.
668+
`platform.txt`) it will automatically inherit `builtin:serial-discovery` and `builtin:mdns-discovery` (but not other
669+
builtin discoveries that may be possibly added in the future).
682670

683-
For detailed information see the [Pluggable Discovery specification](pluggable-discovery-specification.md)
684-
documentation.
671+
For detailed information, see the [Pluggable Discovery specification](pluggable-discovery-specification.md).
685672

686673
#### Verbose parameter
687674

@@ -719,8 +706,8 @@ The **upload.tool.<protocol_name\>** property determines the tool to be used for
719706
leonardo.upload.tool.network=arduino_ota
720707
[......]
721708

722-
When the user tries to upload using a certain protocol but the board doesn't support it it will fallback to `default` if
723-
specified. A board can always specify a `default` protocol even if others are defined:
709+
Multiple protocols can be defined for each board. When the user tries to upload using a protocol not supported by the
710+
board, it will fallback to `default` if one was defined:
724711

725712
[......]
726713
uno.upload.tool.default=avrdude
@@ -729,8 +716,8 @@ specified. A board can always specify a `default` protocol even if others are de
729716
leonardo.upload.tool.network=arduino_ota
730717
[......]
731718

732-
`default` is also used when no upload address is provided by the user, this can be done only for boards that use upload
733-
tools with builtin port detection like `openocd`.
719+
`default` is also used when no upload address is provided by the user. This can be used with tools that have built-in
720+
port detection (e.g., `openocd`).
734721

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

@@ -777,19 +764,19 @@ If a platform supports Pluggable Discovery it can also use the port's properties
777764
the following port metadata coming from a pluggable discovery:
778765

779766
{
780-
"eventType": "add",
781-
"port": {
782-
"address": "/dev/ttyACM0",
783-
"label": "ttyACM0",
784-
"protocol": "serial",
785-
"protocolLabel": "Serial Port (USB)",
786-
"properties": {
787-
"pid": "0x804e",
788-
"vid": "0x2341",
789-
"serialNumber": "EBEABFD6514D32364E202020FF10181E",
790-
"name": "ttyACM0"
791-
}
767+
"eventType": "add",
768+
"port": {
769+
"address": "/dev/ttyACM0",
770+
"label": "ttyACM0",
771+
"protocol": "serial",
772+
"protocolLabel": "Serial Port (USB)",
773+
"properties": {
774+
"pid": "0x804e",
775+
"vid": "0x2341",
776+
"serialNumber": "EBEABFD6514D32364E202020FF10181E",
777+
"name": "ttyACM0"
792778
}
779+
}
793780
}
794781

795782
will be available on the recipe as the variables:
@@ -808,17 +795,17 @@ will be available on the recipe as the variables:
808795
Here another example:
809796

810797
{
811-
"eventType": "add",
812-
"port": {
798+
"eventType": "add",
799+
"port": {
813800
"address": "192.168.1.232",
814801
"label": "SSH on my-board (192.168.1.232)",
815802
"protocol": "ssh",
816803
"protocolLabel": "SSH Network port",
817804
"properties": {
818-
"macprefix": "AA:BB:CC",
819-
"macaddress": "AA:BB:CC:DD:EE:FF"
805+
"macprefix": "AA:BB:CC",
806+
"macaddress": "AA:BB:CC:DD:EE:FF"
820807
}
821-
}
808+
}
822809
}
823810

824811
that is translated to:
@@ -831,7 +818,7 @@ that is translated to:
831818
{upload.port.properties.macaddress} = AA:BB:CC:DD:EE:FF
832819
{serial.port} = 192.168.1.232 # for backward compatibility
833820

834-
This configuration, together with protocol selection, allows to remove the hardcoded `network_pattern`, now we can
821+
This configuration, together with protocol selection, allows to remove the hardcoded `network_pattern`. Now we can
835822
replace the legacy recipe (split into multiple lines for clarity):
836823

837824
tools.bossac.upload.network_pattern="{runtime.tools.arduinoOTA.path}/bin/arduinoOTA"
@@ -847,25 +834,22 @@ with:
847834
#### User provided fields
848835

849836
Some upload recipes might require custom fields that must be provided by the user, like username and password to upload
850-
over the network. In this case the recipe must use the special placeholder {upload.field.FIELD_NAME} where FIELD_NAME
851-
must be declared separately in the recipe using the following format:
837+
over the network. In this case the recipe must use the special placeholder **{upload.field.FIELD_NAME}**, where
838+
**FIELD_NAME** must be declared separately in the recipe using the following format:
852839

853840
tools.UPLOAD_RECIPE_ID.upload.field.FIELD_NAME=FIELD_LABEL
854841
tools.UPLOAD_RECIPE_ID.upload.field.FIELD_NAME.secret=true
855842

856-
FIELD_LABEL is the label shown in the graphical prompt to ask the user to enter the value of the field. The secret
857-
property is optional and it should be set to true if the field is a secret (like passwords or token).
843+
**FIELD_LABEL** is the label shown in the graphical prompt where the user is asked to enter the value for the field.
844+
845+
The optional **secret** property should be set to `true` if the field is a secret (like a password or token).
858846

859-
Lets see how a complete example will look like:
847+
Let's see a complete example:
860848

861849
tools.arduino_ota.upload.field.username=Username
862850
tools.arduino_ota.upload.field.password=Password
863851
tools.arduino_ota.upload.field.password.secret=true
864-
tools.arduino_ota.upload.pattern="{runtime.tools.arduinoOTA.path}/bin/arduinoOTA"
865-
-address {upload.port.address} -port 65280
866-
-username "{upload.field.username}
867-
-password "{upload.field.password}"
868-
-sketch "{build.path}/{build.project_name}.bin"
852+
tools.arduino_ota.upload.pattern="{runtime.tools.arduinoOTA.path}/bin/arduinoOTA" -address {upload.port.address} -port 65280 -username "{upload.field.username} -password "{upload.field.password}" -sketch "{build.path}/{build.project_name}.bin"
869853

870854
#### Upload verification
871855

@@ -943,7 +927,8 @@ The `program` action is triggered via the **Sketch > Upload Using Programmer** f
943927
compiled sketch to a board using an external programmer.
944928

945929
The **program.tool** property determines the tool to be used for this action. This property is typically defined for
946-
each programmer in [programmers.txt](#programmerstxt) and uses the same syntax as `upload` action:
930+
each programmer in [programmers.txt](#programmerstxt) and uses the same syntax as
931+
[the `upload` action](#sketch-upload-configuration):
947932

948933
[......]
949934
usbasp.program.tool.serial=avrdude
@@ -983,15 +968,16 @@ the board.
983968
1. `bootloader` is used to flash the bootloader to the board
984969

985970
The **bootloader.tool** property determines the tool to be used for the `erase` and `bootloader` actions both. This
986-
property is typically defined for each board in boards.txt and uses the same syntax as `upload` action:
971+
property is typically defined for each board in boards.txt and uses the same syntax as
972+
[the `upload` action](#sketch-upload-configuration):
987973

988974
[......]
989975
uno.bootloader.tool.serial=avrdude
990976
[......]
991-
leonardo.upload.tool.serial=avrdude
992-
leonardo.upload.tool.network=arduino_ota
977+
leonardo.bootloader.tool.serial=avrdude
978+
leonardo.bootloader.tool.network=arduino_ota
993979
[......]
994-
duemilanove.upload.tool.default=avrdude
980+
duemilanove.bootloader.tool.default=avrdude
995981
[......]
996982

997983
For backward compatibility with IDE 1.8.15 and older the previous syntax is still supported:
@@ -1217,7 +1203,3 @@ software is in use:
12171203
This behavior
12181204
[can be configured](https://arduino.github.io/arduino-cli/latest/commands/arduino-cli_core_install/#options)
12191205
- **Arduino Pro IDE**: (since 0.1.0) runs the script for any installed platform.
1220-
1221-
```
1222-
1223-
```

0 commit comments

Comments
 (0)