Skip to content

Commit 6e2b94e

Browse files
authored
[skip changelog] Document the programmers system of Arduino platforms (#925)
* Document the programmers.txt configuration file of the Arduino platform system This file is used to define external programmer configurations to be used for burning bootloaders and programming Arduino boards. NOTE: the example programmer snippet is missing some of the properties that are defined in the real programmer definition in the Arduino AVR Boards platform. After a lot of investigation, experimentation, and even consulting with the original author of the code, I was still unable to find any use of these properties in the current or any past IDE version that supported the 1.5 platform format. If these properties have no purpose, they they only represent a source of confusion and maintenance burden for platform developers. * Document the "Upload Using Programmer" configuration system of Arduino platforms * Document the "Burn Bootloader" configuration system for Arduino platforms * Document programmer inheritance from referenced core platforms Previously, all programmers of all platforms of the same architecture could be used. The behavior of the Arduino IDE was changed in the 1.8.13 release in this matter, and Arduino CLI and Arduino Pro IDE followed the same behavior from the initial introduction of support for programmers. This means it's now important to document programmer inheritance.
1 parent 5ee35c7 commit 6e2b94e

File tree

1 file changed

+88
-2
lines changed

1 file changed

+88
-2
lines changed

Diff for: docs/platform-specification.md

+88-2
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,44 @@ Adding a **hide** property to a board definition causes it to not be shown in th
529529

530530
The value of the property is ignored; it's the presence or absence of the property that controls the board's visibility.
531531

532+
## programmers.txt
533+
534+
This file contains definitions for external programmers. These programmers are used by:
535+
536+
- The [**Tools > Burn Bootloader**](#burn-bootloader) feature of the IDEs and
537+
[`arduino-cli burn-bootloader`](commands/arduino-cli_burn-bootloader.md)
538+
- The [**Sketch > Upload Using Programmer**](#upload-using-an-external-programmer) feature of the IDEs and
539+
[`arduino-cli upload --programmer <programmer ID>`](commands/arduino-cli_upload.md#options)
540+
541+
programmers.txt works similarly to [boards.txt](#boardstxt). Programmers are referenced by their short name: the
542+
programmer ID. The settings for a programmer are defined through a set of properties with keys that use the programmer
543+
ID as prefix.
544+
545+
For example, the programmer ID chosen for the
546+
["Arduino as ISP" programmer](https://www.arduino.cc/en/Tutorial/ArduinoISP) is "arduinoasisp". The definition of this
547+
programmer in programmers.txt looks like:
548+
549+
[......]
550+
arduinoasisp.name=Arduino as ISP
551+
arduinoasisp.protocol=stk500v1
552+
arduinoasisp.program.speed=19200
553+
arduinoasisp.program.tool=avrdude
554+
arduinoasisp.program.extra_params=-P{serial.port} -b{program.speed}
555+
[......]
556+
557+
These properties can only be used in the recipes of the actions that use the programmer (`erase`, `bootloader`, and
558+
`program`).
559+
560+
The **arduinoasisp.name** property defines the human-friendly name of the programmer. This is shown in the **Tools >
561+
Programmer** menu of the IDEs and the output of [`arduino-cli upload --programmer list`](commands/arduino-cli_upload.md)
562+
and [`arduino-cli burn-bootloader --programmer list`](commands/arduino-cli_burn-bootloader.md).
563+
564+
In Arduino IDE 1.8.12 and older, all programmers of all installed platforms were made available for use. Starting with
565+
Arduino IDE 1.8.13 (and in all relevant versions of other Arduino development tools), only the programmers defined by
566+
the [board and core platform](#platform-terminology) of the currently selected board are available. For this reason,
567+
platforms may now need to define copies of the programmers that were previously assumed to be provided by another
568+
platform.
569+
532570
## Tools
533571

534572
The Arduino development software uses external command line tools to upload the compiled sketch to the board or to burn
@@ -701,11 +739,54 @@ The file component of the port's path (e.g., `ttyACM0`) is available as the conf
701739

702740
### Upload using an external programmer
703741

704-
**TODO...**<br> The platform.txt associated with the selected programmer will be used.
742+
The `program` action is triggered via the **Sketch > Upload Using Programmer** feature of the IDEs or
743+
[`arduino-cli upload --programmer <programmer ID>`](commands/arduino-cli_upload.md). This action is used to transfer a
744+
compiled sketch to a board using an external programmer.
745+
746+
The **program.tool** property determines the tool to be used for this action. This property is typically defined for
747+
each programmer in [programmers.txt](#programmerstxt):
748+
749+
[......]
750+
usbasp.program.tool=avrdude
751+
[......]
752+
arduinoasisp.program.tool=avrdude
753+
[......]
754+
755+
This action can use the same [upload verification preference system](#upload-verification) as the `upload` action, via
756+
the **program.verify** property.
757+
758+
When using the Arduino IDE, if the selected programmer is from a different platform than the board, the `program` recipe
759+
defined in the programmer's platform is used without overrides from the properties defined in the
760+
[platform.txt](#platformtxt) of the [board platform](#platform-terminology). When using Arduino development software
761+
other than the Arduino IDE, the handling of properties is the same as when doing a
762+
[standard Upload](#sketch-upload-configuration).
705763

706764
### Burn Bootloader
707765

708-
**TODO...**<br> The platform.txt associated with the selected board will be used.
766+
The `erase` and `bootloader` actions are triggered via the **Tools > Burn Bootloader** feature of the Arduino IDE or
767+
[`arduino-cli burn-bootloader`](commands/arduino-cli_burn-bootloader.md). This action is used to flash a bootloader to
768+
the board.
769+
770+
"Burn Bootloader" is unique in that it uses two actions, which are executed in sequence:
771+
772+
1. `erase` is typically used to erase the microcontroller's flash memory and set the configuration fuses according to
773+
the properties defined in the [board definition](#boardstxt)
774+
1. `bootloader` is used to flash the bootloader to the board
775+
776+
The **bootloader.tool** property determines the tool to be used for the `erase` and `bootloader` actions both. This
777+
property is typically defined for each board in boards.txt:
778+
779+
[......]
780+
uno.bootloader.tool=avrdude
781+
[......]
782+
leonardo.bootloader.tool=avrdude
783+
[......]
784+
785+
When using the Arduino IDE, if the board uses a
786+
[core reference](https://arduino.github.io/arduino-cli/dev/platform-specification/#core-reference), the platform.txt of
787+
the [core platform](#platform-terminology) is not used at all in defining the recipes for `erase` and `bootloader`
788+
actions. When using Arduino development software other than the Arduino IDE, the handling of properties from the core
789+
platform's platform.txt is done as usual.
709790

710791
### Sketch debugging configuration
711792

@@ -833,6 +914,11 @@ The [bundled libraries](#platform-bundled-libraries) from the referenced platfor
833914
the referencing platform to bundle those libraries. If libraries are provided, the list of available libraries is the
834915
sum of the two libraries, where the referencing platform has priority over the referenced platform.
835916

917+
The [programmers](#programmerstxt) from the referenced platform are made available, thus there is no need for the
918+
referencing platform to define those programmers. If the referencing platform does provide its own programmer
919+
definitions, the list of available programmer is the sum of the programmers of the two platforms. In Arduino IDE 1.8.12
920+
and older, all programmers of all installed platforms were made available.
921+
836922
### Variant reference
837923

838924
In the same way we can use a variant defined on another platform using the syntax **VENDOR_ID:VARIANT_ID**:

0 commit comments

Comments
 (0)